Adapt all scripts to work together with build-packages.sh

This commit is contained in:
redtide 2021-08-29 10:15:55 +02:00 committed by Francesco
parent 9e5d404b29
commit 38d85f2483
17 changed files with 829 additions and 601 deletions

View File

@ -1,26 +1,25 @@
name: CI
# All builds use lhelper only for releases,
# otherwise for normal builds dependencies are dynamically linked.
on:
push:
branches:
- '*'
# Temporarily disabled
#tags:
#- 'v[0-9]*'
# tags:
# - 'v[0-9]*'
pull_request:
branches:
- '*'
jobs:
# Note: not using git-archive(-all) because it can't include subprojects ignored by git
archive_source_code:
name: Source Code Tarball
runs-on: ubuntu-18.04
# Only on tags/releases
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Set Environment Variables
run: echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-src" >> "$GITHUB_ENV"
- uses: actions/checkout@v2
- name: Python Setup
uses: actions/setup-python@v2
@ -30,16 +29,14 @@ jobs:
run: |
sudo apt-get install -qq ninja-build
pip3 install meson
- name: Archive source code
- name: Package
shell: bash
run: bash scripts/source-package.sh --destdir "${INSTALL_NAME}"
run: bash scripts/package.sh --version ${GITHUB_REF##*/} --debug --source
- uses: actions/upload-artifact@v2
with:
name: Source Code Tarball
path: ${{ env.INSTALL_NAME }}.tar.gz
path: "lite-xl-*-src.tar.gz"
# All builds use lhelper only for releases, using --static build argument,
# otherwise for normal builds dependencies are dynamically linked.
build_linux:
name: Linux
runs-on: ubuntu-18.04
@ -52,11 +49,12 @@ jobs:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
steps:
- name: Set Archive Name
- name: Set Environment Variables
if: ${{ matrix.config.cc == 'gcc' }}
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_REF=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-linux" >> "$GITHUB_ENV"
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-linux-$(uname -m)" >> "$GITHUB_ENV"
- uses: actions/checkout@v2
- name: Python Setup
uses: actions/setup-python@v2
@ -64,27 +62,24 @@ jobs:
python-version: 3.6
- name: Update Packages
run: sudo apt-get update
- name: Install Meson
run: |
sudo apt-get install -qq ninja-build
pip3 install meson
- name: Install Dependencies
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: sudo apt-get install -qq libsdl2-dev libfreetype6
run: bash scripts/install-dependencies.sh --debug
- name: Install Release Dependencies
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
bash scripts/install-dependencies.sh --debug --lhelper
bash scripts/lhelper.sh --debug
- name: Build
if: ${{ matrix.config.cc == 'gcc' && !startsWith(github.ref, 'refs/tags/') }}
run: bash scripts/build.sh --prefix /
- name: Release Build
if: ${{ matrix.config.cc == 'gcc' && startsWith(github.ref, 'refs/tags/') }}
run: bash scripts/build.sh --prefix / --static
run: |
bash --version
bash scripts/build.sh --debug --forcefallback
- name: Package
if: ${{ matrix.config.cc == 'gcc' }}
run: |
DESTDIR="$(pwd)/$INSTALL_NAME" meson install --skip-subprojects -C build
tar czvf "${INSTALL_NAME}".tar.gz "${INSTALL_NAME}"
run: bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --binary
- name: AppImage
if: ${{ matrix.config.cc == 'gcc' && startsWith(github.ref, 'refs/tags/') }}
run: bash scripts/appimage.sh --nobuild --static --version ${{ env.INSTALL_REF }}
run: bash scripts/appimage.sh --nobuild --version ${INSTALL_REF}
- name: Upload Artifacts
uses: actions/upload-artifact@v2
if: ${{ matrix.config.cc == 'gcc' }}
@ -104,47 +99,42 @@ jobs:
- name: System Information
run: |
system_profiler SPSoftwareDataType
bash --version
gcc -v
xcodebuild -version
- name: Set Archive Name
- name: Set Environment Variables
run: |
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-macos" >> "$GITHUB_ENV"
bash --version
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_REF=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-macos-$(uname -m)" >> "$GITHUB_ENV"
- uses: actions/checkout@v2
- name: Python Setup
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Build Tools
run: |
brew install ninja
pip3 install meson
cd ~; npm install appdmg; cd -
~/node_modules/appdmg/bin/appdmg.js --version
- name: Install Dependencies
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: brew install sdl2
- name: Install LHelper Dependencies
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: brew install bash md5sha1sum
- name: Build
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: bash scripts/build.sh --prefix "${GITHUB_WORKSPACE}/Lite XL.app"
- name: Release Build
run: bash scripts/install-dependencies.sh --debug
- name: Install Release Dependencies
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
bash scripts/install-dependencies.sh --debug --lhelper
bash scripts/lhelper.sh --debug
- name: Build
run: |
bash --version
bash scripts/build.sh --prefix "${GITHUB_WORKSPACE}/Lite XL.app" --static
bash scripts/build.sh --bundle --debug --forcefallback
- name: Error Logs
if: failure()
run: |
mkdir ${INSTALL_NAME}
cp /usr/var/lhenv/lite-xl/logs/* ${INSTALL_NAME}
tar czvf ${INSTALL_NAME}.tar.gz ${INSTALL_NAME}
- name: Install
run: meson install --skip-subprojects -C build
# - name: Package
# if: ${{ !startsWith(github.ref, 'refs/tags/') }}
# run: bash scripts/package.sh --version ${INSTALL_REF} --debug --addons
- name: Create DMG Image
run: bash scripts/appdmg.sh ${{ env.INSTALL_NAME }}
run: bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --dmg
- name: Upload DMG Image
uses: actions/upload-artifact@v2
with:
@ -178,34 +168,20 @@ jobs:
git
zip
- name: Set Environment Variables
run: echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-$(echo $MSYSTEM | awk '{print tolower($0)}')" >> "$GITHUB_ENV"
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
echo "INSTALL_NAME=lite-xl-${GITHUB_REF##*/}-windows-$(uname -m)" >> "$GITHUB_ENV"
echo "INSTALL_REF=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
- name: Install Dependencies
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: |
pacman --noconfirm -S \
${MINGW_PACKAGE_PREFIX}-gcc \
${MINGW_PACKAGE_PREFIX}-meson \
${MINGW_PACKAGE_PREFIX}-ninja \
${MINGW_PACKAGE_PREFIX}-pkg-config \
${MINGW_PACKAGE_PREFIX}-freetype \
${MINGW_PACKAGE_PREFIX}-pcre2 \
${MINGW_PACKAGE_PREFIX}-SDL2
run: bash scripts/install-dependencies.sh --debug
- name: Install Release Dependencies
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
pacman --noconfirm -S \
${MINGW_PACKAGE_PREFIX}-gcc \
${MINGW_PACKAGE_PREFIX}-meson \
${MINGW_PACKAGE_PREFIX}-ninja \
${MINGW_PACKAGE_PREFIX}-pkg-config
run: bash scripts/install-dependencies.sh --debug --lhelper
- name: Build
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: bash scripts/build.sh --prefix /
- name: Release Build
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
bash --version
bash scripts/build.sh --prefix / --static
bash scripts/build.sh --debug --forcefallback
- name: Error Logs
if: failure()
run: |
@ -213,10 +189,10 @@ jobs:
cp /usr/var/lhenv/lite-xl/logs/* ${INSTALL_NAME}
tar czvf ${INSTALL_NAME}.tar.gz ${INSTALL_NAME}
- name: Package
run: bash scripts/msys2-package.sh --destdir ${INSTALL_NAME}
run: bash scripts/package.sh --version ${INSTALL_REF} --debug --addons --binary
- name: Build Installer
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: bash scripts/innosetup/innosetup.sh
run: bash scripts/innosetup/innosetup.sh --debug
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
@ -234,9 +210,8 @@ jobs:
deploy:
name: Deployment
runs-on: ubuntu-18.04
# Temporarily disabled
# if: startsWith(github.ref, 'refs/tags/')
if: false
#if: startsWith(github.ref, 'refs/tags/')
needs:
- archive_source_code
- build_linux

2
.gitignore vendored
View File

@ -10,6 +10,7 @@ subprojects/reproc/
.lite-debug.log
.run*
*.diff
*.exe
*.tar.gz
*.zip
*.DS_Store
@ -17,3 +18,4 @@ subprojects/reproc/
compile_commands.json
error.txt
lite-xl*
LiteXL*

View File

@ -49,11 +49,11 @@ If you compile Lite XL yourself, it is recommended to use the script
`build-packages.sh`:
```sh
bash build-packages.sh <arch>
bash build-packages.sh -h
```
The script will run Meson and create a zip file with the application or,
for Linux, a tar compressed archive. Lite XL can be easily installed
The script will run Meson and create a tar compressed archive with the application or,
for Windows, a zip file. Lite XL can be easily installed
by unpacking the archive in any directory of your choice.
Otherwise the following is an example of basic commands if you want to customize
@ -65,7 +65,15 @@ meson compile -C build
DESTDIR="$(pwd)/lite-xl" meson install --skip-subprojects -C build
```
where `<prefix>` might be one of `/`, `/usr` or `/opt`, the default is `/usr/local`.
where `<prefix>` might be one of `/`, `/usr` or `/opt`, the default is `/`.
To build a bundle application on macOS:
```sh
meson setup --buildtype=release --Dbundle=true --prefix / build
meson compile -C build
DESTDIR="$(pwd)/Lite XL.app" meson install --skip-subprojects -C build
```
Please note that the package is relocatable to any prefix and the option prefix
affects only the place where the application is actually installed.

View File

@ -1,259 +1,156 @@
#!/bin/bash
set -e
# strip-components is normally set to 1 to strip the initial "data" from the
# directory path.
copy_directory_from_repo () {
local tar_options=()
if [[ $1 == --strip-components=* ]]; then
tar_options+=($1)
if [ ! -e "src/api/api.h" ]; then
echo "Please run this script from the root directory of Lite XL."; exit 1
fi
source scripts/common.sh
show_help() {
echo
echo "Usage: $0 <OPTIONS>"
echo
echo "Common options:"
echo
echo "-h --help Show this help and exit."
echo "-b --builddir DIRNAME Set the name of the build directory (not path)."
echo " Default: '$(get_default_build_dir)'."
echo "-p --prefix PREFIX Install directory prefix."
echo " Default: '/'."
echo " --debug Debug this script."
echo
echo "Build options:"
echo
echo "-f --forcefallback Force to build subprojects dependencies statically."
echo "-B --bundle Create an App bundle (macOS only)"
echo "-P --portable Create a portable package."
echo
echo "Package options:"
echo
echo "-d --destdir DIRNAME Set the name of the package directory (not path)."
echo " Default: 'lite-xl'."
echo "-v --version VERSION Sets the version on the package name."
echo "-A --appimage Create an AppImage (Linux only)."
echo "-D --dmg Create a DMG disk image (macOS only)."
echo " Requires NPM and AppDMG."
echo "-I --innosetup Create an InnoSetup installer (Windows only)."
echo "-S --source Create a source code package,"
echo " including subprojects dependencies."
echo
}
main() {
local build_dir
local build_dir_option=()
local dest_dir
local dest_dir_option=()
local prefix
local prefix_option=()
local version
local version_option=()
local debug
local force_fallback
local appimage
local bundle
local innosetup
local portable
for i in "$@"; do
case $i in
-h|--help)
show_help
exit 0
;;
-b|--builddir)
build_dir="$2"
shift
fi
local dirname="$1"
local destdir="$2"
_archive "$use_branch" "$dirname" "$destdir" "${tar_options[@]}"
}
_archive () {
if [[ $git_available -eq 1 ]]; then
git archive "$1" "$2" --format=tar | tar xf - -C "$3" "$4"
else
cp -r "$2" "$3"
fi
}
# Check if build directory is ok to be used to build.
build_dir_is_usable () {
local build="$1"
if [[ $build == */* || -z "$build" ]]; then
echo "invalid build directory, no path allowed: \"$build\""
return 1
fi
if [[ $git_available -eq 1 ]]; then
git ls-files --error-unmatch "$build" &> /dev/null
if [ $? == 0 ]; then
echo "invalid path, \"$build\" is under revision control"
return 1
fi
fi
}
# Ordinary release build
lite_build () {
local build="$1"
build_dir_is_usable "$build" || exit 1
rm -fr "$build"
setup_options=("${@:2}")
if [[ "$OSTYPE" == "darwin"* ]]; then
setup_options+=(-Dbundle=true)
fi
meson setup --buildtype=release "${setup_options[@]}" "$build" || exit 1
ninja -C "$build" || exit 1
}
# Build using Profile Guided Optimizations (PGO)
lite_build_pgo () {
local build="$1"
build_dir_is_usable "$build" || exit 1
rm -fr "$build"
echo meson setup --buildtype=release "${@:2}" -Db_pgo=generate "$build"
meson setup --buildtype=release "${@:2}" -Db_pgo=generate "$build" || exit 1
ninja -C "$build" || exit 1
copy_directory_from_repo data "$build/src"
"$build/src/lite-xl"
meson configure -Db_pgo=use "$build"
ninja -C "$build" || exit 1
}
lite_build_package_windows () {
local portable="-msys"
if [ "$1" == "-portable" ]; then
portable=""
shift
fi
local build="$1"
local arch="$2"
local os="win"
local pdir=".package-build/lite-xl"
if [ -z "$portable" ]; then
local bindir="$pdir"
local datadir="$pdir/data"
else
local bindir="$pdir/bin"
local datadir="$pdir/share/lite-xl"
fi
mkdir -p "$bindir"
mkdir -p "$datadir"
for module_name in core plugins colors fonts; do
copy_directory_from_repo --strip-components=1 "data/$module_name" "$datadir"
done
# copy the meson generated start.lua file
cp "$build/start.lua" "$datadir/core"
for module_name in plugins colors; do
cp -r "$build/third/data/$module_name" "$datadir"
done
cp "$build/src/lite-xl.exe" "$bindir"
strip --strip-all "$bindir/lite-xl.exe"
pushd ".package-build"
local package_name="lite-xl-$os-$arch$portable.zip"
zip "$package_name" -r "lite-xl"
mv "$package_name" ..
popd
rm -fr ".package-build"
echo "created package $package_name"
}
lite_build_package_macos () {
local build="$1"
local arch="$2"
local os="macos"
local appdir=".package-build/lite-xl.app"
local bindir="$appdir/Contents/MacOS"
local datadir="$appdir/Contents/Resources"
mkdir -p "$bindir" "$datadir"
for module_name in core plugins colors fonts; do
copy_directory_from_repo --strip-components=1 "data/$module_name" "$datadir"
done
# copy the meson generated start.lua file
cp "$build/start.lua" "$datadir/core"
for module_name in plugins colors; do
cp -r "$build/third/data/$module_name" "$datadir"
done
cp resources/icons/icon.icns "$appdir/Contents/Resources/icon.icns"
cp "$build/Info.plist" "$appdir/Contents/Info.plist"
cp "$build/src/lite-xl" "$bindir/lite-xl"
strip "$bindir/lite-xl"
pushd ".package-build"
local package_name="lite-xl-$os-$arch.zip"
zip "$package_name" -r "lite-xl.app"
mv "$package_name" ..
popd
rm -fr ".package-build"
echo "created package $package_name"
}
lite_build_package_linux () {
local portable=""
if [ "$1" == "-portable" ]; then
portable="-portable"
shift
fi
local build="$1"
local arch="$2"
local os="linux"
local pdir=".package-build/lite-xl"
if [ "$portable" == "-portable" ]; then
local bindir="$pdir"
local datadir="$pdir/data"
local docdir="$pdir/doc"
else
local bindir="$pdir/bin"
local datadir="$pdir/share/lite-xl"
local docdir="$pdir/share/doc/lite-xl"
fi
mkdir -p "$bindir"
mkdir -p "$datadir"
mkdir -p "$docdir"
for module_name in core plugins colors fonts; do
copy_directory_from_repo --strip-components=1 "data/$module_name" "$datadir"
done
# copy the meson generated start.lua file
cp "$build/start.lua" "$datadir/core"
for module_name in plugins colors; do
cp -r "$build/third/data/$module_name" "$datadir"
done
cp "$build/src/lite-xl" "$bindir"
cp "licenses/licenses.md" "$docdir"
strip "$bindir/lite-xl"
if [ -z "$portable" ]; then
mkdir -p "$pdir/share/applications" "$pdir/share/icons/hicolor/scalable/apps" "$pdir/share/metainfo"
cp "resources/linux/org.lite_xl.lite_xl.desktop" "$pdir/share/applications"
cp "resources/linux/org.lite_xl.lite_xl.appdata.xml" "$pdir/share/metainfo"
cp "resources/icons/lite-xl.svg" "$pdir/share/icons/hicolor/scalable/apps/lite-xl.svg"
fi
pushd ".package-build"
local package_name="lite-xl-$os-$arch$portable.tar.gz"
tar czf "$package_name" "lite-xl"
mv "$package_name" ..
popd
rm -fr ".package-build"
echo "created package $package_name"
}
lite_build_package () {
if [[ "$OSTYPE" == msys || "$OSTYPE" == win32 ]]; then
lite_build_package_windows "$@"
elif [[ "$OSTYPE" == "darwin"* ]]; then
lite_build_package_macos "$@"
elif [[ "$OSTYPE" == "linux"* || "$OSTYPE" == "freebsd"* ]]; then
lite_build_package_linux "$@"
else
echo "Unknown OS type \"$OSTYPE\""
exit 1
fi
}
lite_copy_third_party_modules () {
local build="$1"
curl --insecure -L "https://github.com/rxi/lite-colors/archive/master.zip" -o "$build/rxi-lite-colors.zip"
mkdir -p "$build/third/data/colors" "$build/third/data/plugins"
unzip "$build/rxi-lite-colors.zip" -d "$build"
mv "$build/lite-colors-master/colors" "$build/third/data"
rm -fr "$build/lite-colors-master"
}
build_opts=()
unset arch
while [ ! -z {$1+x} ]; do
case $1 in
-renderer)
build_opts+=("-Drenderer=true")
shift
;;
-pgo)
pgo=true
-d|--destdir)
dest_dir="$2"
shift
shift
;;
-branch=*)
use_branch="${1#-branch=}"
-f|--forcefallback)
force_fallback="--forcefallback"
shift
;;
-p|--prefix)
prefix="$2"
shift
shift
;;
-v|--version)
version="$2"
shift
shift
;;
-A|--appimage)
appimage="--appimage"
shift
;;
-B|--bundle)
bundle="--bundle"
shift
;;
-D|--dmg)
dmg="--dmg"
shift
;;
-I|--innosetup)
innosetup="--innosetup"
shift
;;
-P|--portable)
portable="--portable"
shift
;;
-S|--source)
source="--source"
shift
;;
--debug)
debug="--debug"
set -x
shift
;;
*)
arch="$1"
break
# unknown option
;;
esac
done
done
if [ -z ${arch+set} ]; then
echo "usage: $0 [options] <arch>"
if [[ -n $1 ]]; then
show_help
exit 1
fi
if [[ -d ".git" || $BUILD_PROHIBIT_GIT -ne 0 ]]; then
git_available=1;
else
echo "Use of git prohibited. Either '.git' wasn't found or BUILD_PROHIBIT_GIT was set."
git_available=0;
fi
if [ -z ${use_branch+set} ]; then
if [[ $git_available -eq 1 ]]; then
use_branch="$(git rev-parse --abbrev-ref HEAD)"
else
# it really doesn't matter if git isn't present
use_branch="master"
fi
fi
if [[ -n $build_dir ]]; then build_dir_option=("--builddir" "${build_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 $version ]]; then version_option=("--version" "${version}"); fi
build_dir=".build-$arch"
source scripts/build.sh \
${build_dir_option[@]} \
${prefix_option[@]} \
$debug \
$force_fallback \
$bundle \
$portable
if [ -z ${pgo+set} ]; then
lite_build "$build_dir" "${build_opts[@]}"
else
lite_build_pgo "$build_dir" "${build_opts[@]}"
fi
lite_copy_third_party_modules "$build_dir"
lite_build_package "$build_dir" "$arch"
if [[ ! ( "$OSTYPE" == "linux"* || "$OSTYPE" == "freebsd"* || "$OSTYPE" == "darwin"* ) ]]; then
lite_build_package -portable "$build_dir" "$arch"
fi
source scripts/package.sh \
${build_dir_option[@]} \
${dest_dir_option[@]} \
${prefix_option[@]} \
${version_option[@]} \
--binary \
--addons \
$debug \
$appimage \
$dmg \
$innosetup \
$source
}
main "$@"

