Cross compiling improvements + macOS universal binary (#1458)

* chore(resources): rename macos_arm64.txt to macos-arm64.txt
   This matches the platform-arch convention like many other parts of the project.
* chore(resources/cross): rename wasm.txt to unknown-wasm32.txt
* refactor(scripts/common.sh): use parameter expansion instead of if else
* feat(scripts/common.sh): support custom arch and platform for get_default_build_dir
* feat(scripts/build.sh): add --cross-platform, --cross-arch and --cross-file
* feat(scripts/package.sh): add --cross-platform and --cross-arch
* feat(build-packages.sh): add support for new options in build.sh and packages.sh
* ci(build): make arm64 binaries in CI
* ci(build): do not install external libraries
* ci(build): fix invalid artifact name
* ci(build): fix INSTALL_NAME
* ci(build): change name for macos artifacts
* ci(build): add script to build universal dmgs from individual dmgs
* ci(build): build universal dmgs
* fix(make-universal-binaries): fix wrong path for hdiutil
* ci(build): rename macos action
* fix(make-universal-binaries.sh): fix wrong pathname for ditto
* ci(release): build macos universal binaries
* ci(release): remove useless variables
* ci(release): fix wrong dependency
* ci(build): fix old ubuntu version
   This version will be restored once I complete some container-specific fixes.
* ci(build): make build_macos_universal depend on release
* ci(build): fix wrong dmg dir
* style(ci): capitalize 'universal' for CI name
* fix(make-universal-binaries.sh): fix truncated dmg name when it contains dots
* ci: styling changes
* ci(release): install appdmg only
This commit is contained in:
Takase 2023-04-11 23:33:34 +08:00 committed by George Sokianos
parent c2357721e5
commit 6ad288aa39
9 changed files with 315 additions and 79 deletions

View File

@ -54,11 +54,14 @@ jobs:
path: ${{ env.INSTALL_NAME }}.tar.gz path: ${{ env.INSTALL_NAME }}.tar.gz
build_macos: build_macos:
name: macOS (x86_64) name: macOS
runs-on: macos-11 runs-on: macos-11
env: env:
CC: clang CC: clang
CXX: clang++ CXX: clang++
strategy:
matrix:
arch: ['x86_64', 'arm64']
steps: steps:
- name: System Information - name: System Information
run: | run: |
@ -70,24 +73,60 @@ jobs:
run: | run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH" echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_REF=${GITHUB_REF##*/}" >> "$GITHUB_ENV" echo "INSTALL_REF=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-macos-$(uname -m)" >> "$GITHUB_ENV" echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-macos-${{ matrix.arch }}" >> "$GITHUB_ENV"
if [[ $(uname -m) != ${{ matrix.arch }} ]]; then echo "ARCH=--cross-arch ${{ matrix.arch }}" >> "$GITHUB_ENV"; fi
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Python Setup - name: Python Setup
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: 3.9 python-version: 3.9
- name: Install Dependencies - name: Install Dependencies
run: bash scripts/install-dependencies.sh --debug # --lhelper will eliminate a warning with arm64 and libusb
run: bash scripts/install-dependencies.sh --debug --lhelper
- name: Build - name: Build
run: | run: |
bash --version bash --version
bash scripts/build.sh --bundle --debug --forcefallback bash scripts/build.sh --bundle --debug --forcefallback $ARCH
- name: Create DMG Image - name: Create DMG Image
run: bash scripts/package.sh --version ${INSTALL_REF} --debug --dmg run: bash scripts/package.sh --version ${INSTALL_REF} $ARCH --debug --dmg
- name: Upload DMG Image - name: Upload DMG Image
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: macOS DMG Image name: macOS DMG Images
path: ${{ env.INSTALL_NAME }}.dmg
build_macos_universal:
name: macOS (Universal)
runs-on: macos-11
needs: build_macos
steps:
- name: System Information
run: |
system_profiler SPSoftwareDataType
bash --version
gcc -v
xcodebuild -version
- name: Set Environment Variables
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-macos-universal" >> "$GITHUB_ENV"
- uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v3
id: download
with:
name: macOS DMG Images
path: dmgs-original
- name: Install appdmg
run: cd ~; npm i appdmg; cd -
- name: Make universal bundles
run: |
bash --version
bash scripts/make-universal-binaries.sh ${{ steps.download.outputs.download-path }} "${INSTALL_NAME}"
- name: Upload DMG Image
uses: actions/upload-artifact@v2
with:
name: macOS Universal DMG Images
path: ${{ env.INSTALL_NAME }}.dmg path: ${{ env.INSTALL_NAME }}.dmg
build_windows_msys2: build_windows_msys2:

View File

@ -15,7 +15,7 @@ on:
jobs: jobs:
release: release:
name: Create Release name: Create Release
runs-on: ubuntu-18.04 runs-on: ubuntu-latest
outputs: outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }} upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.tag.outputs.version }} version: ${{ steps.tag.outputs.version }}
@ -49,7 +49,7 @@ jobs:
build_linux: build_linux:
name: Linux name: Linux
needs: release needs: release
runs-on: ubuntu-18.04 runs-on: ubuntu-latest
env: env:
CC: gcc CC: gcc
CXX: g++ CXX: g++
@ -115,6 +115,7 @@ jobs:
echo "INSTALL_REF=${{ needs.release.outputs.version }}" >> "$GITHUB_ENV" echo "INSTALL_REF=${{ needs.release.outputs.version }}" >> "$GITHUB_ENV"
echo "INSTALL_NAME=lite-xl-${{ needs.release.outputs.version }}-macos-${{ matrix.arch }}" >> "$GITHUB_ENV" echo "INSTALL_NAME=lite-xl-${{ needs.release.outputs.version }}-macos-${{ matrix.arch }}" >> "$GITHUB_ENV"
echo "INSTALL_NAME_ADDONS=lite-xl-${{ needs.release.outputs.version }}-addons-macos-${{ matrix.arch }}" >> "$GITHUB_ENV" echo "INSTALL_NAME_ADDONS=lite-xl-${{ needs.release.outputs.version }}-addons-macos-${{ matrix.arch }}" >> "$GITHUB_ENV"
if [[ $(uname -m) != ${{ matrix.arch }} ]]; then echo "ARCH=--cross-arch ${{ matrix.arch }}" >> "$GITHUB_ENV"; fi
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Python Setup - name: Python Setup
uses: actions/setup-python@v4 uses: actions/setup-python@v4
@ -125,11 +126,18 @@ jobs:
- name: Build - name: Build
run: | run: |
bash --version bash --version
CROSS_ARCH=${{ matrix.arch }} bash scripts/build.sh --bundle --debug --forcefallback --release bash scripts/build.sh --bundle --debug --forcefallback --release $ARCH
- name: Create DMG Image - name: Create DMG Image
run: | run: |
CROSS_ARCH=${{ matrix.arch }} bash scripts/package.sh --version ${INSTALL_REF} --debug --dmg --release bash scripts/package.sh --version ${INSTALL_REF} $ARCH --debug --dmg --release
CROSS_ARCH=${{ matrix.arch }} bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --dmg --release bash scripts/package.sh --version ${INSTALL_REF} $ARCH --debug --addons --dmg --release
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: macOS DMG Images
path: |
${{ env.INSTALL_NAME }}.dmg
${{ env.INSTALL_NAME_ADDONS }}.dmg
- name: Upload Files - name: Upload Files
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
@ -139,6 +147,54 @@ jobs:
${{ env.INSTALL_NAME }}.dmg ${{ env.INSTALL_NAME }}.dmg
${{ env.INSTALL_NAME_ADDONS }}.dmg ${{ env.INSTALL_NAME_ADDONS }}.dmg
build_macos_universal:
name: macOS (Universal)
needs: [release, build_macos]
runs-on: macos-11
steps:
- name: System Information
run: |
system_profiler SPSoftwareDataType
bash --version
gcc -v
xcodebuild -version
- name: Set Environment Variables
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_BASE=lite-xl-${{ needs.release.outputs.version }}-macos" >> "$GITHUB_ENV"
echo "INSTALL_BASE_ADDONS=lite-xl-${{ needs.release.outputs.version }}-addons-macos" >> "$GITHUB_ENV"
- uses: actions/checkout@v2
- name: Download Artifacts
uses: actions/download-artifact@v3
id: download
with:
name: macOS DMG Images
path: dmgs-original
- name: Python Setup
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install appdmg
run: cd ~; npm i appdmg; cd -
- name: Prepare DMG Images
run: |
mkdir -p dmgs-addons dmgs-normal
mv -v "${{ steps.download.outputs.download-path }}/$INSTALL_BASE-"{x86_64,arm64}.dmg dmgs-normal
mv -v "${{ steps.download.outputs.download-path }}/$INSTALL_BASE_ADDONS-"{x86_64,arm64}.dmg dmgs-addons
- name: Create Universal DMGs
run: |
bash --version
bash scripts/make-universal-binaries.sh dmgs-normal "$INSTALL_BASE-universal"
bash scripts/make-universal-binaries.sh dmgs-addons "$INSTALL_BASE_ADDONS-universal"
- name: Upload Files
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.release.outputs.version }}
draft: true
files: |
${{ env.INSTALL_BASE }}-universal.dmg
${{ env.INSTALL_BASE_ADDONS }}-universal.dmg
build_windows_msys2: build_windows_msys2:
name: Windows name: Windows
needs: release needs: release

