From 833ce48f60a79e83cbd7c87022150e30242dc2b9 Mon Sep 17 00:00:00 2001 From: Jehan Date: Sun, 2 May 2021 15:43:25 +0200 Subject: [PATCH 1/5] gitlab-ci, build: testing native Windows build. Just an initial test to get a hang of the thing, mostly inspired from GTK gitlab-ci rules adapted to our build. All in one job (deps, babl, GEGL, GIMP itself) for now, for simplicity of debugging. We'll see later to break this into CI sub-jobs. --- .gitlab-ci.yml | 12 +++++ build/windows/build-msys2.sh | 97 ++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 build/windows/build-msys2.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6e2863e4c30..90e7b0584e7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -186,6 +186,18 @@ gimp-clang-debian: ## WINDOWS 64-bit CI ## +gimp-native-win64: + variables: + MSYSTEM: "MINGW64" + CHERE_INVOKING: "yes" + stage: gimp + tags: + - win32-ps + script: + - C:\msys64\usr\bin\pacman --noconfirm -Syyuu + - C:\msys64\usr\bin\bash -lc "bash -x ./build/windows/build-msys2.sh" + needs: [] + deps-win64: rules: - if: '$CI_COMMIT_TAG == null' diff --git a/build/windows/build-msys2.sh b/build/windows/build-msys2.sh new file mode 100644 index 00000000000..463f6031ed5 --- /dev/null +++ b/build/windows/build-msys2.sh @@ -0,0 +1,97 @@ +#!/bin/bash + +set -e + +if [[ "$MSYSTEM" == "MINGW32" ]]; then + export MSYS2_ARCH="i686" +else + export MSYS2_ARCH="x86_64" +fi + +# Update everything +pacman --noconfirm -Suy + +# Install the required packages +pacman --noconfirm -S --needed \ + base-devel \ + mingw-w64-$MSYS2_ARCH-toolchain \ + mingw-w64-$MSYS2_ARCH-ccache \ + mingw-w64-$MSYS2_ARCH-pkg-config \ + mingw-w64-$MSYS2_ARCH-meson \ + \ + mingw-w64-$MSYS2_ARCH-asciidoc \ + mingw-w64-$MSYS2_ARCH-adwaita-icon-theme \ + mingw-w64-$MSYS2_ARCH-appstream-glib \ + mingw-w64-$MSYS2_ARCH-atk \ + mingw-w64-$MSYS2_ARCH-cairo \ + mingw-w64-$MSYS2_ARCH-drmingw \ + mingw-w64-$MSYS2_ARCH-gexiv2 \ + mingw-w64-$MSYS2_ARCH-ghostscript \ + mingw-w64-$MSYS2_ARCH-glib-networking \ + mingw-w64-$MSYS2_ARCH-gobject-introspection \ + mingw-w64-$MSYS2_ARCH-gobject-introspection-runtime \ + mingw-w64-$MSYS2_ARCH-graphviz \ + mingw-w64-$MSYS2_ARCH-gtk3 \ + mingw-w64-$MSYS2_ARCH-gtk-doc \ + mingw-w64-$MSYS2_ARCH-iso-codes \ + mingw-w64-$MSYS2_ARCH-json-c \ + mingw-w64-$MSYS2_ARCH-json-glib \ + mingw-w64-$MSYS2_ARCH-lcms2 \ + mingw-w64-$MSYS2_ARCH-lensfun \ + mingw-w64-$MSYS2_ARCH-libarchive \ + mingw-w64-$MSYS2_ARCH-libepoxy \ + mingw-w64-$MSYS2_ARCH-libheif \ + mingw-w64-$MSYS2_ARCH-libmypaint \ + mingw-w64-$MSYS2_ARCH-libraw \ + mingw-w64-$MSYS2_ARCH-libspiro \ + mingw-w64-$MSYS2_ARCH-libwebp \ + mingw-w64-$MSYS2_ARCH-libwmf \ + mingw-w64-$MSYS2_ARCH-luajit \ + mingw-w64-$MSYS2_ARCH-maxflow \ + mingw-w64-$MSYS2_ARCH-mypaint-brushes \ + mingw-w64-$MSYS2_ARCH-openexr \ + mingw-w64-$MSYS2_ARCH-pango \ + mingw-w64-$MSYS2_ARCH-poppler \ + mingw-w64-$MSYS2_ARCH-python3-gobject \ + mingw-w64-$MSYS2_ARCH-SDL2 \ + mingw-w64-$MSYS2_ARCH-shared-mime-info \ + mingw-w64-$MSYS2_ARCH-suitesparse \ + mingw-w64-$MSYS2_ARCH-vala \ + mingw-w64-$MSYS2_ARCH-xpm-nox + +mkdir -p _ccache +export CCACHE_BASEDIR="$(pwd)" +export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache" +export CC="ccache gcc" + +export GIT_DEPTH=1 +export GIMP_PREFIX=`realpath ~/_install` +export PATH="$GIMP_PREFIX/bin:$PATH" +export PKG_CONFIG_PATH="${GIMP_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH" +export PKG_CONFIG_PATH="${GIMP_PREFIX}/share/pkgconfig:$PKG_CONFIG_PATH" +export LD_LIBRARY_PATH="${GIMP_PREFIX}/lib:${LD_LIBRARY_PATH}" +export ACLOCAL_FLAGS="-I/c/msys64/mingw64/share/aclocal" +export XDG_DATA_DIRS="${GIMP_PREFIX}/share:/mingw64/share/" + +git clone --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/babl.git _babl +git clone --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/gegl.git _gegl + +cd _babl +meson -Dprefix="${GIMP_PREFIX}" -Dwith-docs=false _build +ninja -v -C _build +ninja -C _build install +cd ../_gegl +meson -Dprefix="${GIMP_PREFIX}" -Ddocs=false _build +ninja -C _build +ninja -C _build install +cd .. + +# Build +ccache --zero-stats +ccache --show-stats + +./autogen.sh --prefix="${GIMP_PREFIX}" +make -j4 +make install + +ccache --show-stats -- GitLab From a2bf3be0cf04c86846770e7c3eb7c445b6903ee6 Mon Sep 17 00:00:00 2001 From: Jehan Date: Mon, 3 May 2021 16:08:03 +0200 Subject: [PATCH 2/5] Cleanup the Gitlab runner manually. Ok so this is horrible, but this is the only way I found to get past some errors. The build would break randomly (sometimes it would, sometimes not, with the same gitlab-ci rules) because of existing files. The errors would be the following when trying to install dependency packages with pacman: > mingw-w64-x86_64-glib2: /mingw64/bin/libglib-2.0-0.dll exists in filesystem At first I thought it was a bug in Pacman or MSYS2, but on some runners, I had such warnings at the very start of the runner (note: on some runners, the warnings would not be displayed even though the final conflicting files error would still happen at the end of the logs): > warning: failed to remove mingw64/bin/libglib-2.0-0.dll: Invalid argument It looks like it might be related to this Gitlab bug where a runner would fail to clean its environment: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/1839 In any case, the only way I found so far is to manually remove the conflicting files before installing the packages supposed to install these. This is completely horrible (and I sure hope it won't come up again with different files each time) but really the only workaround I found so far (I think a real solution will have to come from Gitlab code or from the GNOME admins, not sure what is the exact source of the problem). --- build/windows/build-msys2.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/build/windows/build-msys2.sh b/build/windows/build-msys2.sh index 463f6031ed5..8e37b2e01f8 100644 --- a/build/windows/build-msys2.sh +++ b/build/windows/build-msys2.sh @@ -8,6 +8,22 @@ else export MSYS2_ARCH="x86_64" fi +# Why do we even have to remove these manually? The whole thing is +# messed up, but it looks like the Gitlab runner fails to clean properly +# (it spews a bunch of "failed to remove" warnings at runner start, then +# ends with a "error: failed to commit transaction (conflicting files)" +# listing the various files it failed to remove). +# Might be tied to: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/1839 +rm -f /c/msys64/mingw64/bin/libpcre-1.dll +rm -f /c/msys64/mingw64/bin/libgio-2.0-0.dll +rm -f /c/msys64/mingw64/bin/libglib-2.0-0.dll +rm -f /c/msys64/mingw64/bin/libgmodule-2.0-0.dll +rm -f /c/msys64/mingw64/bin/libgobject-2.0-0.dll +rm -f /c/msys64/mingw64/bin/libpng16-16.dll +rm -f /c/msys64/mingw64/bin/gdk-pixbuf-pixdata.exe +rm -f /c/msys64/mingw64/bin/libgdk_pixbuf-2.0-0.dll +rm -f /c/msys64/mingw64/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.dll + # Update everything pacman --noconfirm -Suy -- GitLab From 853b3016cf26eed998ee8b392f2f3a09eb77105c Mon Sep 17 00:00:00 2001 From: Jehan Date: Mon, 3 May 2021 20:01:29 +0200 Subject: [PATCH 3/5] build: do not build Windows dependencies with ccache. The build rules were highly inspired by other projects on GNOME's Gitlab. All of them used to build with ccache. It worked fine for the main build, but completely broke GObject Introspection build on both babl and GEGL. And the worse thing is that meson was absolutely not displaying the error, just saying it failed (even in verbose mode). A lot of time wasted trying to debug. Therefore let's get rid of ccache, but only for babl and GEGL. Keep it for GIMP itself as it works fine there. Other minor changes: * Build from the build dir, rather than source. The other way around works too, but I actually find commands simpler this way. * Adding artifacts. --- .gitlab-ci.yml | 9 +++++++++ build/windows/build-msys2.sh | 32 ++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 90e7b0584e7..467088d2236 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -196,6 +196,15 @@ gimp-native-win64: script: - C:\msys64\usr\bin\pacman --noconfirm -Syyuu - C:\msys64\usr\bin\bash -lc "bash -x ./build/windows/build-msys2.sh" + artifacts: + name: "GIMP-Win-native-${CI_COMMIT_SHORT_SHA}" + when: always + expire_in: 2 days + paths: + - _install + cache: + paths: + - _ccache/ needs: [] deps-win64: diff --git a/build/windows/build-msys2.sh b/build/windows/build-msys2.sh index 8e37b2e01f8..90a66adee53 100644 --- a/build/windows/build-msys2.sh +++ b/build/windows/build-msys2.sh @@ -75,11 +75,6 @@ pacman --noconfirm -S --needed \ mingw-w64-$MSYS2_ARCH-vala \ mingw-w64-$MSYS2_ARCH-xpm-nox -mkdir -p _ccache -export CCACHE_BASEDIR="$(pwd)" -export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache" -export CC="ccache gcc" - export GIT_DEPTH=1 export GIMP_PREFIX=`realpath ~/_install` export PATH="$GIMP_PREFIX/bin:$PATH" @@ -92,17 +87,26 @@ export XDG_DATA_DIRS="${GIMP_PREFIX}/share:/mingw64/share/" git clone --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/babl.git _babl git clone --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/gegl.git _gegl -cd _babl -meson -Dprefix="${GIMP_PREFIX}" -Dwith-docs=false _build -ninja -v -C _build -ninja -C _build install -cd ../_gegl -meson -Dprefix="${GIMP_PREFIX}" -Ddocs=false _build -ninja -C _build -ninja -C _build install -cd .. +mkdir _babl/_build +cd _babl/_build +meson -Dprefix="${GIMP_PREFIX}" -Dwith-docs=false .. +ninja +ninja install + +mkdir ../../_gegl/_build +cd ../../_gegl/_build +meson -Dprefix="${GIMP_PREFIX}" -Ddocs=false .. +ninja +ninja install +cd ../.. # Build + +mkdir -p _ccache +export CCACHE_BASEDIR="$(pwd)" +export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache" +export CC="ccache gcc" + ccache --zero-stats ccache --show-stats -- GitLab From 42ef8c00580a8f0642e8fd011b4c798b760acf2b Mon Sep 17 00:00:00 2001 From: Jehan Date: Wed, 5 May 2021 01:00:39 +0200 Subject: [PATCH 4/5] build, gitlab-ci: break the native Windows build into 2 jobs. One for dependencies, one for GIMP. --- .gitlab-ci.yml | 79 ++++++++++++------- .../build-deps-crossroad.sh} | 0 build/windows/gitlab-ci/build-deps-msys2.sh | 72 +++++++++++++++++ .../build-gimp-msys2.sh} | 29 +------ .../dll_link.py | 0 5 files changed, 125 insertions(+), 55 deletions(-) rename build/windows/{crossbuild-gitlab-ci/build-deps.sh => gitlab-ci/build-deps-crossroad.sh} (100%) create mode 100644 build/windows/gitlab-ci/build-deps-msys2.sh rename build/windows/{build-msys2.sh => gitlab-ci/build-gimp-msys2.sh} (81%) rename build/windows/{crossbuild-gitlab-ci => gitlab-ci}/dll_link.py (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 467088d2236..d33795919a8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -184,20 +184,41 @@ gimp-clang-debian: - ninja -C _build - ninja -C _build test -## WINDOWS 64-bit CI ## +## WINDOWS 64-bit CI (native MSYS2) ## -gimp-native-win64: +deps-win64-native: + stage: dependencies variables: MSYSTEM: "MINGW64" CHERE_INVOKING: "yes" + tags: + - win32-ps + cache: + paths: + - _install/ + script: + - C:\msys64\usr\bin\pacman --noconfirm -Syyuu + - C:\msys64\usr\bin\bash -lc "bash -x ./build/windows/gitlab-ci/build-deps-msys2.sh" + artifacts: + name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}" + when: always + expire_in: 2 hours + paths: + - _install + needs: [] + +gimp-win64-native: stage: gimp + variables: + MSYSTEM: "MINGW64" + CHERE_INVOKING: "yes" tags: - win32-ps script: - C:\msys64\usr\bin\pacman --noconfirm -Syyuu - - C:\msys64\usr\bin\bash -lc "bash -x ./build/windows/build-msys2.sh" + - C:\msys64\usr\bin\bash -lc "bash -x ./build/windows/gitlab-ci/build-gimp-msys2.sh" artifacts: - name: "GIMP-Win-native-${CI_COMMIT_SHORT_SHA}" + name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}" when: always expire_in: 2 days paths: @@ -205,7 +226,9 @@ gimp-native-win64: cache: paths: - _ccache/ - needs: [] + needs: ["deps-win64-native"] + +## WINDOWS 64-bit CI (cross-build crossroad) ## deps-win64: rules: @@ -230,7 +253,7 @@ deps-win64: - pip3 install zstandard script: - export PATH="`pwd`/.local/bin:$PATH" - - crossroad w64 gimp --run="build/windows/crossbuild-gitlab-ci/build-deps.sh" + - crossroad w64 gimp --run="build/windows/gitlab-ci/build-deps-crossroad.sh" artifacts: name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}" when: always @@ -271,7 +294,7 @@ gimp-win64: - _build/ - gimp-prefix/ -## WINDOWS 32-bit CI ## +## WINDOWS 32-bit CI (cross-build crossroad) ## deps-win32: rules: @@ -293,7 +316,7 @@ deps-win32: - pip3 install zstandard script: - export PATH="`pwd`/.local/bin:$PATH" - - crossroad w32 gimp --run="build/windows/crossbuild-gitlab-ci/build-deps.sh" + - crossroad w32 gimp --run="build/windows/gitlab-ci/build-deps-crossroad.sh" artifacts: name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}" when: always @@ -425,28 +448,28 @@ win64-nightly: - glib-compile-schemas --targetdir=${GIMP_DISTRIB}/share/glib-2.0/schemas ${GIMP_DISTRIB}/share/glib-2.0/schemas # Package needed DLLs only - - python3 build/windows/crossbuild-gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} - - python3 build/windows/crossbuild-gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-console-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} - - python3 build/windows/crossbuild-gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-test-clipboard-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} - - python3 build/windows/crossbuild-gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimptool-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} + - python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} + - python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-console-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} + - python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-test-clipboard-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} + - python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimptool-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} - for dll in ${GIMP_DISTRIB}/lib/babl-0.1/*.dll; do - python3 build/windows/crossbuild-gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; + python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; done - for dll in ${GIMP_DISTRIB}/lib/gegl-0.4/*.dll; do - python3 build/windows/crossbuild-gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; + python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; done - for dll in ${GIMP_DISTRIB}/lib/gio/modules/*.dll; do - python3 build/windows/crossbuild-gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; + python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; done - for dll in ${GIMP_DISTRIB}/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.dll; do - python3 build/windows/crossbuild-gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; + python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; done - for dll in ${GIMP_DISTRIB}/lib/gimp/2.99/modules/*.dll; do - python3 build/windows/crossbuild-gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; + python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; done - for dll in ${GIMP_DISTRIB}/lib/gimp/2.99/plug-ins/*/*.exe; do - python3 build/windows/crossbuild-gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; + python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; done needs: ["gimp-win64"] @@ -509,27 +532,27 @@ win32-nightly: - glib-compile-schemas --targetdir=${GIMP_DISTRIB}/share/glib-2.0/schemas ${GIMP_DISTRIB}/share/glib-2.0/schemas # Package needed DLLs only. - - python3 build/windows/crossbuild-gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} - - python3 build/windows/crossbuild-gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-console-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} - - python3 build/windows/crossbuild-gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-test-clipboard-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} - - python3 build/windows/crossbuild-gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimptool-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} + - python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} + - python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-console-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} + - python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-test-clipboard-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} + - python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimptool-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} - for dll in ${GIMP_DISTRIB}/lib/babl-0.1/*.dll; do - python3 build/windows/crossbuild-gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; + python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; done - for dll in ${GIMP_DISTRIB}/lib/gegl-0.4/*.dll; do - python3 build/windows/crossbuild-gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; + python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; done - for dll in ${GIMP_DISTRIB}/lib/gio/modules/*.dll; do - python3 build/windows/crossbuild-gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; + python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; done - for dll in ${GIMP_DISTRIB}/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.dll; do - python3 build/windows/crossbuild-gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; + python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; done - for dll in ${GIMP_DISTRIB}/lib/gimp/2.99/modules/*.dll; do - python3 build/windows/crossbuild-gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; + python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; done - for dll in ${GIMP_DISTRIB}/lib/gimp/2.99/plug-ins/*/*.exe; do - python3 build/windows/crossbuild-gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; + python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}; done needs: ["gimp-win32", "deps-win64"] diff --git a/build/windows/crossbuild-gitlab-ci/build-deps.sh b/build/windows/gitlab-ci/build-deps-crossroad.sh similarity index 100% rename from build/windows/crossbuild-gitlab-ci/build-deps.sh rename to build/windows/gitlab-ci/build-deps-crossroad.sh diff --git a/build/windows/gitlab-ci/build-deps-msys2.sh b/build/windows/gitlab-ci/build-deps-msys2.sh new file mode 100644 index 00000000000..31d400a9564 --- /dev/null +++ b/build/windows/gitlab-ci/build-deps-msys2.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +set -e + +if [[ "$MSYSTEM" == "MINGW32" ]]; then + export MSYS2_ARCH="i686" +else + export MSYS2_ARCH="x86_64" +fi + +# Why do we even have to remove these manually? The whole thing is +# messed up, but it looks like the Gitlab runner fails to clean properly +# (it spews a bunch of "failed to remove" warnings at runner start, then +# ends with a "error: failed to commit transaction (conflicting files)" +# listing the various files it failed to remove). +# Might be tied to: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/1839 +rm -f /c/msys64/mingw64/bin/libpcre-1.dll +rm -f /c/msys64/mingw64/bin/libgio-2.0-0.dll +rm -f /c/msys64/mingw64/bin/libglib-2.0-0.dll +rm -f /c/msys64/mingw64/bin/libgmodule-2.0-0.dll +rm -f /c/msys64/mingw64/bin/libgobject-2.0-0.dll +rm -f /c/msys64/mingw64/bin/libpng16-16.dll +rm -f /c/msys64/mingw64/bin/gdk-pixbuf-pixdata.exe +rm -f /c/msys64/mingw64/bin/libgdk_pixbuf-2.0-0.dll +rm -f /c/msys64/mingw64/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.dll + +# Update everything +pacman --noconfirm -Suy + +# Install the required packages +pacman --noconfirm -S --needed \ + base-devel \ + mingw-w64-$MSYS2_ARCH-toolchain \ + mingw-w64-$MSYS2_ARCH-meson \ + \ + mingw-w64-$MSYS2_ARCH-cairo \ + mingw-w64-$MSYS2_ARCH-gobject-introspection \ + mingw-w64-$MSYS2_ARCH-json-glib \ + mingw-w64-$MSYS2_ARCH-lcms2 \ + mingw-w64-$MSYS2_ARCH-lensfun \ + mingw-w64-$MSYS2_ARCH-libspiro \ + mingw-w64-$MSYS2_ARCH-maxflow \ + mingw-w64-$MSYS2_ARCH-openexr \ + mingw-w64-$MSYS2_ARCH-pango \ + mingw-w64-$MSYS2_ARCH-suitesparse \ + mingw-w64-$MSYS2_ARCH-vala + +export GIT_DEPTH=1 +export GIMP_PREFIX=`realpath ./_install` +export PATH="$GIMP_PREFIX/bin:$PATH" +export PKG_CONFIG_PATH="${GIMP_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH" +export PKG_CONFIG_PATH="${GIMP_PREFIX}/share/pkgconfig:$PKG_CONFIG_PATH" +export LD_LIBRARY_PATH="${GIMP_PREFIX}/lib:${LD_LIBRARY_PATH}" +export ACLOCAL_FLAGS="-I/c/msys64/mingw64/share/aclocal" +export XDG_DATA_DIRS="${GIMP_PREFIX}/share:/mingw64/share/" + +git clone --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/babl.git _babl +git clone --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/gegl.git _gegl + +mkdir _babl/_build +cd _babl/_build +meson -Dprefix="${GIMP_PREFIX}" -Dwith-docs=false .. +ninja +ninja install + +mkdir ../../_gegl/_build +cd ../../_gegl/_build +meson -Dprefix="${GIMP_PREFIX}" -Ddocs=false \ + -Dcairo=enabled -Dumfpack=enabled \ + -Dopenexr=enabled -Dworkshop=true .. +ninja +ninja install diff --git a/build/windows/build-msys2.sh b/build/windows/gitlab-ci/build-gimp-msys2.sh similarity index 81% rename from build/windows/build-msys2.sh rename to build/windows/gitlab-ci/build-gimp-msys2.sh index 90a66adee53..b261a41b6eb 100644 --- a/build/windows/build-msys2.sh +++ b/build/windows/gitlab-ci/build-gimp-msys2.sh @@ -32,11 +32,7 @@ pacman --noconfirm -S --needed \ base-devel \ mingw-w64-$MSYS2_ARCH-toolchain \ mingw-w64-$MSYS2_ARCH-ccache \ - mingw-w64-$MSYS2_ARCH-pkg-config \ - mingw-w64-$MSYS2_ARCH-meson \ \ - mingw-w64-$MSYS2_ARCH-asciidoc \ - mingw-w64-$MSYS2_ARCH-adwaita-icon-theme \ mingw-w64-$MSYS2_ARCH-appstream-glib \ mingw-w64-$MSYS2_ARCH-atk \ mingw-w64-$MSYS2_ARCH-cairo \ @@ -55,10 +51,8 @@ pacman --noconfirm -S --needed \ mingw-w64-$MSYS2_ARCH-lcms2 \ mingw-w64-$MSYS2_ARCH-lensfun \ mingw-w64-$MSYS2_ARCH-libarchive \ - mingw-w64-$MSYS2_ARCH-libepoxy \ mingw-w64-$MSYS2_ARCH-libheif \ mingw-w64-$MSYS2_ARCH-libmypaint \ - mingw-w64-$MSYS2_ARCH-libraw \ mingw-w64-$MSYS2_ARCH-libspiro \ mingw-w64-$MSYS2_ARCH-libwebp \ mingw-w64-$MSYS2_ARCH-libwmf \ @@ -68,15 +62,14 @@ pacman --noconfirm -S --needed \ mingw-w64-$MSYS2_ARCH-openexr \ mingw-w64-$MSYS2_ARCH-pango \ mingw-w64-$MSYS2_ARCH-poppler \ + mingw-w64-$MSYS2_ARCH-poppler-data \ mingw-w64-$MSYS2_ARCH-python3-gobject \ - mingw-w64-$MSYS2_ARCH-SDL2 \ mingw-w64-$MSYS2_ARCH-shared-mime-info \ mingw-w64-$MSYS2_ARCH-suitesparse \ mingw-w64-$MSYS2_ARCH-vala \ mingw-w64-$MSYS2_ARCH-xpm-nox -export GIT_DEPTH=1 -export GIMP_PREFIX=`realpath ~/_install` +export GIMP_PREFIX=`realpath ./_install` export PATH="$GIMP_PREFIX/bin:$PATH" export PKG_CONFIG_PATH="${GIMP_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH" export PKG_CONFIG_PATH="${GIMP_PREFIX}/share/pkgconfig:$PKG_CONFIG_PATH" @@ -84,24 +77,6 @@ export LD_LIBRARY_PATH="${GIMP_PREFIX}/lib:${LD_LIBRARY_PATH}" export ACLOCAL_FLAGS="-I/c/msys64/mingw64/share/aclocal" export XDG_DATA_DIRS="${GIMP_PREFIX}/share:/mingw64/share/" -git clone --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/babl.git _babl -git clone --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/gegl.git _gegl - -mkdir _babl/_build -cd _babl/_build -meson -Dprefix="${GIMP_PREFIX}" -Dwith-docs=false .. -ninja -ninja install - -mkdir ../../_gegl/_build -cd ../../_gegl/_build -meson -Dprefix="${GIMP_PREFIX}" -Ddocs=false .. -ninja -ninja install -cd ../.. - -# Build - mkdir -p _ccache export CCACHE_BASEDIR="$(pwd)" export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache" diff --git a/build/windows/crossbuild-gitlab-ci/dll_link.py b/build/windows/gitlab-ci/dll_link.py similarity index 100% rename from build/windows/crossbuild-gitlab-ci/dll_link.py rename to build/windows/gitlab-ci/dll_link.py -- GitLab From e9eba901851fb4db31cde980063dcdc1b0beef74 Mon Sep 17 00:00:00 2001 From: Jehan Date: Wed, 5 May 2021 02:12:52 +0200 Subject: [PATCH 5/5] build: fix a weird (yet unexplained) build bug. Without this, the native Windows GIMP build fails in CI with: > make[2]: *** No rule to make target '_install\include\gegl-0.4\gegl.h', needed by '../libgimpcolor/gimpadaptivesupersample.lo'. Stop. Even though `gegl.h` is present (as checked through artifacts). It's just so weird. --- build/windows/gitlab-ci/build-gimp-msys2.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build/windows/gitlab-ci/build-gimp-msys2.sh b/build/windows/gitlab-ci/build-gimp-msys2.sh index b261a41b6eb..0ffb8a837c0 100644 --- a/build/windows/gitlab-ci/build-gimp-msys2.sh +++ b/build/windows/gitlab-ci/build-gimp-msys2.sh @@ -69,7 +69,12 @@ pacman --noconfirm -S --needed \ mingw-w64-$MSYS2_ARCH-vala \ mingw-w64-$MSYS2_ARCH-xpm-nox -export GIMP_PREFIX=`realpath ./_install` +# XXX We've got a weird error when the prefix is in the current dir. +# Until we figure it out, this trick seems to work, even though it's +# completely ridiculous. +mv _install ~ + +export GIMP_PREFIX=`realpath ~/_install` export PATH="$GIMP_PREFIX/bin:$PATH" export PKG_CONFIG_PATH="${GIMP_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH" export PKG_CONFIG_PATH="${GIMP_PREFIX}/share/pkgconfig:$PKG_CONFIG_PATH" @@ -90,3 +95,6 @@ make -j4 make install ccache --show-stats + +# XXX Moving back the prefix to be used as artifacts. +mv "${GIMP_PREFIX}" . -- GitLab