View File

@ -42,26 +42,28 @@ endif
#===============================================================================
# Dependencies
#===============================================================================
libm = cc.find_library('m', required : false)
libdl = cc.find_library('dl', required : false)
lua_dep = dependency('lua5.2', fallback: ['lua', 'lua_dep'],
if not get_option('source-only')
libm = cc.find_library('m', required : false)
libdl = cc.find_library('dl', required : false)
lua_dep = dependency('lua5.2', fallback: ['lua', 'lua_dep'],
default_options: ['shared=false', 'use_readline=false', 'app=false']
)
pcre2_dep = dependency('libpcre2-8')
sdl_dep = dependency('sdl2', method: 'config-tool')
reproc_dep = dependency('reproc', fallback: ['reproc', 'reproc_dep'],
)
pcre2_dep = dependency('libpcre2-8')
sdl_dep = dependency('sdl2', method: 'config-tool')
reproc_dep = dependency('reproc', fallback: ['reproc', 'reproc_dep'],
default_options: [
'default_library=static', 'multithreaded=false',
'reproc-cpp=false', 'examples=false'
]
)
)
lite_deps = [lua_dep, sdl_dep, reproc_dep, pcre2_dep, libm, libdl]
lite_deps = [lua_dep, sdl_dep, reproc_dep, pcre2_dep, libm, libdl]
if host_machine.system() == 'windows'
if host_machine.system() == 'windows'
# Note that we need to explicitly add the windows socket DLL because
# the pkg-config file from reproc does not include it.
lite_deps += meson.get_compiler('cpp').find_library('ws2_32', required: true)
endif
endif
#===============================================================================
# Install Configuration
@ -118,6 +120,8 @@ configure_file(
#===============================================================================
# Targets
#===============================================================================
subdir('lib/font_renderer')
subdir('src')
subdir('scripts')
if not get_option('source-only')
subdir('lib/font_renderer')
subdir('src')
subdir('scripts')
endif

View File

@ -1,3 +1,4 @@
option('bundle', type : 'boolean', value : false, description: 'Build a macOS bundle')
option('source-only', type : 'boolean', value : false, description: 'Configure source files only, doesn\'t checks for dependencies')
option('portable', type : 'boolean', value : false, description: 'Portable install')
option('renderer', type : 'boolean', value : false, description: 'Use SDL renderer')

28
scripts/README.md Normal file
View File

@ -0,0 +1,28 @@
# Scripts
Various scripts and configurations used to configure, build, and package Lite XL.
### Build
- **build.sh**
- **build-packages.sh**: In root directory, as all in one script; relies to the
ones in this directory.
### Package
- **appdmg.sh**: Create a macOS DMG image using [AppDMG][1].
- **appimage.sh**: [AppImage][2] builder.
- **innosetup.sh**: Creates a 32/64 bit [InnoSetup][3] installer package.
- **package.sh**: Creates all binary / DMG image / installer / source packages.
### Utility
- **common.sh**: Common functions used by other scripts.
- **install-dependencies.sh**: Installs required applications to build, package
and run Lite XL, mainly useful for CI and documentation purpose.
Preferably not to be used in user systems.
- **fontello-config.json**: Used by the icons generator.
[1]: https://github.com/LinusU/node-appdmg
[2]: https://docs.appimage.org/
[3]: https://jrsoftware.org/isinfo.php

View File

@ -6,9 +6,11 @@ if [ ! -e "src/api/api.h" ]; then
exit 1
fi
source scripts/common.sh
show_help(){
echo
echo $0
echo "Usage: $0 <OPTIONS>"
echo
echo "Available options:"
echo
@ -23,7 +25,7 @@ show_help(){
}
ARCH="$(uname -m)"
BUILD_DIR=build
BUILD_DIR="$(get_default_build_dir)"
RUN_BUILD=true
STATIC_BUILD=false
@ -67,7 +69,7 @@ if [[ -n $1 ]]; then
exit 1
fi
setup_appimagetool(){
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
@ -80,7 +82,7 @@ setup_appimagetool(){
fi
}
download_appimage_apprun(){
download_appimage_apprun() {
if [ ! -e AppRun ]; then
if ! wget -O AppRun "https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-${ARCH}" ; then
echo "Could not download AppRun for the arch '${ARCH}'."
@ -91,7 +93,7 @@ download_appimage_apprun(){
fi
}
build_litexl(){
build_litexl() {
if [ -e build ]; then
rm -rf build
fi
@ -106,7 +108,7 @@ build_litexl(){
meson compile -C ${BUILD_DIR}
}
generate_appimage(){
generate_appimage() {
if [ -e LiteXL.AppDir ]; then
rm -rf LiteXL.AppDir
fi

View File

@ -1,103 +1,102 @@
#!/bin/bash
set -ex
set -e
if [ ! -e "src/api/api.h" ]; then
echo "Please run this script from the root directory of Lite XL."
exit 1
echo "Please run this script from the root directory of Lite XL."; exit 1
fi
show_help(){
source scripts/common.sh
show_help() {
echo
echo "Usage: $0 <OPTIONS>"
echo
echo "Available options:"
echo
echo "-b --builddir DIRNAME Sets the name of the build directory (not path)."
echo " Default: 'build'."
echo "-p --prefix Install directory prefix. Mandatory."
echo "-s --static Specify if building using static libraries"
echo " by using lhelper tool."
echo " Default: '$(get_default_build_dir)'."
echo " --debug Debug this script."
echo "-f --forcefallback Force to build dependencies statically."
echo "-h --help Show this help and exit."
echo "-p --prefix PREFIX Install directory prefix. Default: '/'."
echo "-B --bundle Create an App bundle (macOS only)"
echo "-P --portable Create a portable binary package."
echo " macOS: disabled when used with --bundle,"
echo " Windows: Implicit being the only option."
echo
}
install_lhelper() {
if [[ ! -d lhelper ]]; then
git clone https://github.com/franko/lhelper.git
pushd lhelper; bash install-github; popd
main() {
local platform="$(get_platform_name)"
local build_dir="$(get_default_build_dir)"
local prefix=/
local force_fallback
local bundle
local portable
if [[ "$OSTYPE" == "darwin"* ]]; then
CC=clang CXX=clang++ lhelper create lite-xl -n
else
lhelper create lite-xl -n
fi
fi
# Not using `lhelper activate lite-xl`
source "$(lhelper env-source lite-xl)"
lhelper install freetype2
lhelper install sdl2 2.0.14-wait-event-timeout-1
lhelper install pcre2
# Help MSYS2 to find the SDL2 include and lib directories to avoid errors
# during build and linking when using lhelper.
if [[ "$OSTYPE" == "msys" ]]; then
CFLAGS=-I${LHELPER_ENV_PREFIX}/include/SDL2
LDFLAGS=-L${LHELPER_ENV_PREFIX}/lib
fi
}
build() {
CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS meson setup \
--buildtype=release \
--prefix "$PREFIX" \
--wrap-mode=forcefallback \
"${BUILD_DIR}"
meson compile -C build
}
BUILD_DIR=build
STATIC_BUILD=false
for i in "$@"; do
for i in "$@"; do
case $i in
-h|--belp)
-h|--help)
show_help
exit 0
;;
-b|--builddir)
BUILD_DIR="$2"
build_dir="$2"
shift
shift
;;
--debug)
set -x
shift
;;
-f|--forcefallback)
force_fallback="--wrap-mode=forcefallback"
shift
;;
-p|--prefix)
PREFIX="$2"
prefix="$2"
shift
shift
;;
-s|--static)
STATIC_BUILD=true
-B|--bundle)
if [[ "$platform" != "macos" ]]; then
echo "Warning: ignoring --bundle option, works only under macOS."
else
bundle="-Dbundle=true"
fi
shift
;;
-P|--portable)
portable="-Dportable=true"
shift
;;
*)
# unknown option
;;
esac
done
done
if [[ -n $1 ]]; then
if [[ -n $1 ]]; then
show_help
exit 1
fi
fi
if [[ -z $PREFIX ]]; then
echo "ERROR: prefix argument is missing."
exit 1
fi
if [[ $platform == "macos" && -n $bundle && -n $portable ]]; then
echo "Warning: \"bundle\" and \"portable\" specified; excluding portable package."
portable=""
fi
if [[ $STATIC_BUILD == true ]]; then
install_lhelper
fi
rm -rf "${build_dir}"
build
CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS meson setup \
--buildtype=release \
--prefix "$prefix" \
$force_fallback \
$bundle \
$portable \
"${build_dir}"
meson compile -C "${build_dir}"
}
main "$@"

25
scripts/common.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
set -e
get_platform_name() {
if [[ "$OSTYPE" == "msys" ]]; then
echo "windows"
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "macos"
elif [[ "$OSTYPE" == "linux"* || "$OSTYPE" == "freebsd"* ]]; then
echo "linux"
else
echo "UNSUPPORTED-OS"
fi
}
get_default_build_dir() {
platform=$(get_platform_name)
echo "build-$platform-$(uname -m)"
}
if [[ $(get_platform_name) == "UNSUPPORTED-OS" ]]; then
echo "Error: unknown OS type: \"$OSTYPE\""
exit 1
fi

View File

@ -9,7 +9,7 @@
; Use /dArch option to create a setup for a different architecture, e.g.:
; iscc /dArch=x86 innosetup.iss
#ifndef Arch
#define Arch "x64"
#define Arch "x64"
#endif
[Setup]
@ -27,8 +27,11 @@ AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
#if Arch=="x64"
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode={#Arch}
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
#define ArchInternal "x86_64"
#else
#define ArchInternal "i686"
#endif
AllowNoIcons=yes
@ -48,7 +51,7 @@ PrivilegesRequiredOverridesAllowed=dialog
UsedUserAreasWarning=no
OutputDir=.
OutputBaseFilename=LiteXL-{#MyAppVersion}-{#Arch}-setup
OutputBaseFilename=LiteXL-{#MyAppVersion}-{#ArchInternal}-setup
;DisableDirPage=yes
;DisableProgramGroupPage=yes
@ -67,18 +70,16 @@ Name: "portablemode"; Description: "Portable Mode"; Flags: unchecked
[Files]
Source: "{#BuildDir}/src/lite-xl.exe"; DestDir: "{app}"; Flags: ignoreversion
; MSYS2 produces no external dlls on 32 bit builds when using lhelper
#if Arch=="x64"
Source: "{#BuildDir}/mingwLibs{#Arch}/*"; DestDir: "{app}"; Flags: ignoreversion
#endif
Source: "{#BuildDir}/mingwLibs{#Arch}/*"; DestDir: "{app}"; Flags: ignoreversion ; Check: DirExists(ExpandConstant('{#BuildDir}/mingwLibs{#Arch}'))
Source: "{#SourceDir}/data/*"; DestDir: "{app}/data"; Flags: ignoreversion recursesubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Check: not WizardIsTaskSelected('portablemode')
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; Check: not WizardIsTaskSelected('portablemode')
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon; Check: not WizardIsTaskSelected('portablemode')
; Name: "{usersendto}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
[Run]
Filename: "{app}/{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

View File

@ -1,55 +1,65 @@
#!/bin/bash
set -ex
set -e
if [ ! -e "src/api/api.h" ]; then
echo "Please run this script from the root directory of Lite XL."
exit 1
echo "Please run this script from the root directory of Lite XL."; exit 1
fi
show_help(){
source scripts/common.sh
show_help() {
echo
echo "Usage: $0 <OPTIONS>"
echo
echo "Available options:"
echo
echo "-b --builddir DIRNAME Sets the name of the build directory (not path)."
echo " Default: 'build'."
echo " Default: '$(get_default_build_dir)'."
echo " --debug Debug this script."
echo
}
BUILD_DIR=build
main() {
local build_dir=$(get_default_build_dir)
local arch
for i in "$@"; do
if [[ $MSYSTEM == "MINGW64" ]]; then arch=x64; else arch=Win32; fi
for i in "$@"; do
case $i in
-h|--belp)
-h|--help)
show_help
exit 0
;;
-b|--BUILD_DIR)
BUILD_DIR="$2"
-b|--builddir)
build_dir="$2"
shift
shift
;;
--debug)
set -x
shift
;;
*)
# unknown option
;;
esac
done
done
if [[ -n $1 ]]; then
if [[ -n $1 ]]; then
show_help
exit 1
fi
fi
# TODO: Required MinGW dlls are built only (?) when using lhelper on 64 bit
if [[ $MSYSTEM == "MINGW64" ]]; then
ARCH=x64;
mingwLibsDir=$BUILD_DIR/mingwLibs$ARCH
# 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"
ldd "$BUILD_DIR/src/lite-xl.exe" | grep mingw | awk '{print $3}' | xargs -I '{}' cp -v '{}' $mingwLibsDir
else
ARCH=Win32
fi
ntldd -R "${build_dir}/src/lite-xl.exe" | grep mingw | awk '{print $3}' | sed 's#\\#/#g' | xargs -I '{}' cp -v '{}' $mingwLibsDir
/c/Program\ Files\ \(x86\)/Inno\ Setup\ 6/ISCC.exe -dARCH=$ARCH $BUILD_DIR/scripts/innosetup.iss
mv $BUILD_DIR/LiteXL*.exe $(pwd)
"/c/Program Files (x86)/Inno Setup 6/ISCC.exe" -dARCH=$arch "${build_dir}/scripts/innosetup.iss"
pushd "${build_dir}/scripts"; mv LiteXL*.exe "./../../"; popd
}
main "$@"