View File

@ -13,33 +13,36 @@ show_help() {
echo echo
echo "Common options:" echo "Common options:"
echo echo
echo "-h --help Show this help and exit." echo "-h --help Show this help and exit."
echo "-b --builddir DIRNAME Set the name of the build directory (not path)." echo "-b --builddir DIRNAME Set the name of the build directory (not path)."
echo " Default: '$(get_default_build_dir)'." echo " Default: '$(get_default_build_dir)'."
echo "-p --prefix PREFIX Install directory prefix." echo "-p --prefix PREFIX Install directory prefix."
echo " Default: '/'." echo " Default: '/'."
echo " --debug Debug this script." echo " --cross-platform PLATFORM The platform to cross compile for."
echo " --cross-arch ARCH The architecture to cross compile for."
echo " --debug Debug this script."
echo echo
echo "Build options:" echo "Build options:"
echo echo
echo "-f --forcefallback Force to build subprojects dependencies statically." echo "-f --forcefallback Force to build subprojects dependencies statically."
echo "-B --bundle Create an App bundle (macOS only)" echo "-B --bundle Create an App bundle (macOS only)"
echo "-P --portable Create a portable package." echo "-P --portable Create a portable package."
echo "-O --pgo Use profile guided optimizations (pgo)." echo "-O --pgo Use profile guided optimizations (pgo)."
echo " Requires running the application iteractively." echo " Requires running the application iteractively."
echo " --cross-file CROSS_FILE The cross file used for compiling."
echo echo
echo "Package options:" echo "Package options:"
echo echo
echo "-d --destdir DIRNAME Set the name of the package directory (not path)." echo "-d --destdir DIRNAME Set the name of the package directory (not path)."
echo " Default: 'lite-xl'." echo " Default: 'lite-xl'."
echo "-v --version VERSION Sets the version on the package name." echo "-v --version VERSION Sets the version on the package name."
echo "-A --appimage Create an AppImage (Linux only)." echo "-A --appimage Create an AppImage (Linux only)."
echo "-D --dmg Create a DMG disk image (macOS only)." echo "-D --dmg Create a DMG disk image (macOS only)."
echo " Requires NPM and AppDMG." echo " Requires NPM and AppDMG."
echo "-I --innosetup Create an InnoSetup installer (Windows only)." echo "-I --innosetup Create an InnoSetup installer (Windows only)."
echo "-r --release Compile in release mode." echo "-r --release Compile in release mode."
echo "-S --source Create a source code package," echo "-S --source Create a source code package,"
echo " including subprojects dependencies." echo " including subprojects dependencies."
echo echo
} }
@ -60,6 +63,12 @@ main() {
local portable local portable
local pgo local pgo
local release local release
local cross_platform
local cross_platform_option=()
local cross_arch
local cross_arch_option=()
local cross_file
local cross_file_option=()
for i in "$@"; do for i in "$@"; do
case $i in case $i in
@ -123,6 +132,21 @@ main() {
pgo="--pgo" pgo="--pgo"
shift shift
;; ;;
--cross-platform)
cross_platform="$2"
shift
shift
;;
--cross-arch)
cross_arch="$2"
shift
shift
;;
--cross-file)
cross_file="$2"
shift
shift
;;
--debug) --debug)
debug="--debug" debug="--debug"
set -x set -x
@ -143,10 +167,18 @@ main() {
if [[ -n $dest_dir ]]; then dest_dir_option=("--destdir" "${dest_dir}"); fi if [[ -n $dest_dir ]]; then dest_dir_option=("--destdir" "${dest_dir}"); fi
if [[ -n $prefix ]]; then prefix_option=("--prefix" "${prefix}"); fi if [[ -n $prefix ]]; then prefix_option=("--prefix" "${prefix}"); fi
if [[ -n $version ]]; then version_option=("--version" "${version}"); fi if [[ -n $version ]]; then version_option=("--version" "${version}"); fi
if [[ -n $cross_platform ]]; then cross_platform_option=("--cross-platform" "${cross_platform}"); fi
if [[ -n $cross_arch ]]; then cross_arch_option=("--cross-arch" "${cross_arch}"); fi
if [[ -n $cross_file ]]; then cross_file_option=("--cross-file" "${cross_file}"); fi
source scripts/build.sh \ source scripts/build.sh \
${build_dir_option[@]} \ ${build_dir_option[@]} \
${prefix_option[@]} \ ${prefix_option[@]} \
${cross_platform_option[@]} \
${cross_arch_option[@]} \
${cross_file_option[@]} \
$debug \ $debug \
$force_fallback \ $force_fallback \
$bundle \ $bundle \
@ -159,6 +191,8 @@ main() {
${dest_dir_option[@]} \ ${dest_dir_option[@]} \
${prefix_option[@]} \ ${prefix_option[@]} \
${version_option[@]} \ ${version_option[@]} \
${cross_platform_option[@]} \
${cross_arch_option[@]} \
--binary \ --binary \
--addons \ --addons \
$debug \ $debug \

View File

@ -13,19 +13,26 @@ show_help() {
echo echo
echo "Available options:" echo "Available options:"
echo echo
echo "-b --builddir DIRNAME Sets the name of the build directory (not path)." echo "-b --builddir DIRNAME Sets the name of the build directory (not path)."
echo " Default: '$(get_default_build_dir)'." echo " Default: '$(get_default_build_dir)'."
echo " --debug Debug this script." echo " --debug Debug this script."
echo "-f --forcefallback Force to build dependencies statically." echo "-f --forcefallback Force to build dependencies statically."
echo "-h --help Show this help and exit." echo "-h --help Show this help and exit."
echo "-p --prefix PREFIX Install directory prefix. Default: '/'." echo "-p --prefix PREFIX Install directory prefix. Default: '/'."
echo "-B --bundle Create an App bundle (macOS only)" echo "-B --bundle Create an App bundle (macOS only)"
echo "-P --portable Create a portable binary package." echo "-P --portable Create a portable binary package."
echo "-O --pgo Use profile guided optimizations (pgo)." echo "-O --pgo Use profile guided optimizations (pgo)."
echo "-U --windows-lua-utf Use the UTF8 patch for Lua." echo "-U --windows-lua-utf Use the UTF8 patch for Lua."
echo " macOS: disabled when used with --bundle," echo " macOS: disabled when used with --bundle,"
echo " Windows: Implicit being the only option." echo " Windows: Implicit being the only option."
echo "-r --release Compile in release mode." echo "-r --release Compile in release mode."
echo " --cross-platform PLATFORM Cross compile for this platform."
echo " The script will find the appropriate"
echo " cross file in 'resources/cross'."
echo " --cross-arch ARCH Cross compile for this architecture."
echo " The script will find the appropriate"
echo " cross file in 'resources/cross'."
echo " --cross-file CROSS_FILE Cross compile with the given cross file."
echo echo
} }
@ -40,6 +47,10 @@ main() {
local portable local portable
local pgo local pgo
local patch_lua local patch_lua
local cross
local cross_platform
local cross_arch
local cross_file
local lua_subproject_path local lua_subproject_path
@ -87,6 +98,24 @@ main() {
patch_lua="true" patch_lua="true"
shift shift
;; ;;
--cross-arch)
cross="true"
cross_arch="$2"
shift
shift
;;
--cross-platform)
cross="true"
cross_platform="$2"
shift
shift
;;
--cross-file)
cross="true"
cross_file="$2"
shift
shift
;;
-r|--release) -r|--release)
build_type="release" build_type="release"
shift shift
@ -107,19 +136,43 @@ main() {
portable="" portable=""
fi fi
if [[ $CROSS_ARCH != "" ]]; then # if CROSS_ARCH is used, it will be picked up
if [[ $platform == "macos" ]]; then cross="${cross:-$CROSS_ARCH}"
macos_version_min=10.11 if [[ -n "$cross" ]]; then
if [[ $CROSS_ARCH == "arm64" ]]; then if [[ -n "$cross_file" ]] && ([[ -z "$cross_arch" ]] || [[ -z "$cross_platform" ]]); then
cross_file="--cross-file resources/cross/macos_arm64.txt" echo "Warning: --cross-platform or --cross-platform not set; guessing it from the filename."
macos_version_min=11.0 # remove file extensions and directories from the path
cross_file_name="${cross_file##*/}"
cross_file_name="${cross_file_name%%.*}"
# cross_platform is the string before encountering the first hyphen
if [[ -z "$cross_platform" ]]; then
cross_platform="${cross_file_name%%-*}"
echo "Warning: Guessing --cross-platform $cross_platform"
fi
# cross_arch is the string after encountering the first hyphen
if [[ -z "$cross_arch" ]]; then
cross_arch="${cross_file_name#*-}"
echo "Warning: Guessing --cross-arch $cross_arch"
fi fi
export MACOSX_DEPLOYMENT_TARGET=$macos_version_min
export MIN_SUPPORTED_MACOSX_DEPLOYMENT_TARGET=$macos_version_min
export CFLAGS=-mmacosx-version-min=$macos_version_min
export CXXFLAGS=-mmacosx-version-min=$macos_version_min
export LDFLAGS=-mmacosx-version-min=$macos_version_min
fi fi
platform="${cross_platform:-$platform}"
arch="${cross_arch:-$arch}"
cross_file=("--cross-file" "${cross_file:-resources/cross/$platform-$arch.txt}")
# reload build_dir because platform and arch might change
build_dir="$(get_default_build_dir "$platform" "$arch")"
fi
# arch and platform specific stuff
if [[ "$platform" == "macos" ]]; then
macos_version_min="10.11"
if [[ "$arch" == "arm64" ]]; then
macos_version_min="11.0"
fi
export MACOSX_DEPLOYMENT_TARGET="$macos_version_min"
export MIN_SUPPORTED_MACOSX_DEPLOYMENT_TARGET="$macos_version_min"
export CFLAGS="-mmacosx-version-min=$macos_version_min"
export CXXFLAGS="-mmacosx-version-min=$macos_version_min"
export LDFLAGS="-mmacosx-version-min=$macos_version_min"
fi fi
rm -rf "${build_dir}" rm -rf "${build_dir}"
@ -137,7 +190,7 @@ main() {
CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS meson setup \ CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS meson setup \
--buildtype=$build_type \ --buildtype=$build_type \
--prefix "$prefix" \ --prefix "$prefix" \
$cross_file \ "${cross_file[@]}" \
$force_fallback \ $force_fallback \
$bundle \ $bundle \
$portable \ $portable \

View File

@ -75,22 +75,20 @@ get_platform_name() {
get_platform_arch() { get_platform_arch() {
platform=$(get_platform_name) platform=$(get_platform_name)
arch=$(uname -m) arch=${CROSS_ARCH:-$(uname -m)}
if [[ $MSYSTEM != "" ]]; then if [[ $MSYSTEM != "" ]]; then
if [[ $MSYSTEM == "MINGW64" ]]; then if [[ $MSYSTEM == "MINGW64" ]]; then
arch=x86_64 arch=x86_64
else else
arch=i686 arch=i686
fi fi
elif [[ $CROSS_ARCH != "" ]]; then
arch=$CROSS_ARCH
fi fi
echo "$arch" echo "$arch"
} }
get_default_build_dir() { get_default_build_dir() {
platform=$(get_platform_name) platform="${1:-$(get_platform_name)}"
arch=$(get_platform_arch) arch="${2:-$(get_platform_arch)}"
echo "build-$platform-$arch" echo "build-$platform-$arch"
} }

View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -ex
if [ ! -e "src/api/api.h" ]; then
echo "Please run this script from the root directory of Lite XL."
exit 1
fi
WORKDIR="work"
DMGDIR="$1"
if [[ -z "$DMGDIR" ]]; then
echo "Please provide a path containing the dmg files."
exit 1
fi
rm -rf "$WORKDIR"
mkdir -p "$WORKDIR"
for dmg_path in "$DMGDIR"/*.dmg; do
dmg="${dmg_path##*/}"
dmg="${dmg%.dmg}"
hdiutil attach -mountpoint "/Volumes/$dmg" "$dmg_path"
if [[ ! -d "$WORKDIR/dmg" ]]; then
ditto "/Volumes/$dmg/Lite XL.app" "Lite XL.app"
fi
cp "/Volumes/$dmg/Lite XL.app/Contents/MacOS/lite-xl" "$WORKDIR/$dmg-lite-xl"
hdiutil detach "/Volumes/$dmg"
done
lipo -create -output "Lite XL.app/Contents/MacOS/lite-xl" "$WORKDIR/"*-lite-xl
source scripts/appdmg.sh "$2"

View File

@ -13,23 +13,25 @@ show_help() {
echo echo
echo "Available options:" echo "Available options:"
echo echo
echo "-b --builddir DIRNAME Sets the name of the build directory (not path)." echo "-b --builddir DIRNAME Sets the name of the build directory (not path)."
echo " Default: '$(get_default_build_dir)'." echo " Default: '$(get_default_build_dir)'."
echo "-d --destdir DIRNAME Set the name of the package directory (not path)." echo "-d --destdir DIRNAME Set the name of the package directory (not path)."
echo " Default: 'lite-xl'." echo " Default: 'lite-xl'."
echo "-h --help Show this help and exit." echo "-h --help Show this help and exit."
echo "-p --prefix PREFIX Install directory prefix. Default: '/'." echo "-p --prefix PREFIX Install directory prefix. Default: '/'."
echo "-v --version VERSION Sets the version on the package name." echo "-v --version VERSION Sets the version on the package name."
echo "-a --addons Install 3rd party addons." echo "-a --addons Install 3rd party addons."
echo " --debug Debug this script." echo " --debug Debug this script."
echo "-A --appimage Create an AppImage (Linux only)." echo "-A --appimage Create an AppImage (Linux only)."
echo "-B --binary Create a normal / portable package or macOS bundle," echo "-B --binary Create a normal / portable package or macOS bundle,"
echo " depending on how the build was configured. (Default.)" echo " depending on how the build was configured. (Default.)"
echo "-D --dmg Create a DMG disk image with AppDMG (macOS only)." echo "-D --dmg Create a DMG disk image with AppDMG (macOS only)."
echo "-I --innosetup Create a InnoSetup package (Windows only)." echo "-I --innosetup Create a InnoSetup package (Windows only)."
echo "-r --release Strip debugging symbols." echo "-r --release Strip debugging symbols."
echo "-S --source Create a source code package," echo "-S --source Create a source code package,"
echo " including subprojects dependencies." echo " including subprojects dependencies."
echo " --cross-platform PLATFORM The platform to package for."
echo " --cross-arch ARCH The architecture to package for."
echo echo
} }
@ -73,6 +75,9 @@ main() {
local innosetup=false local innosetup=false
local release=false local release=false
local source=false local source=false
local cross
local cross_arch
local cross_platform
# store the current flags to easily pass them to appimage script # store the current flags to easily pass them to appimage script
local flags="$@" local flags="$@"
@ -143,6 +148,18 @@ main() {
addons=true addons=true
shift shift
;; ;;
--cross-platform)
cross=true
cross_platform="$2"
shift
shift
;;
--cross-arch)
cross=true
cross_arch="$2"
shift
shift
;;
--debug) --debug)
set -x set -x
shift shift
@ -159,6 +176,12 @@ main() {
if [[ -n $1 ]]; then show_help; exit 1; fi if [[ -n $1 ]]; then show_help; exit 1; fi
if [[ -n "$cross" ]]; then
platform="${cross_platform:-$platform}"
arch="${cross_arch:-$arch}"
build_dir="$(get_default_build_dir "$platform" "$arch")"
fi
# The source package doesn't require a previous build, # The source package doesn't require a previous build,
# nor the following install step, so run it now. # nor the following install step, so run it now.
if [[ $source == true ]]; then source_package "lite-xl$version-src"; fi if [[ $source == true ]]; then source_package "lite-xl$version-src"; fi