Adapt all scripts to work together with build-packages.sh
This commit is contained in:
+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 "$@"
|
||||
|
||||
Reference in New Issue
Block a user