View File

@ -0,0 +1,74 @@
#!/bin/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
show_help() {
echo
echo "Lite XL dependecies installer. Mainly used for CI but can also work on users systems."
echo "USE IT AT YOUR OWN RISK!"
echo
echo "Usage: $0 <OPTIONS>"
echo
echo "Available options:"
echo
echo "-l --lhelper Install tools required by LHelper and doesn't"
echo " install external libraries."
echo " --debug Debug this script."
echo
}
main() {
local lhelper=false
for i in "$@"; do
case $i in
-s|--lhelper)
lhelper=true
shift
;;
--debug)
set -x
shift
;;
*)
# unknown option
;;
esac
done
if [[ -n $1 ]]; then
show_help
exit 1
fi
if [[ "$OSTYPE" == "linux"* ]]; then
if [[ $lhelper == true ]]; then
sudo apt-get install -qq ninja-build
else
sudo apt-get install -qq ninja-build libsdl2-dev libfreetype6
fi
pip3 install meson
elif [[ "$OSTYPE" == "darwin"* ]]; then
if [[ $lhelper == true ]]; then
brew install bash md5sha1sum ninja
else
brew install ninja sdl2
fi
pip3 install meson
cd ~; npm install appdmg; cd -
~/node_modules/appdmg/bin/appdmg.js --version
elif [[ "$OSTYPE" == "msys" ]]; then
if [[ $lhelper == true ]]; then
pacman --noconfirm -S \
${MINGW_PACKAGE_PREFIX}-{gcc,meson,ninja,ntldd,pkg-config} unzip
else
pacman --noconfirm -S \
${MINGW_PACKAGE_PREFIX}-{gcc,meson,ninja,ntldd,pkg-config,freetype,pcre2,SDL2} unzip
fi
fi
}
main "$@"

