2021-08-02 18:43:59 +02:00
|
|
|
#!/bin/bash
|
2021-08-29 10:15:55 +02:00
|
|
|
set -e
|
2021-08-02 18:43:59 +02:00
|
|
|
|
|
|
|
if [ ! -e "src/api/api.h" ]; then
|
2021-08-29 10:15:55 +02:00
|
|
|
echo "Please run this script from the root directory of Lite XL."; exit 1
|
2021-08-02 18:43:59 +02:00
|
|
|
fi
|
|
|
|
|
2021-08-29 10:15:55 +02:00
|
|
|
source scripts/common.sh
|
|
|
|
|
|
|
|
show_help() {
|
2021-08-02 18:43:59 +02:00
|
|
|
echo
|
|
|
|
echo "Usage: $0 <OPTIONS>"
|
|
|
|
echo
|
|
|
|
echo "Available options:"
|
|
|
|
echo
|
|
|
|
echo "-b --builddir DIRNAME Sets the name of the build directory (not path)."
|
2021-08-29 10:15:55 +02:00
|
|
|
echo " Default: '$(get_default_build_dir)'."
|
2022-09-25 22:59:01 +02:00
|
|
|
echo "-v --version VERSION Sets the version on the package name."
|
|
|
|
echo "-a --addons Tell the script we are packaging an install with addons."
|
2021-08-29 10:15:55 +02:00
|
|
|
echo " --debug Debug this script."
|
2021-08-02 18:43:59 +02:00
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
2021-08-29 10:15:55 +02:00
|
|
|
main() {
|
|
|
|
local build_dir=$(get_default_build_dir)
|
2022-09-25 22:59:01 +02:00
|
|
|
local addons=false
|
2021-08-29 10:15:55 +02:00
|
|
|
local arch
|
2022-09-25 22:59:01 +02:00
|
|
|
local arch_file
|
|
|
|
local version
|
|
|
|
local output
|
2021-08-29 10:15:55 +02:00
|
|
|
|
2024-03-07 01:21:46 +01:00
|
|
|
case "$MSYSTEM" in
|
|
|
|
MINGW64|UCRT64|CLANG64)
|
2022-09-25 22:59:01 +02:00
|
|
|
arch=x64
|
|
|
|
arch_file=x86_64
|
2024-03-07 01:21:46 +01:00
|
|
|
;;
|
|
|
|
MINGW32|CLANG32)
|
|
|
|
arch=x86
|
2022-09-25 22:59:01 +02:00
|
|
|
arch_file=i686
|
2024-03-07 01:21:46 +01:00
|
|
|
;;
|
|
|
|
CLANGARM64)
|
|
|
|
arch=arm64
|
|
|
|
arch_file=aarch64
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "error: unsupported MSYSTEM type: $MSYSTEM"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2022-09-25 22:59:01 +02:00
|
|
|
|
|
|
|
initial_arg_count=$#
|
2021-08-29 10:15:55 +02:00
|
|
|
|
|
|
|
for i in "$@"; do
|
|
|
|
case $i in
|
|
|
|
-h|--help)
|
|
|
|
show_help
|
|
|
|
exit 0
|
|
|
|
;;
|
2022-09-25 22:59:01 +02:00
|
|
|
-a|--addons)
|
|
|
|
addons=true
|
|
|
|
shift
|
|
|
|
;;
|
2021-08-29 10:15:55 +02:00
|
|
|
-b|--builddir)
|
|
|
|
build_dir="$2"
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
;;
|
2022-09-25 22:59:01 +02:00
|
|
|
-v|--version)
|
|
|
|
if [[ -n $2 ]]; then version="-$2"; fi
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
;;
|
2021-08-29 10:15:55 +02:00
|
|
|
--debug)
|
|
|
|
set -x
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# unknown option
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2021-08-02 18:43:59 +02:00
|
|
|
|
2022-09-25 22:59:01 +02:00
|
|
|
# show help if no valid argument was found
|
|
|
|
if [ $initial_arg_count -eq $# ]; then
|
2021-08-29 10:15:55 +02:00
|
|
|
show_help
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-09-25 22:59:01 +02:00
|
|
|
if [[ $addons == true ]]; then
|
|
|
|
version="${version}-addons"
|
|
|
|
fi
|
|
|
|
|
|
|
|
output="LiteXL${version}-${arch_file}-setup"
|
2021-08-29 10:15:55 +02:00
|
|
|
|
2022-09-25 22:59:01 +02:00
|
|
|
"/c/Program Files (x86)/Inno Setup 6/ISCC.exe" -dARCH=$arch //F"${output}" "${build_dir}/scripts/innosetup.iss"
|
2021-08-29 10:15:55 +02:00
|
|
|
pushd "${build_dir}/scripts"; mv LiteXL*.exe "./../../"; popd
|
|
|
|
}
|
2021-08-02 18:43:59 +02:00
|
|
|
|
2021-08-29 10:15:55 +02:00
|
|
|
main "$@"
|