From e89bca35c7cdf4fb88c7dff325f363fe4edecbc0 Mon Sep 17 00:00:00 2001 From: Bruno Lopes Date: Mon, 4 Mar 2024 14:47:14 -0300 Subject: [PATCH] gitlab-ci, build: Move to Clang in Windows (native) This makes possible to use the Universal C library provided by Microsoft. --- .gitlab-ci.yml | 8 +++-- build/windows/gitlab-ci/1_build-deps-msys2.sh | 35 +++++++++++-------- .../gitlab-ci/3_package-gimp-uni_sym.sh | 12 ++----- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a0e5d66c37..34060bc8ed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -813,7 +813,7 @@ deps-win-x64: stage: dependencies variables: BUILD_TYPE: "CI_NATIVE" - MSYSTEM: "MINGW64" + MSYSTEM: "CLANG64" CHERE_INVOKING: "yes" tags: - win32-ps @@ -841,13 +841,15 @@ gimp-win-x64: stage: gimp variables: BUILD_TYPE: "CI_NATIVE" - MSYSTEM: "MINGW64" + MSYSTEM: "CLANG64" CHERE_INVOKING: "yes" tags: - win32-ps before_script: - C:\msys64\usr\bin\pacman --noconfirm -Syyuu script: + # Temporary patch until we use the LLVM 18. + - git apply ./build/windows/patches/0001-clang-rc-files-fix.patch - C:\msys64\usr\bin\bash -lc "bash -x ./build/windows/gitlab-ci/2_build-gimp-msys2.sh" artifacts: name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" @@ -872,7 +874,7 @@ packaging-win-x64: - if: '$CI_MERGE_REQUEST_LABELS =~ /.*5. Windows Installer.*/' stage: packaging variables: - MSYSTEM: "MINGW64" + MSYSTEM: "CLANG64" CHERE_INVOKING: "yes" tags: - win32-ps diff --git a/build/windows/gitlab-ci/1_build-deps-msys2.sh b/build/windows/gitlab-ci/1_build-deps-msys2.sh index 3f74d43a55..40cf60206e 100644 --- a/build/windows/gitlab-ci/1_build-deps-msys2.sh +++ b/build/windows/gitlab-ci/1_build-deps-msys2.sh @@ -34,21 +34,28 @@ 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) -retry=3 -while [ $retry -gt 0 ]; do - timeout --signal=KILL 3m pacman --noconfirm -S --needed git \ - base-devel \ - ${MINGW_PACKAGE_PREFIX}-toolchain \ - $DEPS_LIST && break - echo "MSYS2 pacman timed out. Trying again." - taskkill //t //F //IM "pacman.exe" - rm -f c:/msys64/var/lib/pacman/db.lck - : $((--retry)) -done +if [[ "$MSYSTEM_CARCH" == "aarch64" ]]; then + retry=3 + while [ $retry -gt 0 ]; do + timeout --signal=KILL 3m pacman --noconfirm -S --needed git \ + base-devel \ + ${MINGW_PACKAGE_PREFIX}-toolchain \ + $DEPS_LIST && break + echo "MSYS2 pacman timed out. Trying again." + taskkill //t //F //IM "pacman.exe" + rm -f c:/msys64/var/lib/pacman/db.lck + : $((--retry)) + done -if [ $retry -eq 0 ]; then - echo "MSYS2 pacman repeatedly failed. See: https://github.com/msys2/MSYS2-packages/issues/4340" - exit 1 + if [ $retry -eq 0 ]; then + echo "MSYS2 pacman repeatedly failed. See: https://github.com/msys2/MSYS2-packages/issues/4340" + exit 1 + fi +else + pacman --noconfirm -S --needed git \ + base-devel \ + ${MINGW_PACKAGE_PREFIX}-toolchain \ + $DEPS_LIST fi # End of install diff --git a/build/windows/gitlab-ci/3_package-gimp-uni_sym.sh b/build/windows/gitlab-ci/3_package-gimp-uni_sym.sh index 7c13704c8f..a4f737878d 100644 --- a/build/windows/gitlab-ci/3_package-gimp-uni_sym.sh +++ b/build/windows/gitlab-ci/3_package-gimp-uni_sym.sh @@ -1,16 +1,8 @@ #!/bin/bash -if [[ "$MSYSTEM" == "CLANGARM64" ]]; then - # Apparently -v is unknown argument for clangarm64 version of objcopy.exe. - export OBJCOPY_OPTIONS="" -else - export OBJCOPY_OPTIONS="-v" -fi - - # Generate .debug -find . \( -iname '*.dll' -or -iname '*.exe' -or -iname '*.pyd' \) -type f -exec objcopy ${OBJCOPY_OPTIONS} --only-keep-debug '{}' '{}'.debug \; -find . \( -iname '*.dll' -or -iname '*.exe' -or -iname '*.pyd' \) -type f -exec objcopy ${OBJCOPY_OPTIONS} --add-gnu-debuglink='{}'.debug '{}' --strip-unneeded \; +find . \( -iname '*.dll' -or -iname '*.exe' -or -iname '*.pyd' \) -type f -exec objcopy --only-keep-debug '{}' '{}'.debug \; +find . \( -iname '*.dll' -or -iname '*.exe' -or -iname '*.pyd' \) -type f -exec objcopy --add-gnu-debuglink='{}'.debug '{}' --strip-unneeded \; # Copy .debug to .debug folder dbgList=$(find . -iname '*.debug') && dbgArray=($dbgList)