75
scripts/lhelper.sh Normal file
View File

@ -0,0 +1,75 @@
#!/bin/bash
set -e
show_help() {
echo
echo "Usage: $0 <OPTIONS>"
echo
echo "Available options:"
echo
echo " --debug Debug this script."
echo "-h --help Show this help and exit."
echo "-p --prefix PREFIX Install directory prefix."
echo " Default: '$HOME/.local'."
echo
}
main() {
local lhelper_prefix="$HOME/.local"
for i in "$@"; do
case $i in
-h|--help)
show_help
exit 0
;;
-p|--prefix)
lhelper_prefix="$2"
echo "LHelper prefix set to: \"${lhelper_prefix}\""
shift
shift
;;
--debug)
set -x
shift
;;
*)
# unknown option
;;
esac
done
if [[ -n $1 ]]; then show_help; exit 1; fi
if [[ ! -f ${lhelper_prefix}/bin/lhelper ]]; then
git clone https://github.com/franko/lhelper.git
# FIXME: This should be set in ~/.bash_profile if not using CI
# export PATH="${HOME}/.local/bin:${PATH}"
mkdir -p "${lhelper_prefix}/bin"
pushd lhelper; bash install "${lhelper_prefix}"; popd
if [[ "$OSTYPE" == "darwin"* ]]; then
CC=clang CXX=clang++ lhelper create lite-xl -n
else
lhelper create lite-xl -n
fi
fi
# Not using $(lhelper activate lite-xl) to support CI
source "$(lhelper env-source lite-xl)"
lhelper install freetype2
lhelper install sdl2 2.0.14-wait-event-timeout-1
lhelper install pcre2
# Help MSYS2 to find the SDL2 include and lib directories to avoid errors
# during build and linking when using lhelper.
if [[ "$OSTYPE" == "msys" ]]; then
CFLAGS=-I${LHELPER_ENV_PREFIX}/include/SDL2
LDFLAGS=-L${LHELPER_ENV_PREFIX}/lib
fi
}
main

