From 368bee2d64bc08488c6e382a3149b65030293d23 Mon Sep 17 00:00:00 2001 From: Bruno Lopes Date: Sat, 17 Feb 2024 15:03:38 -0300 Subject: [PATCH] build/windows: Rework scripts local compatibility layer Since !1171 we can use the CI scripts locally, but the initial implementation, after some commits, revealed to be troublesome. So, now reworked to be simple. --- build/windows/gitlab-ci/1_build-deps-msys2.sh | 29 +++++++------------ build/windows/gitlab-ci/2_build-gimp-msys2.sh | 14 +++------ .../gitlab-ci/3_package-gimp-uni_base.sh | 1 + 3 files changed, 15 insertions(+), 29 deletions(-) diff --git a/build/windows/gitlab-ci/1_build-deps-msys2.sh b/build/windows/gitlab-ci/1_build-deps-msys2.sh index 70e9e84459..3f74d43a55 100644 --- a/build/windows/gitlab-ci/1_build-deps-msys2.sh +++ b/build/windows/gitlab-ci/1_build-deps-msys2.sh @@ -12,27 +12,25 @@ else # [[ "$MSYSTEM_CARCH" == "i686" ]]; export ARTIFACTS_SUFFIX="-x86" fi -if [[ "$BUILD_TYPE" != "CI_NATIVE" ]]; then - # Make the script callable from every directory +if [[ "$BUILD_TYPE" == "CI_NATIVE" ]]; then + GIMP_DIR="" +else + # Make the script work locally if [[ "$0" != "build/windows/gitlab-ci/1_build-deps-msys2.sh" ]]; then - GIMP_EXTDIR="$0" - GIMP_EXTDIR=$(sed 's|build/windows/gitlab-ci/1_build-deps-msys2.sh||g' <<< $GIMP_EXTDIR) - GIMP_DIR="$GIMP_EXTDIR" + echo "To run this script locally, please do it from to the gimp git folder" + exit 1 else - GIMP_GITDIR="$(pwd)" - GIMP_GITDIR=$(sed 's|build/windows/gitlab-ci||g' <<< $GIMP_GITDIR) - GIMP_GITDIR=$(sed 's|build/windows||g' <<< $GIMP_GITDIR) - GIMP_GITDIR=$(sed 's|build||g' <<< $GIMP_GITDIR) - GIMP_DIR="$GIMP_GITDIR" + GIMP_DIR=$(echo "${PWD##*/}/") + DEPS_DIR=$(dirname $PWD) + cd $DEPS_DIR fi - cd $GIMP_DIR pacman --noconfirm -Suy fi # Install the required (pre-built) packages for babl and GEGL -DEPS_LIST=$(cat build/windows/gitlab-ci/all-deps-uni.txt) +DEPS_LIST=$(cat ${GIMP_DIR}build/windows/gitlab-ci/all-deps-uni.txt) DEPS_LIST=$(sed "s/\${MINGW_PACKAGE_PREFIX}-/${MINGW_PACKAGE_PREFIX}-/g" <<< $DEPS_LIST) DEPS_LIST=$(sed 's/\\//g' <<< $DEPS_LIST) @@ -108,10 +106,3 @@ configure_or_build babl "-Dwith-docs=false" configure_or_build gegl "-Ddocs=false \ -Dcairo=enabled -Dumfpack=enabled \ -Dopenexr=enabled -Dworkshop=true" - - -if [[ "$BUILD_TYPE" != "CI_NATIVE" ]]; then - mv _babl ~ - mv _gegl ~ - mv "${GIMP_PREFIX}" ~ -fi diff --git a/build/windows/gitlab-ci/2_build-gimp-msys2.sh b/build/windows/gitlab-ci/2_build-gimp-msys2.sh index 5a563b0a4f..78303aa9e8 100644 --- a/build/windows/gitlab-ci/2_build-gimp-msys2.sh +++ b/build/windows/gitlab-ci/2_build-gimp-msys2.sh @@ -22,17 +22,10 @@ if [[ "$BUILD_TYPE" == "CI_NATIVE" ]]; then rm -fr ~/_install${ARTIFACTS_SUFFIX} mv "_install${ARTIFACTS_SUFFIX}" ~ else - # Make the script callable from every directory + # Make the script work locally if [[ "$0" != "build/windows/gitlab-ci/2_build-gimp-msys2.sh" ]]; then - GIMP_EXTDIR="$0" - GIMP_EXTDIR=$(sed 's|build/windows/gitlab-ci/2_build-gimp-msys2.sh||g' <<< $GIMP_EXTDIR) - cd $GIMP_EXTDIR - else - GIMP_GITDIR="$(pwd)" - GIMP_GITDIR=$(sed 's|build/windows/gitlab-ci||g' <<< $GIMP_GITDIR) - GIMP_GITDIR=$(sed 's|build/windows||g' <<< $GIMP_GITDIR) - GIMP_GITDIR=$(sed 's|build||g' <<< $GIMP_GITDIR) - cd $GIMP_GITDIR + echo "To run this script locally, please do it from to the gimp git folder" + exit 1 fi pacman --noconfirm -Suy @@ -40,6 +33,7 @@ fi # Install the required (pre-built) packages for GIMP +GIMP_DIR="" DEPS_CODE=$(cat build/windows/gitlab-ci/1_build-deps-msys2.sh) DEPS_CODE=$(sed -n '/# Install the/,/# End of install/p' <<< $DEPS_CODE) echo "$DEPS_CODE" | bash diff --git a/build/windows/gitlab-ci/3_package-gimp-uni_base.sh b/build/windows/gitlab-ci/3_package-gimp-uni_base.sh index 5653d5d3a6..ac7dfdc5c6 100644 --- a/build/windows/gitlab-ci/3_package-gimp-uni_base.sh +++ b/build/windows/gitlab-ci/3_package-gimp-uni_base.sh @@ -25,6 +25,7 @@ fi if [[ "$BUILD_TYPE" != "CI_CROSS" ]]; then # Install the required (pre-built) packages again + GIMP_DIR="" DEPS_CODE=$(cat build/windows/gitlab-ci/1_build-deps-msys2.sh) DEPS_CODE=$(sed -n '/# Install the/,/# End of install/p' <<< $DEPS_CODE) echo "$DEPS_CODE" | bash