Improve build-package script to create portable and unix-like packages
This commit is contained in:
parent
351a772466
commit
ff5052be9a
27
README.md
27
README.md
|
@ -58,16 +58,17 @@ sudo apt install meson
|
||||||
# or pip3 install --user meson
|
# or pip3 install --user meson
|
||||||
```
|
```
|
||||||
|
|
||||||
To build Lite XL with Meson use the commands:
|
To build Lite XL with Meson the commands below can be used:
|
||||||
```sh
|
```sh
|
||||||
meson setup build
|
meson setup build
|
||||||
meson compile -C build
|
meson compile -C build
|
||||||
meson install -C build
|
meson install -C build
|
||||||
```
|
```
|
||||||
|
|
||||||
When performing the "meson setup" command you may enable the "portable" option.
|
When performing the "meson setup" command you may enable the "portable" option to choose the
|
||||||
|
kind of install.
|
||||||
|
|
||||||
If this latter is enabled Lite XL is built to use a "data" and a "user" directory
|
If the portable option latter is enabled Lite XL is built to use a "data" and a "user" directory
|
||||||
from the same directory of the executable.
|
from the same directory of the executable.
|
||||||
If "portable" is not enabled (this is the default) Lite XL will use unix-like
|
If "portable" is not enabled (this is the default) Lite XL will use unix-like
|
||||||
directory locations.
|
directory locations.
|
||||||
|
@ -78,19 +79,23 @@ the location of the executable.
|
||||||
The `$HOME` is determined from the corresponding environment variable.
|
The `$HOME` is determined from the corresponding environment variable.
|
||||||
As a special case on Windows the variable `$USERPROFILE` will be used instead.
|
As a special case on Windows the variable `$USERPROFILE` will be used instead.
|
||||||
|
|
||||||
If you want to install Lite XL on Windows or Mac OS X we suggest to use the script `build-packages.sh`:
|
If you compile lite-xl yourself it is recommended to use the script `build-packages.sh`:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
bash build-packages.sh <version> <arch>
|
bash build-packages.sh <arch>
|
||||||
|
|
||||||
# In alternative the -portable option can be used like below:
|
|
||||||
# bash build-packages.sh -portable <version> <arch>
|
|
||||||
```
|
```
|
||||||
|
|
||||||
It will run meson and create a Zip file that can be easily installed or uninstalled.
|
It will run meson and create two zip files, one for the portable version and
|
||||||
|
one for the unix-like version. Lite XL can be easily installed by unpacking one
|
||||||
|
of the zip archive in a directory of your choice.
|
||||||
|
|
||||||
Please note the, while compiling Lite XL on Mac OS X should work Mac OS X
|
Please note that no directory is not hard-coded in the exectuable so that the
|
||||||
is not currently supported.
|
package can be extracted and used in any directory.
|
||||||
|
|
||||||
|
Note also that the unix-like package can work on windows as well.
|
||||||
|
|
||||||
|
Please note that while compiling Lite XL on Mac OS X should work Mac OS X is not
|
||||||
|
officially supported.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
Any additional functionality that can be added through a plugin should be done
|
Any additional functionality that can be added through a plugin should be done
|
||||||
|
|
|
@ -29,21 +29,19 @@ build_dir_is_usable () {
|
||||||
|
|
||||||
# Ordinary release build
|
# Ordinary release build
|
||||||
lite_build () {
|
lite_build () {
|
||||||
local meson_options=("-Dportable=$1")
|
local build="$1"
|
||||||
local build="$2"
|
|
||||||
build_dir_is_usable "$build" || exit 1
|
build_dir_is_usable "$build" || exit 1
|
||||||
rm -fr "$build"
|
rm -fr "$build"
|
||||||
meson setup --buildtype=release "${meson_options[@]}" "$build" || exit 1
|
meson setup --buildtype=release "$build" || exit 1
|
||||||
ninja -C "$build" || exit 1
|
ninja -C "$build" || exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build using Profile Guided Optimizations (PGO)
|
# Build using Profile Guided Optimizations (PGO)
|
||||||
lite_build_pgo () {
|
lite_build_pgo () {
|
||||||
local meson_options=("-Dportable=$1")
|
local build="$1"
|
||||||
local build="$2"
|
|
||||||
build_dir_is_usable "$build" || exit 1
|
build_dir_is_usable "$build" || exit 1
|
||||||
rm -fr "$build"
|
rm -fr "$build"
|
||||||
meson setup --buildtype=release "${meson_options[@]}" -Db_pgo=generate "$build" || exit 1
|
meson setup --buildtype=release -Db_pgo=generate "$build" || exit 1
|
||||||
ninja -C "$build" || exit 1
|
ninja -C "$build" || exit 1
|
||||||
copy_directory_from_repo data "$build/src"
|
copy_directory_from_repo data "$build/src"
|
||||||
"$build/src/lite"
|
"$build/src/lite"
|
||||||
|
@ -52,17 +50,19 @@ lite_build_pgo () {
|
||||||
}
|
}
|
||||||
|
|
||||||
lite_build_package_windows () {
|
lite_build_package_windows () {
|
||||||
local portable="$1"
|
local portable=""
|
||||||
local build="$2"
|
if [ "$1" == "-portable" ]; then
|
||||||
local version="$3"
|
portable="-portable"
|
||||||
local arch="$4"
|
shift
|
||||||
|
fi
|
||||||
|
local build="$1"
|
||||||
|
local arch="$2"
|
||||||
local os="win"
|
local os="win"
|
||||||
local pdir=".package-build/lite-xl"
|
local pdir=".package-build/lite-xl"
|
||||||
if [ $portable == "true" ]; then
|
if [ "$portable" == "-portable" ]; then
|
||||||
local bindir="$pdir"
|
local bindir="$pdir"
|
||||||
local datadir="$pdir/data"
|
local datadir="$pdir/data"
|
||||||
else
|
else
|
||||||
echo "WARNING: using non portable option on unix-like system"
|
|
||||||
local bindir="$pdir/bin"
|
local bindir="$pdir/bin"
|
||||||
local datadir="$pdir/share/lite-xl"
|
local datadir="$pdir/share/lite-xl"
|
||||||
fi
|
fi
|
||||||
|
@ -77,7 +77,7 @@ lite_build_package_windows () {
|
||||||
cp "$build/src/lite.exe" "$bindir"
|
cp "$build/src/lite.exe" "$bindir"
|
||||||
strip --strip-all "$bindir/lite.exe"
|
strip --strip-all "$bindir/lite.exe"
|
||||||
pushd ".package-build"
|
pushd ".package-build"
|
||||||
local package_name="lite-xl-$os-$arch.zip"
|
local package_name="lite-xl-$os-$arch$portable.zip"
|
||||||
zip "$package_name" -r "lite-xl"
|
zip "$package_name" -r "lite-xl"
|
||||||
mv "$package_name" ..
|
mv "$package_name" ..
|
||||||
popd
|
popd
|
||||||
|
@ -86,10 +86,13 @@ lite_build_package_windows () {
|
||||||
}
|
}
|
||||||
|
|
||||||
lite_build_package_macosx () {
|
lite_build_package_macosx () {
|
||||||
local portable="$1"
|
local portable=""
|
||||||
local build="$2"
|
if [ "$1" == "-portable" ]; then
|
||||||
local version="$3"
|
portable="-portable"
|
||||||
local arch="$4"
|
shift
|
||||||
|
fi
|
||||||
|
local build="$1"
|
||||||
|
local arch="$2"
|
||||||
local os="macosx"
|
local os="macosx"
|
||||||
local pdir=".package-build/lite-xl.app/Contents/MacOS"
|
local pdir=".package-build/lite-xl.app/Contents/MacOS"
|
||||||
if [ $portable == "true" ]; then
|
if [ $portable == "true" ]; then
|
||||||
|
@ -110,7 +113,7 @@ lite_build_package_macosx () {
|
||||||
cp "$build/src/lite" "$bindir"
|
cp "$build/src/lite" "$bindir"
|
||||||
strip "$bindir/lite"
|
strip "$bindir/lite"
|
||||||
pushd ".package-build"
|
pushd ".package-build"
|
||||||
local package_name="lite-xl-$os-$arch.zip"
|
local package_name="lite-xl-$os-$arch$portable.zip"
|
||||||
zip "$package_name" -r "lite-xl.app"
|
zip "$package_name" -r "lite-xl.app"
|
||||||
mv "$package_name" ..
|
mv "$package_name" ..
|
||||||
popd
|
popd
|
||||||
|
@ -119,10 +122,13 @@ lite_build_package_macosx () {
|
||||||
}
|
}
|
||||||
|
|
||||||
lite_build_package_linux () {
|
lite_build_package_linux () {
|
||||||
local portable="$1"
|
local portable=""
|
||||||
local build="$2"
|
if [ "$1" == "-portable" ]; then
|
||||||
local version="$3"
|
portable="-portable"
|
||||||
local arch="$4"
|
shift
|
||||||
|
fi
|
||||||
|
local build="$1"
|
||||||
|
local arch="$2"
|
||||||
local os="linux"
|
local os="linux"
|
||||||
local pdir=".package-build/lite-xl"
|
local pdir=".package-build/lite-xl"
|
||||||
if [ $portable == "true" ]; then
|
if [ $portable == "true" ]; then
|
||||||
|
@ -144,7 +150,7 @@ lite_build_package_linux () {
|
||||||
cp "$build/src/lite" "$bindir"
|
cp "$build/src/lite" "$bindir"
|
||||||
strip "$bindir/lite"
|
strip "$bindir/lite"
|
||||||
pushd ".package-build"
|
pushd ".package-build"
|
||||||
local package_name="lite-xl-$os-$arch.tar.gz"
|
local package_name="lite-xl-$os-$arch$portable.tar.gz"
|
||||||
tar czf "$package_name" "lite-xl"
|
tar czf "$package_name" "lite-xl"
|
||||||
mv "$package_name" ..
|
mv "$package_name" ..
|
||||||
popd
|
popd
|
||||||
|
@ -174,33 +180,28 @@ lite_copy_third_party_modules () {
|
||||||
rm -fr "$build/lite-colors-master"
|
rm -fr "$build/lite-colors-master"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ -z "$1" || -z "$2" ]]; then
|
unset arch
|
||||||
echo "usage: $0 [options] <version> <arch>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
portable=false
|
|
||||||
while [ ! -z {$1+x} ]; do
|
while [ ! -z {$1+x} ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
-pgo)
|
-pgo)
|
||||||
pgo=true
|
pgo=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-portable)
|
|
||||||
portable=true
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
-branch=*)
|
-branch=*)
|
||||||
use_branch="${1#-branch=}"
|
use_branch="${1#-branch=}"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
version="$1"
|
arch="$1"
|
||||||
arch="$2"
|
|
||||||
break
|
break
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ -z ${arch+set} ]; then
|
||||||
|
echo "usage: $0 [options] <arch>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z ${use_branch+set} ]; then
|
if [ -z ${use_branch+set} ]; then
|
||||||
use_branch="$(git rev-parse --abbrev-ref HEAD)"
|
use_branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||||
fi
|
fi
|
||||||
|
@ -208,10 +209,11 @@ fi
|
||||||
build_dir=".build-$arch"
|
build_dir=".build-$arch"
|
||||||
|
|
||||||
if [ -z ${pgo+set} ]; then
|
if [ -z ${pgo+set} ]; then
|
||||||
lite_build "$portable" "$build_dir"
|
lite_build "$build_dir"
|
||||||
else
|
else
|
||||||
lite_build_pgo "$portable" "$build_dir"
|
lite_build_pgo "$build_dir"
|
||||||
fi
|
fi
|
||||||
lite_copy_third_party_modules "$build_dir"
|
lite_copy_third_party_modules "$build_dir"
|
||||||
lite_build_package "$portable" "$build_dir" "$version" "$arch"
|
lite_build_package "$build_dir" "$arch"
|
||||||
|
lite_build_package -portable "$build_dir" "$arch"
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
option('portable', type : 'boolean', value : false, description: 'Create a portable build')
|
option('portable', type : 'boolean', value : false, description: 'Portable install')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue