Added Release Workflow and Fixed some build script issues (#1013)

* ci linux: make builds properly static
* test workflow_dispatch
* install wayland-protocols
* append missing portable
* make debug builds by default
* auto enable some video subsystems for proper wayland support
* added release workflow
* make line shorter in innosetup bash script
* disable some video subsystems on darwin and windows
* fix default build dir on msys
* print output of ntldd
* properly set msys arch
* disable opengl on windows
* copy mingw dependencies on package
* innosetup script copy from generated package dir
* changed license to reflect team work
* adjusted the ci windows install name
* add all language plugins to addons
* disabled generation of source tarballs
* removed language_cpp from plugins repo
* enabled lua utf8 patch for windows build
* added open_ext to addons
* moved away from deprecated virtual environments
* make minimal build and with addons
* simplified CI build.yml
This commit is contained in:
Jefferson González
2022-09-25 16:59:01 -04:00
committed by GitHub
parent a640360d0d
commit 9f1294fea2
11 changed files with 475 additions and 265 deletions
+52 -24
View File
@@ -1,5 +1,5 @@
#!/bin/env bash
set -ex
set -e
if [ ! -e "src/api/api.h" ]; then
echo "Please run this script from the root directory of Lite XL."
@@ -8,6 +8,13 @@ fi
source scripts/common.sh
ARCH="$(uname -m)"
BUILD_DIR="$(get_default_build_dir)"
RUN_BUILD=true
STATIC_BUILD=false
ADDONS=false
BUILD_TYPE="debug"
show_help(){
echo
echo "Usage: $0 <OPTIONS>"
@@ -16,22 +23,21 @@ show_help(){
echo
echo "-h --help Show this help and exits."
echo "-b --builddir DIRNAME Sets the name of the build dir (no path)."
echo " Default: 'build'."
echo " Default: '${BUILD_DIR}'."
echo " --debug Debug this script."
echo "-n --nobuild Skips the build step, use existing files."
echo "-s --static Specify if building using static libraries"
echo " by using lhelper tool."
echo "-s --static Specify if building using static libraries."
echo "-v --version VERSION Specify a version, non whitespace separated string."
echo "-a --addons Install 3rd party addons."
echo "-r --release Compile in release mode."
echo
}
ARCH="$(uname -m)"
BUILD_DIR="$(get_default_build_dir)"
RUN_BUILD=true
STATIC_BUILD=false
initial_arg_count=$#
for i in "$@"; do
case $i in
-h|--belp)
-h|--help)
show_help
exit 0
;;
@@ -40,10 +46,22 @@ for i in "$@"; do
shift
shift
;;
-a|--addons)
ADDONS=true
shift
;;
--debug)
set -x
shift
;;
-n|--nobuild)
RUN_BUILD=false
shift
;;
-r|--release)
BUILD_TYPE="release"
shift
;;
-s|--static)
STATIC_BUILD=true
shift
@@ -59,25 +77,19 @@ for i in "$@"; do
esac
done
# TODO: Versioning using git
#if [[ -z $VERSION && -d .git ]]; then
# VERSION=$(git describe --tags --long | sed 's/^v//; s/\([^-]*-g\)/r\1/; s/-/./g')
#fi
if [[ -n $1 ]]; then
# show help if no valid argument was found
if [ $initial_arg_count -eq $# ]; then
show_help
exit 1
fi
setup_appimagetool() {
if ! which appimagetool > /dev/null ; then
if [ ! -e appimagetool ]; then
if ! wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${ARCH}.AppImage" ; then
echo "Could not download the appimagetool for the arch '${ARCH}'."
exit 1
else
chmod 0755 appimagetool
fi
if [ ! -e appimagetool ]; then
if ! wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${ARCH}.AppImage" ; then
echo "Could not download the appimagetool for the arch '${ARCH}'."
exit 1
else
chmod 0755 appimagetool
fi
fi
}
@@ -104,7 +116,14 @@ build_litexl() {
echo "Build lite-xl..."
sleep 1
meson setup --buildtype=release --prefix /usr ${BUILD_DIR}
if [[ $STATIC_BUILD == false ]]; then
meson setup --buildtype=$BUILD_TYPE --prefix=/usr ${BUILD_DIR}
else
meson setup --wrap-mode=forcefallback \
--buildtype=$BUILD_TYPE \
--prefix=/usr \
${BUILD_DIR}
fi
meson compile -C ${BUILD_DIR}
}
@@ -121,6 +140,11 @@ generate_appimage() {
cp resources/icons/lite-xl.svg LiteXL.AppDir/
cp resources/linux/org.lite_xl.lite_xl.desktop LiteXL.AppDir/
if [[ $ADDONS == true ]]; then
addons_download "${BUILD_DIR}"
addons_install "${BUILD_DIR}" "LiteXL.AppDir/usr/share/lite-xl"
fi
if [[ $STATIC_BUILD == false ]]; then
echo "Copying libraries..."
@@ -153,6 +177,10 @@ generate_appimage() {
version="-$VERSION"
fi
if [[ $ADDONS == true ]]; then
version="${version}-addons"
fi
./appimagetool LiteXL.AppDir LiteXL${version}-${ARCH}.AppImage
}
+7 -1
View File
@@ -25,12 +25,14 @@ show_help() {
echo "-U --windows-lua-utf Use the UTF8 patch for Lua."
echo " macOS: disabled when used with --bundle,"
echo " Windows: Implicit being the only option."
echo "-r --release Compile in release mode."
echo
}
main() {
local platform="$(get_platform_name)"
local build_dir="$(get_default_build_dir)"
local build_type="debug"
local prefix=/
local force_fallback
local bundle
@@ -84,6 +86,10 @@ main() {
patch_lua="true"
shift
;;
-r|--release)
build_type="release"
shift
;;
*)
# unknown option
;;
@@ -103,7 +109,7 @@ main() {
rm -rf "${build_dir}"
CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS meson setup \
--buildtype=release \
--buildtype=$build_type \
--prefix "$prefix" \
$force_fallback \
$bundle \
+73 -1
View File
@@ -2,6 +2,64 @@
set -e
addons_download() {
local build_dir="$1"
if [[ -d "${build_dir}/third/data/colors" ]]; then
echo "Warning: found previous addons installation, skipping."
echo " addons path: ${build_dir}/third/data/colors"
return 0
fi
# Download third party color themes
curl --insecure \
-L "https://github.com/lite-xl/lite-xl-colors/archive/master.zip" \
-o "${build_dir}/lite-xl-colors.zip"
mkdir -p "${build_dir}/third/data/colors"
unzip "${build_dir}/lite-xl-colors.zip" -d "${build_dir}"
mv "${build_dir}/lite-xl-colors-master/colors" "${build_dir}/third/data"
rm -rf "${build_dir}/lite-xl-colors-master"
# Download widgets library
curl --insecure \
-L "https://github.com/lite-xl/lite-xl-widgets/archive/master.zip" \
-o "${build_dir}/lite-xl-widgets.zip"
unzip "${build_dir}/lite-xl-widgets.zip" -d "${build_dir}"
mv "${build_dir}/lite-xl-widgets-master" "${build_dir}/third/data/widget"
# Downlaod thirdparty plugins
curl --insecure \
-L "https://github.com/lite-xl/lite-xl-plugins/archive/2.1.zip" \
-o "${build_dir}/lite-xl-plugins.zip"
unzip "${build_dir}/lite-xl-plugins.zip" -d "${build_dir}"
mv "${build_dir}/lite-xl-plugins-2.1/plugins" "${build_dir}/third/data"
rm -rf "${build_dir}/lite-xl-plugins-2.1"
}
# Addons installation: some distributions forbid external downloads
# so make it as optional module.
addons_install() {
local build_dir="$1"
local data_dir="$2"
for module_name in colors widget; do
cp -r "${build_dir}/third/data/$module_name" "${data_dir}"
done
mkdir -p "${data_dir}/plugins"
for plugin_name in settings open_ext; do
cp -r "${build_dir}/third/data/plugins/${plugin_name}.lua" \
"${data_dir}/plugins/"
done
cp "${build_dir}/third/data/plugins/"language_* \
"${data_dir}/plugins/"
}
get_platform_name() {
if [[ "$OSTYPE" == "msys" ]]; then
echo "windows"
@@ -14,9 +72,23 @@ get_platform_name() {
fi
}
get_platform_arch() {
platform=$(get_platform_name)
arch=$(uname -m)
if [[ $MSYSTEM != "" ]]; then
if [[ $MSYSTEM == "MINGW64" ]]; then
arch=x86_64
else
arch=i686
fi
fi
echo "$arch"
}
get_default_build_dir() {
platform=$(get_platform_name)
echo "build-$platform-$(uname -m)"
arch=$(get_platform_arch)
echo "build-$platform-$arch"
}
if [[ $(get_platform_name) == "UNSUPPORTED-OS" ]]; then
+1 -3
View File
@@ -69,9 +69,7 @@ Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescrip
Name: "portablemode"; Description: "Portable Mode"; Flags: unchecked
[Files]
Source: "{#BuildDir}/src/lite-xl.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#BuildDir}/mingwLibs{#Arch}/*"; DestDir: "{app}"; Flags: ignoreversion ; Check: DirExists(ExpandConstant('{#BuildDir}/mingwLibs{#Arch}'))
Source: "{#SourceDir}/data/*"; DestDir: "{app}/data"; Flags: ignoreversion recursesubdirs
Source: "{#SourceDir}/lite-xl/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
+32 -9
View File
@@ -15,15 +15,29 @@ show_help() {
echo
echo "-b --builddir DIRNAME Sets the name of the build directory (not path)."
echo " Default: '$(get_default_build_dir)'."
echo "-v --version VERSION Sets the version on the package name."
echo "-a --addons Tell the script we are packaging an install with addons."
echo " --debug Debug this script."
echo
}
main() {
local build_dir=$(get_default_build_dir)
local addons=false
local arch
local arch_file
local version
local output
if [[ $MSYSTEM == "MINGW64" ]]; then arch=x64; else arch=Win32; fi
if [[ $MSYSTEM == "MINGW64" ]]; then
arch=x64
arch_file=x86_64
else
arch=i686;
arch_file=i686
fi
initial_arg_count=$#
for i in "$@"; do
case $i in
@@ -31,11 +45,20 @@ main() {
show_help
exit 0
;;
-a|--addons)
addons=true
shift
;;
-b|--builddir)
build_dir="$2"
shift
shift
;;
-v|--version)
if [[ -n $2 ]]; then version="-$2"; fi
shift
shift
;;
--debug)
set -x
shift
@@ -46,19 +69,19 @@ main() {
esac
done
if [[ -n $1 ]]; then
# show help if no valid argument was found
if [ $initial_arg_count -eq $# ]; then
show_help
exit 1
fi
# Copy MinGW libraries dependencies.
# MSYS2 ldd command seems to be only 64bit, so use ntldd
# see https://github.com/msys2/MINGW-packages/issues/4164
local mingwLibsDir="${build_dir}/mingwLibs$arch"
mkdir -p "$mingwLibsDir"
ntldd -R "${build_dir}/src/lite-xl.exe" | grep mingw | awk '{print $3}' | sed 's#\\#/#g' | xargs -I '{}' cp -v '{}' $mingwLibsDir
if [[ $addons == true ]]; then
version="${version}-addons"
fi
"/c/Program Files (x86)/Inno Setup 6/ISCC.exe" -dARCH=$arch "${build_dir}/scripts/innosetup.iss"
output="LiteXL${version}-${arch_file}-setup"
"/c/Program Files (x86)/Inno Setup 6/ISCC.exe" -dARCH=$arch //F"${output}" "${build_dir}/scripts/innosetup.iss"
pushd "${build_dir}/scripts"; mv LiteXL*.exe "./../../"; popd
}
+1 -1
View File
@@ -48,7 +48,7 @@ main() {
if [[ $lhelper == true ]]; then
sudo apt-get install -qq ninja-build
else
sudo apt-get install -qq ninja-build libsdl2-dev libfreetype6
sudo apt-get install -qq libfuse2 ninja-build wayland-protocols libsdl2-dev libfreetype6
fi
pip3 install meson
elif [[ "$OSTYPE" == "darwin"* ]]; then
+41 -34
View File
@@ -20,44 +20,19 @@ show_help() {
echo "-h --help Show this help and exit."
echo "-p --prefix PREFIX Install directory prefix. Default: '/'."
echo "-v --version VERSION Sets the version on the package name."
echo " --addons Install 3rd party addons (currently Lite XL colors)."
echo "-a --addons Install 3rd party addons."
echo " --debug Debug this script."
echo "-A --appimage Create an AppImage (Linux only)."
echo "-B --binary Create a normal / portable package or macOS bundle,"
echo " depending on how the build was configured. (Default.)"
echo "-D --dmg Create a DMG disk image with AppDMG (macOS only)."
echo "-I --innosetup Create a InnoSetup package (Windows only)."
echo "-r --release Strip debugging symbols."
echo "-S --source Create a source code package,"
echo " including subprojects dependencies."
echo
}
# Addons installation: some distributions forbid external downloads
# so make it as optional module.
install_addons() {
local build_dir="$1"
local data_dir="$2"
if [[ -d "${build_dir}/third/data/colors" ]]; then
echo "Warning: found previous colors addons installation, skipping."
return 0
fi
# Copy third party color themes
curl --insecure \
-L "https://github.com/lite-xl/lite-xl-colors/archive/master.zip" \
-o "${build_dir}/lite-xl-colors.zip"
mkdir -p "${build_dir}/third/data/colors"
unzip "${build_dir}/lite-xl-colors.zip" -d "${build_dir}"
mv "${build_dir}/lite-xl-colors-master/colors" "${build_dir}/third/data"
rm -rf "${build_dir}/lite-xl-colors-master"
for module_name in colors; do
cp -r "${build_dir}/third/data/$module_name" "${data_dir}"
done
}
source_package() {
local build_dir=build-src
local package_name=$1
@@ -85,7 +60,7 @@ source_package() {
}
main() {
local arch="$(uname -m)"
local arch="$(get_platform_arch)"
local platform="$(get_platform_name)"
local build_dir="$(get_default_build_dir)"
local dest_dir=lite-xl
@@ -96,8 +71,12 @@ main() {
local binary=false
local dmg=false
local innosetup=false
local release=false
local source=false
# store the current flags to easily pass them to appimage script
local flags="$@"
for i in "$@"; do
case $i in
-b|--builddir)
@@ -152,11 +131,15 @@ main() {
fi
shift
;;
-r|--release)
release=true
shift
;;
-S|--source)
source=true
shift
;;
--addons)
-a|--addons)
addons=true
shift
;;
@@ -170,6 +153,10 @@ main() {
esac
done
if [[ $addons == true ]]; then
version="$version-addons"
fi
if [[ -n $1 ]]; then show_help; exit 1; fi
# The source package doesn't require a previous build,
@@ -190,6 +177,7 @@ main() {
local data_dir="$(pwd)/${dest_dir}/data"
local exe_file="$(pwd)/${dest_dir}/lite-xl"
local package_name=lite-xl$version-$platform-$arch
local bundle=false
local portable=false
@@ -202,6 +190,14 @@ main() {
if [[ $platform == "windows" ]]; then
exe_file="${exe_file}.exe"
stripcmd="strip --strip-all"
# Copy MinGW libraries dependencies.
# MSYS2 ldd command seems to be only 64bit, so use ntldd
# see https://github.com/msys2/MINGW-packages/issues/4164
ntldd -R "${exe_file}" \
| grep mingw \
| awk '{print $3}' \
| sed 's#\\#/#g' \
| xargs -I '{}' cp -v '{}' "$(pwd)/${dest_dir}/"
else
# Windows archive is always portable
package_name+="-portable"
@@ -227,7 +223,10 @@ main() {
mkdir -p "${data_dir}"
if [[ $addons == true ]]; then install_addons "${build_dir}" "${data_dir}"; fi
if [[ $addons == true ]]; then
addons_download "${build_dir}"
addons_install "${build_dir}" "${data_dir}"
fi
# TODO: use --skip-subprojects when 0.58.0 will be available on supported
# distributions to avoid subprojects' include and lib directories to be copied.
@@ -238,7 +237,9 @@ main() {
find . -type d -empty -delete
popd
$stripcmd "${exe_file}"
if [[ $release == true ]]; then
$stripcmd "${exe_file}"
fi
echo "Creating a compressed archive ${package_name}"
if [[ $binary == true ]]; then
@@ -252,9 +253,15 @@ main() {
fi
fi
if [[ $appimage == true ]]; then source scripts/appimage.sh; fi
if [[ $bundle == true && $dmg == true ]]; then source scripts/appdmg.sh "${package_name}"; fi
if [[ $innosetup == true ]]; then source scripts/innosetup/innosetup.sh -b "${build_dir}"; fi
if [[ $appimage == true ]]; then
source scripts/appimage.sh $flags --static
fi
if [[ $bundle == true && $dmg == true ]]; then
source scripts/appdmg.sh "${package_name}"
fi
if [[ $innosetup == true ]]; then
source scripts/innosetup/innosetup.sh $flags
fi
}
main "$@"