View File

@ -1,56 +0,0 @@
#!/bin/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
# FIXME: For some strange reason sometimes an error occurs randomly on the
# MINGW32 build of GitHub Actions; the environment variable $INSTALL_NAME
# is correct, but it expands with a drive letter at the end (all builds).
show_help(){
echo
echo "Usage: $0 <OPTIONS>"
echo
echo "Available options:"
echo
echo "-b --builddir DIRNAME Sets the name of the build directory (not path)."
echo " Default: 'build'."
echo "-d --destdir DIRNAME Sets the name of the install directory (not path)."
echo
}
BUILD_DIR=build
for i in "$@"; do
case $i in
-h|--belp)
show_help
exit 0
;;
-b|--builddir)
BUILD_DIR="$2"
shift
shift
;;
-d|--destdir)
DEST_DIR="$2"
shift
shift
;;
*)
# unknown option
;;
esac
done
if [[ -n $1 ]]; then
show_help
exit 1
fi
DESTDIR="$(pwd)/${DEST_DIR}" meson install --skip-subprojects -C ${BUILD_DIR}
zip -9rv ${DEST_DIR}.zip ${DEST_DIR}/*

252
scripts/package.sh Normal file
View File

@ -0,0 +1,252 @@
#!/bin/bash
set -e
if [ ! -e "src/api/api.h" ]; then
echo "Please run this script from the root directory of Lite XL."; exit 1
fi
source scripts/common.sh
show_help() {
echo
echo "Usage: $0 <OPTIONS>"
echo
echo "Available options:"
echo
echo "-b --builddir DIRNAME Sets the name of the build directory (not path)."
echo " Default: '$(get_default_build_dir)'."
echo "-d --destdir DIRNAME Set the name of the package directory (not path)."
echo " Default: 'lite-xl'."
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 RXI colors)."
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 "-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/rxi/lite-colors/archive/master.zip" \
-o "${build_dir}/rxi-lite-colors.zip"
mkdir -p "${build_dir}/third/data/colors"
unzip "${build_dir}/rxi-lite-colors.zip" -d "${build_dir}"
mv "${build_dir}/lite-colors-master/colors" "${build_dir}/third/data"
rm -rf "${build_dir}/lite-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
rm -rf ${build_dir}
rm -rf ${package_name}
rm -f ${package_name}.tar.gz
meson subprojects download
meson setup ${build_dir} -Dsource-only=true
# Note: not using git-archive(-all) because it can't include subprojects ignored by git
rsync -arv \
--exclude /*build*/ \
--exclude *.git* \
--exclude lhelper \
--exclude lite-xl* \
--exclude submodules \
. ${package_name}
cp "${build_dir}/start.lua" "${package_name}/data/core"
tar rf ${package_name}.tar ${package_name}
gzip -9 ${package_name}.tar
}
main() {
local arch="$(uname -m)"
local platform="$(get_platform_name)"
local build_dir="$(get_default_build_dir)"
local dest_dir=lite-xl
local prefix=/
local version
local addons=false
local appimage=false
local binary=false
local dmg=false
local innosetup=false
local source=false
for i in "$@"; do
case $i in
-b|--builddir)
build_dir="$2"
shift
shift
;;
-d|--destdir)
dest_dir="$2"
shift
shift
;;
-h|--help)
show_help
exit 0
;;
-p|--prefix)
prefix="$2"
shift
shift
;;
-v|--version)
if [[ -n $2 ]]; then version="-$2"; fi
shift
shift
;;
-A|--appimage)
if [[ "$platform" != "linux" ]]; then
echo "Warning: ignoring --appimage option, works only under Linux."
else
appimage=true
fi
shift
;;
-B|--binary)
binary=true
shift
;;
-D|--dmg)
if [[ "$platform" != "macos" ]]; then
echo "Warning: ignoring --dmg option, works only under macOS."
else
dmg=true
fi
shift
;;
-I|--innosetup)
if [[ "$platform" != "windows" ]]; then
echo "Warning: ignoring --innosetup option, works only under Windows."
else
innosetup=true
fi
shift
;;
-S|--source)
source=true
shift
;;
--addons)
addons=true
shift
;;
--debug)
set -x
shift
;;
*)
# unknown option
;;
esac
done
if [[ -n $1 ]]; then show_help; exit 1; fi
# The source package doesn't require a previous build,
# nor the following install step, so run it now.
if [[ $source == true ]]; then source_package "lite-xl$version-src"; fi
# No packages request
if [[ $appimage == false && $binary == false && $dmg == false && $innosetup == false ]]; then
# Source only, return.
if [[ $source == true ]]; then return 0; fi
# Build the binary package as default instead doing nothing.
binary=true
fi
rm -rf "${dest_dir}"
DESTDIR="$(pwd)/${dest_dir}" meson install -C "${build_dir}"
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 stripcmd="strip"
if [[ -d "${data_dir}" ]]; then
# Portable archive
exe_file="$(pwd)/${dest_dir}/lite-xl"
if [[ $platform == "windows" ]]; then
exe_file="${exe_file}.exe"
stripcmd="strip --strip-all"
else
# Windows archive is always portable
package_name+="-portable"
fi
elif [[ $platform == "macos" && ! -d "${data_dir}" ]]; then
# macOS bundle app
bundle=true
# Specify "bundle" on compressed archive only, implicit on images
if [[ $dmg == false ]]; then package_name+="-bundle"; fi
rm -rf "Lite XL.app"; mv "${dest_dir}" "Lite XL.app"
dest_dir="Lite XL.app"
data_dir="$(pwd)/${dest_dir}/Contents/Resources"
exe_file="$(pwd)/${dest_dir}/Contents/MacOS/lite-xl"
else
data_dir="$(pwd)/${dest_dir}/$prefix/share/lite-xl"
exe_file="$(pwd)/${dest_dir}/$prefix/bin/lite-xl"
fi
mkdir -p "${data_dir}"
if [[ $addons == true ]]; then install_addons "${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.
# Install Meson with PIP to get the latest version is not always possible.
pushd "${dest_dir}"
find . -type d -name 'include' -prune -exec rm -rf {} \;
find . -type d -name 'lib' -prune -exec rm -rf {} \;
find . -type d -empty -delete
popd
$stripcmd "${exe_file}"
if [[ $binary == true ]]; then
rm -f "${package_name}".tar.gz
rm -f "${package_name}".zip
if [[ $platform == "windows" ]]; then
zip -9rv ${package_name}.zip ${dest_dir}/*
else
tar czvf "${package_name}".tar.gz "${dest_dir}"
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
}
main "$@"

View File

@ -1,69 +0,0 @@
#!/bin/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
show_help(){
echo
echo "Usage: $0 <OPTIONS>"
echo
echo "Available options:"
echo
echo "-b --builddir DIRNAME Sets the name of the build directory (no path)."
echo " Default: 'build'."
echo "-d --destdir DIRNAME Sets the name of the install directory (no path)."
echo
}
BUILD_DIR=build
DEST_DIR=lite-xl-src
for i in "$@"; do
case $i in
-h|--belp)
show_help
exit 0
;;
-b|--builddir)
BUILD_DIR="$2"
shift
shift
;;
-d|--destdir)
DEST_DIR="$2"
shift
shift
;;
*)
# unknown option
;;
esac
done
if [[ -n $1 ]]; then
show_help
exit 1
fi
if test -d ${BUILD_DIR}; then rm -rf ${BUILD_DIR}; fi
if test -d ${DEST_DIR}; then rm -rf ${DEST_DIR}; fi
if test -f ${DEST_DIR}.tar.gz; then rm ${DEST_DIR}.tar.gz; fi
meson subprojects download
meson setup ${BUILD_DIR}
rsync -arv \
--exclude /*build*/ \
--exclude *.git* \
--exclude lhelper \
--exclude lite-xl* \
--exclude submodules \
. ${DEST_DIR}
cp "${BUILD_DIR}/start.lua" "${DEST_DIR}/data/core"
tar rf ${DEST_DIR}.tar ${DEST_DIR}
gzip -9 ${DEST_DIR}.tar