Adapt all scripts to work together with build-packages.sh
This commit is contained in:
committed by
Francesco Abbate
parent
91da2ddfdd
commit
261ab5daf2
@@ -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
|
||||
+8
-6
@@ -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
|
||||
|
||||
+78
-79
@@ -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
|
||||
for i in "$@"; do
|
||||
case $i in
|
||||
-h|--help)
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
-b|--builddir)
|
||||
build_dir="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--debug)
|
||||
set -x
|
||||
shift
|
||||
;;
|
||||
-f|--forcefallback)
|
||||
force_fallback="--wrap-mode=forcefallback"
|
||||
shift
|
||||
;;
|
||||
-p|--prefix)
|
||||
prefix="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-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
|
||||
|
||||
if [[ -n $1 ]]; then
|
||||
show_help
|
||||
exit 1
|
||||
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
|
||||
if [[ $platform == "macos" && -n $bundle && -n $portable ]]; then
|
||||
echo "Warning: \"bundle\" and \"portable\" specified; excluding portable package."
|
||||
portable=""
|
||||
fi
|
||||
}
|
||||
|
||||
build() {
|
||||
rm -rf "${build_dir}"
|
||||
|
||||
CFLAGS=$CFLAGS LDFLAGS=$LDFLAGS meson setup \
|
||||
--buildtype=release \
|
||||
--prefix "$PREFIX" \
|
||||
--wrap-mode=forcefallback \
|
||||
"${BUILD_DIR}"
|
||||
--prefix "$prefix" \
|
||||
$force_fallback \
|
||||
$bundle \
|
||||
$portable \
|
||||
"${build_dir}"
|
||||
|
||||
meson compile -C build
|
||||
meson compile -C "${build_dir}"
|
||||
}
|
||||
|
||||
BUILD_DIR=build
|
||||
STATIC_BUILD=false
|
||||
|
||||
for i in "$@"; do
|
||||
case $i in
|
||||
-h|--belp)
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
-b|--builddir)
|
||||
BUILD_DIR="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-p|--prefix)
|
||||
PREFIX="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-s|--static)
|
||||
STATIC_BUILD=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -n $1 ]]; then
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z $PREFIX ]]; then
|
||||
echo "ERROR: prefix argument is missing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $STATIC_BUILD == true ]]; then
|
||||
install_lhelper
|
||||
fi
|
||||
|
||||
build
|
||||
main "$@"
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
case $i in
|
||||
-h|--belp)
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
-b|--BUILD_DIR)
|
||||
BUILD_DIR="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [[ $MSYSTEM == "MINGW64" ]]; then arch=x64; else arch=Win32; fi
|
||||
|
||||
if [[ -n $1 ]]; then
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
for i in "$@"; do
|
||||
case $i in
|
||||
-h|--help)
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
-b|--builddir)
|
||||
build_dir="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--debug)
|
||||
set -x
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# TODO: Required MinGW dlls are built only (?) when using lhelper on 64 bit
|
||||
if [[ $MSYSTEM == "MINGW64" ]]; then
|
||||
ARCH=x64;
|
||||
mingwLibsDir=$BUILD_DIR/mingwLibs$ARCH
|
||||
if [[ -n $1 ]]; 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"
|
||||
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 "$@"
|
||||
|
||||
@@ -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 "$@"
|
||||
@@ -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
|
||||
@@ -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}/*
|
||||
@@ -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 "$@"
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user