From b484cb8bd325e5cb270c4f425cb89036a7cb6aec Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Sun, 5 Jul 2020 12:36:46 +0200 Subject: [PATCH] Ensure build-package script copy data directory from repository's head Rename also the directory of the package with the arch name. --- build-packages.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/build-packages.sh b/build-packages.sh index a450bd9d..a64a831e 100755 --- a/build-packages.sh +++ b/build-packages.sh @@ -1,5 +1,11 @@ #!/bin/bash +copy_directory_from_repo () { + local dirname="$1" + local destdir="$2" + git --work-tree="$destdir" checkout HEAD -f -- "$dirname" +} + # Check if build directory is ok to be used to build. build_dir_is_usable () { local build="$1" @@ -30,7 +36,7 @@ lite_build_pgo () { rm -fr "$build" meson setup --buildtype=release -Db_pgo=generate "$build" || exit 1 ninja -C "$build" || exit 1 - cp -r data "$build/src" + copy_directory_from_repo data "$build/src" "$build/src/lite" meson configure -Db_pgo=use "$build" ninja -C "$build" || exit 1 @@ -40,14 +46,14 @@ lite_build_package_windows () { build="$1" version="$2" arch="$3" - local pdir=".package-build/lite-xl-$version" + local pdir=".package-build/lite-xl-$version-$arch" mkdir -p "$pdir" - cp -r data "$pdir" + copy_directory_from_repo data "$pdir" cp "$build/src/lite.exe" "$pdir" strip --strip-all "$pdir/lite.exe" pushd ".package-build" local package_name="lite-xl-$version-$arch.zip" - zip "$package_name" -r "lite-xl-$version" + zip "$package_name" -r "lite-xl-$version-$arch" mv "$package_name" .. popd rm -fr ".package-build" @@ -60,7 +66,7 @@ lite_build_package_macosx () { arch="$3" local pdir=".package-build/lite-xl.app/Contents/MacOS" mkdir -p "$pdir" - cp -R data "$pdir" + copy_directory_from_repo data "$pdir" cp "$build/src/lite" "$pdir" strip "$pdir/lite" pushd ".package-build" @@ -76,14 +82,14 @@ lite_build_package_linux () { build="$1" version="$2" arch="$3" - local pdir=".package-build/lite-xl-$version" + local pdir=".package-build/lite-xl-$version-$arch" mkdir -p "$pdir" - cp -r data "$pdir" + copy_directory_from_repo data "$pdir" cp "$build/src/lite" "$pdir" strip "$pdir/lite" pushd ".package-build" local package_name="lite-xl-$version-$arch.tar.gz" - tar czf "$package_name" "lite-xl-$version" + tar czf "$package_name" "lite-xl-$version-$arch" mv "$package_name" .. popd rm -fr ".package-build"