Fix build-package script with the portable option

This commit is contained in:
Francesco Abbate 2020-12-04 14:20:11 +01:00
parent be189fda0d
commit 549ac806e9
1 changed files with 28 additions and 16 deletions

View File

@ -1,9 +1,16 @@
#!/bin/bash #!/bin/bash
# strip-components is normally set to 1 to strip the initial "data" from the
# directory path.
copy_directory_from_repo () { copy_directory_from_repo () {
local tar_options=()
if [[ $1 == --strip-components=* ]]; then
tar_options+=($1)
shift
fi
local dirname="$1" local dirname="$1"
local destdir="$2" local destdir="$2"
git --work-tree="$destdir" checkout HEAD -f -- "$dirname" git archive master "$dirname" --format=tar | tar xf - -C "$destdir" "${tar_options[@]}"
} }
# Check if build directory is ok to be used to build. # Check if build directory is ok to be used to build.
@ -61,7 +68,7 @@ lite_build_package_windows () {
mkdir -p "$bindir" mkdir -p "$bindir"
mkdir -p "$datadir" mkdir -p "$datadir"
for module_name in core plugins colors fonts; do for module_name in core plugins colors fonts; do
copy_directory_from_repo "data/$module_name" "$datadir" copy_directory_from_repo --strip-components=1 "data/$module_name" "$datadir"
done done
cp "$build/src/lite.exe" "$bindir" cp "$build/src/lite.exe" "$bindir"
strip --strip-all "$bindir/lite.exe" strip --strip-all "$bindir/lite.exe"
@ -91,7 +98,7 @@ lite_build_package_macosx () {
mkdir -p "$bindir" mkdir -p "$bindir"
mkdir -p "$datadir" mkdir -p "$datadir"
for module_name in core plugins colors fonts; do for module_name in core plugins colors fonts; do
copy_directory_from_repo "data/$module_name" "$datadir" copy_directory_from_repo --strip-components=1 "data/$module_name" "$datadir"
done done
cp "$build/src/lite" "$bindir" cp "$build/src/lite" "$bindir"
strip "$bindir/lite" strip "$bindir/lite"
@ -121,7 +128,7 @@ lite_build_package_linux () {
mkdir -p "$bindir" mkdir -p "$bindir"
mkdir -p "$datadir" mkdir -p "$datadir"
for module_name in core plugins colors fonts; do for module_name in core plugins colors fonts; do
copy_directory_from_repo "data/$module_name" "$datadir" copy_directory_from_repo --strip-components=1 "data/$module_name" "$datadir"
done done
cp "$build/src/lite" "$bindir" cp "$build/src/lite" "$bindir"
strip "$bindir/lite" strip "$bindir/lite"
@ -152,19 +159,24 @@ if [[ -z "$1" || -z "$2" ]]; then
exit 1 exit 1
fi fi
if [[ "$1" == "-pgo" ]]; then portable=false
while [ ! -z {$1+x} ]; do
case $1 in
-pgo)
pgo=true pgo=true
shift shift
fi ;;
-portable)
portable="false" portable=true
if [ "$1" == "-portable" ]; then
portable="true"
shift shift
fi ;;
*)
version="$1"
arch="$2"
break
esac
done
version="$1"
arch="$2"
build_dir=".build-$arch" build_dir=".build-$arch"
if [ -z ${pgo+set} ]; then if [ -z ${pgo+set} ]; then