diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d82bcfdd5e..dd839e966b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -395,14 +395,17 @@ deps-win-x64-cross: # adds a local/ folder to the install prefix of setup.py. This environment # variable overrides this behavior. DEB_PYTHON_INSTALL_LAYOUT: "deb" + APT_CACHE: "${CI_PROJECT_DIR}/apt-cache" cache: paths: - .cache/crossroad/ - apt-cache before_script: - apt-get update - - apt-get install -y --no-install-recommends wine wine64 - + - mkdir -p "$APT_CACHE" + - apt-get install -y --no-install-recommends -o dir::cache::archives="$APT_CACHE" + wine + wine64 - git clone --depth=${GIT_DEPTH} https://gitlab.freedesktop.org/crossroad/crossroad.git - cd crossroad - ./setup.py install --prefix=`pwd`/../.local @@ -416,7 +419,8 @@ deps-win-x64-cross: expire_in: 2 hours paths: - .local/ - - _deps/ + - _deps/_babl/_build-x64/ + - _deps/_gegl/_build-x64/ needs: ["image-win-x64-cross"] gimp-win-x64-cross: @@ -440,20 +444,15 @@ gimp-win-x64-cross: - apt-cache script: - export PATH="`pwd`/.local/bin:$PATH" - - mkdir _build && cd _build - - echo 'crossroad meson setup .. - -Dgi-docgen=disabled && ninja && ninja install && - cp -fr $CROSSROAD_PREFIX/ ../gimp-prefix/ - ' | - crossroad w64 gimp --run="-" + - crossroad w64 gimp --run="build/windows/gitlab-ci/2_build-gimp-crossroad.sh" needs: ["deps-win-x64-cross"] artifacts: name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" when: always expire_in: 1 day paths: - - _build/ - - gimp-prefix/ + - _build-x64/ + - _install-x64/ packaging-win-x64-nightly: rules: @@ -465,73 +464,27 @@ packaging-win-x64-nightly: dependencies: - gimp-win-x64-cross variables: - GIMP_PREFIX: "gimp-prefix" - GIMP_DISTRIB: "gimp-w64" + BUILD_TYPE: "CI_CROSS" + CROSSROAD_PLATFORM: "w64" artifacts: name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" when: always expire_in: 2 days paths: - - gimp-w64 - script: + - gimp-x64 + - done-dll.list + before_script: - apt-get update - apt-get install -y --no-install-recommends - python3 binutils-mingw-w64-x86-64 file - libglib2.0-bin - - # Package ressources. - - mkdir -p ${GIMP_DISTRIB} - - cp -fr ${GIMP_PREFIX}/etc ${GIMP_DISTRIB} - - cp -fr ${GIMP_PREFIX}/include ${GIMP_DISTRIB} - - cp -fr ${GIMP_PREFIX}/share ${GIMP_DISTRIB} - - # Package executables. - - mkdir ${GIMP_DISTRIB}/bin - - cp -fr ${GIMP_PREFIX}/bin/gimp*.exe ${GIMP_DISTRIB}/bin/ - - # Add a wrapper at tree root, less messy than having to look for the - # binary inside bin/, in the middle of all the DLLs. - - echo "bin\gimp-2.99.exe" > ${GIMP_DISTRIB}/gimp.cmd - - # Package library data and modules. - - mkdir ${GIMP_DISTRIB}/lib/ - - cp -fr ${GIMP_PREFIX}/lib/gimp ${GIMP_DISTRIB}/lib/ - - cp -fr ${GIMP_PREFIX}/lib/gio ${GIMP_DISTRIB}/lib/ - - cp -fr ${GIMP_PREFIX}/lib/gdk-pixbuf-2.0 ${GIMP_DISTRIB}/lib/ - - cp -fr ${GIMP_PREFIX}/lib/gegl-0.4 ${GIMP_DISTRIB}/lib/ - - cp -fr ${GIMP_PREFIX}/lib/babl-0.1 ${GIMP_DISTRIB}/lib/ - - cp -fr ${GIMP_PREFIX}/lib/girepository-1.0 ${GIMP_DISTRIB}/lib/ - - # Remove files for older GIMP - - rm -fr ${GIMP_DISTRIB}/lib/gimp/2.0/ - - # Generate share/glib-2.0/schemas/gschemas.compiled - - 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/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win64-nightly-dll.list - - python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-console-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win64-nightly-dll.list - - python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-test-clipboard-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win64-nightly-dll.list - - python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimptool-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win64-nightly-dll.list - - - for dll in ${GIMP_DISTRIB}/lib/babl-0.1/*.dll; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win64-nightly-dll.list; - done - - for dll in ${GIMP_DISTRIB}/lib/gegl-0.4/*.dll; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win64-nightly-dll.list; - done - - for dll in ${GIMP_DISTRIB}/lib/gio/modules/*.dll; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win64-nightly-dll.list; - done - - for dll in ${GIMP_DISTRIB}/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.dll; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win64-nightly-dll.list; - done - - for dll in ${GIMP_DISTRIB}/lib/gimp/2.99/modules/*.dll; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win64-nightly-dll.list; - done - - for dll in ${GIMP_DISTRIB}/lib/gimp/2.99/plug-ins/*/*.exe; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win64-nightly-dll.list; - done + binutils + binutils-mingw-w64-x86-64 + file + libglib2.0-bin + python3 + script: + - bash -x build/windows/gitlab-ci/3_package-gimp-uni_base.sh + - cd gimp-x64 + - bash -x ../build/windows/gitlab-ci/3_package-gimp-uni_sym.sh needs: ["gimp-win-x64-cross"] ## WINDOWS 32-bit CI (cross-build crossroad) ## @@ -551,6 +504,10 @@ deps-win-x86-cross: - .cache/crossroad/ - apt-cache before_script: + - apt-get update + - mkdir -p "$APT_CACHE" + - apt-get install -y --no-install-recommends -o dir::cache::archives="$APT_CACHE" + wine - git clone --depth=${GIT_DEPTH} https://gitlab.freedesktop.org/crossroad/crossroad.git - cd crossroad - ./setup.py install --prefix=`pwd`/../.local @@ -564,7 +521,8 @@ deps-win-x86-cross: expire_in: 2 hours paths: - .local/ - - _deps/ + - _deps/_babl/_build-x86/ + - _deps/_gegl/_build-x86/ needs: ["image-win-x86-cross"] gimp-win-x86-cross: @@ -575,6 +533,7 @@ gimp-win-x86-cross: image: $CI_REGISTRY_IMAGE:build-win32-latest dependencies: - deps-win-x86-cross + - deps-win-x64-cross variables: XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache/" XDG_DATA_HOME: "$CI_PROJECT_DIR/.local/share/" @@ -584,20 +543,15 @@ gimp-win-x86-cross: - apt-cache script: - export PATH="`pwd`/.local/bin:$PATH" - - mkdir _build && cd _build - - echo 'crossroad meson setup .. - -Dwmf=disabled -Dmng=disabled -Dgi_docgen=false && ninja && ninja install && - cp -fr $CROSSROAD_PREFIX/ ../gimp-prefix/ - ' | - crossroad w32 gimp --run="-" - needs: ["deps-win-x86-cross"] + - crossroad w32 gimp --run="build/windows/gitlab-ci/2_build-gimp-crossroad.sh" + needs: ["deps-win-x86-cross", "deps-win-x64-cross"] artifacts: name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" when: always expire_in: 1 day paths: - - _build/ - - gimp-prefix/ + - _build-x86/ + - _install-x86/ packaging-win-x86-nightly: rules: @@ -606,80 +560,30 @@ packaging-win-x86-nightly: stage: packaging dependencies: - gimp-win-x86-cross - - deps-win-x64-cross variables: - GIMP_PREFIX: "gimp-prefix" - GIMP_DISTRIB: "gimp-w32" + BUILD_TYPE: "CI_CROSS" + CROSSROAD_PLATFORM: "w32" XDG_DATA_HOME: "$CI_PROJECT_DIR/.local/share/" artifacts: name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}" when: always expire_in: 2 days paths: - - gimp-w32 - script: + - gimp-x86 + - done-dll.list + before_script: - apt-get update - apt-get install -y --no-install-recommends - python3 binutils-mingw-w64-i686 file - libglib2.0-bin - - # Package ressources. - - mkdir -p ${GIMP_DISTRIB} - - cp -fr ${GIMP_PREFIX}/etc ${GIMP_DISTRIB} - - cp -fr ${GIMP_PREFIX}/include ${GIMP_DISTRIB} - - cp -fr ${GIMP_PREFIX}/ssl ${GIMP_DISTRIB} - - cp -fr ${GIMP_PREFIX}/share ${GIMP_DISTRIB} - - # Package executables. - - mkdir ${GIMP_DISTRIB}/bin - - cp -fr ${GIMP_PREFIX}/bin/gimp*.exe ${GIMP_DISTRIB}/bin/ - - # Add a wrapper at tree root, less messy than having to look for the - # binary inside bin/, in the middle of all the DLLs. - - echo "bin\gimp-2.99.exe" > ${GIMP_DISTRIB}/gimp.cmd - - # Package library data and modules. - - mkdir ${GIMP_DISTRIB}/lib/ - - cp -fr ${GIMP_PREFIX}/lib/gimp ${GIMP_DISTRIB}/lib/ - - cp -fr ${GIMP_PREFIX}/lib/gio ${GIMP_DISTRIB}/lib/ - - cp -fr ${GIMP_PREFIX}/lib/gdk-pixbuf-2.0 ${GIMP_DISTRIB}/lib/ - - cp -fr ${GIMP_PREFIX}/lib/gegl-0.4 ${GIMP_DISTRIB}/lib/ - - cp -fr ${GIMP_PREFIX}/lib/babl-0.1 ${GIMP_DISTRIB}/lib/ - - cp -fr ${GIMP_PREFIX}/lib/girepository-1.0 ${GIMP_DISTRIB}/lib/ - - # I fail to install wine32 inside the Gitlab runner. So instead, I - # just reuse the loaders.cache generated in the deps-win64 job as - # they should be the same (text format). - - cp ${XDG_DATA_HOME}/crossroad/roads/w64/gimp/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache ${GIMP_DISTRIB}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache - - # Generate share/glib-2.0/schemas/gschemas.compiled - - 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/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win32-nightly-dll.list - - python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-console-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win32-nightly-dll.list - - python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-test-clipboard-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win32-nightly-dll.list - - python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimptool-2.99.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win32-nightly-dll.list - - - for dll in ${GIMP_DISTRIB}/lib/babl-0.1/*.dll; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win32-nightly-dll.list; - done - - for dll in ${GIMP_DISTRIB}/lib/gegl-0.4/*.dll; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win32-nightly-dll.list; - done - - for dll in ${GIMP_DISTRIB}/lib/gio/modules/*.dll; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win32-nightly-dll.list; - done - - for dll in ${GIMP_DISTRIB}/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.dll; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win32-nightly-dll.list; - done - - for dll in ${GIMP_DISTRIB}/lib/gimp/2.99/modules/*.dll; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win32-nightly-dll.list; - done - - for dll in ${GIMP_DISTRIB}/lib/gimp/2.99/plug-ins/*/*.exe; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list win32-nightly-dll.list; - done - needs: ["gimp-win-x86-cross", "deps-win-x64-cross"] + binutils + binutils-mingw-w64-i686 + file + libglib2.0-bin + python3 + script: + - bash -x build/windows/gitlab-ci/3_package-gimp-uni_base.sh + - cd gimp-x86 + - bash -x ../build/windows/gitlab-ci/3_package-gimp-uni_sym.sh + needs: ["gimp-win-x86-cross"] ## WINDOWS Aarch64 CI (native MSYS2) ## @@ -1052,7 +956,7 @@ cppcheck: - apt-get install -y cppcheck script: - cppcheck -q -j8 --enable=all --force --output-file=cppcheck.xml --xml --xml-version=2 - -i _build -i _deps -i gimp-prefix -i .local -i .cache . + -i _build-x64 -i _build-x86 -i _deps -i _install-x64 -i _install-x86 -i .local -i .cache . - mkdir report - cppcheck-htmlreport --source-dir=. --title=gimp --file=cppcheck.xml --report-dir=report artifacts: diff --git a/build/windows/gitlab-ci/1_build-deps-crossroad.sh b/build/windows/gitlab-ci/1_build-deps-crossroad.sh index deda247699..b9850fcbf7 100644 --- a/build/windows/gitlab-ci/1_build-deps-crossroad.sh +++ b/build/windows/gitlab-ci/1_build-deps-crossroad.sh @@ -1,21 +1,35 @@ +if [[ "x$CROSSROAD_PLATFORM" = "xw64" ]]; then + export ARTIFACTS_SUFFIX="-x64" +else # [[ "x$CROSSROAD_PLATFORM" = "xw32" ]]; + export ARTIFACTS_SUFFIX="-x86" +fi + + +# Install the required (pre-built) packages for babl and GEGL crossroad source msys2 +crossroad install cairo \ + graphviz \ + json-glib \ + lcms2 + +# Clone babl and GEGL (follow master branch) mkdir _deps && cd _deps +git clone --depth 1 https://gitlab.gnome.org/GNOME/babl.git _babl +git clone --depth 1 https://gitlab.gnome.org/GNOME/gegl.git _gegl -# babl +# Build babl and GEGL +mkdir _babl/_build${ARTIFACTS_SUFFIX}/ && cd _babl/_build${ARTIFACTS_SUFFIX}/ +crossroad meson setup .. -Denable-gir=false \ + -Dlibdir=lib +ninja && ninja install -crossroad install lcms2 && \ -git clone --depth 1 https://gitlab.gnome.org/GNOME/babl.git && cd babl && \ -crossroad meson setup _build/ -Denable-gir=false -Dlibdir=lib && \ -ninja -C _build install || exit 1 -cd .. +mkdir ../../_gegl/_build${ARTIFACTS_SUFFIX}/ && cd ../../_gegl/_build${ARTIFACTS_SUFFIX}/ +crossroad meson setup .. -Dintrospection=false \ + -Dlibdir=lib \ + -Dsdl2=disabled +ninja && ninja install +cd ../../ -# GEGL - -crossroad install cairo graphviz json-glib && \ -git clone --depth 1 https://gitlab.gnome.org/GNOME/gegl.git && cd gegl && \ -crossroad meson setup _build/ -Dintrospection=false -Dsdl2=disabled -Dlibdir=lib && \ -ninja -C _build install || exit 1 -cd .. # Install the required (pre-built) packages for GIMP export DEPS_PATH="../build/windows/gitlab-ci/all-deps-uni.txt" diff --git a/build/windows/gitlab-ci/2_build-gimp-crossroad.sh b/build/windows/gitlab-ci/2_build-gimp-crossroad.sh new file mode 100644 index 0000000000..663fb0f052 --- /dev/null +++ b/build/windows/gitlab-ci/2_build-gimp-crossroad.sh @@ -0,0 +1,18 @@ +if [[ "x$CROSSROAD_PLATFORM" = "xw64" ]]; then + export ARTIFACTS_SUFFIX="-x64" + export MESON_OPTIONS="" +else # [[ "x$CROSSROAD_PLATFORM" = "xw32" ]]; + export ARTIFACTS_SUFFIX="-x86" + export MESON_OPTIONS="-Dwmf=disabled -Dmng=disabled" +fi + + +# Build GIMP +mkdir _build${ARTIFACTS_SUFFIX} && cd _build${ARTIFACTS_SUFFIX} +crossroad meson setup .. -Dgi-docgen=disabled \ + -Djavascript=disabled $MESON_OPTIONS +ninja && ninja install +cd .. + +# Copy the required packages and (part of) GIMP from the deps artifact +cp -fr $CROSSROAD_PREFIX/ _install${ARTIFACTS_SUFFIX}/ 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 2fc13a80cc..b147abbcac 100644 --- a/build/windows/gitlab-ci/3_package-gimp-uni_base.sh +++ b/build/windows/gitlab-ci/3_package-gimp-uni_base.sh @@ -1,89 +1,100 @@ #!/bin/bash -# $MINGW_PACKAGE_PREFIX is defined by MSYS2. +# $MSYSTEM_CARCH and $MINGW_PACKAGE_PREFIX are defined by MSYS2. # https://github.com/msys2/MSYS2-packages/blob/master/filesystem/msystem set -e -if [[ "$MSYSTEM" == "MINGW32" ]]; then - export ARTIFACTS_SUFFIX="-w32" - export MSYS_PREFIX="/c/msys64/mingw32/" - export PATH="/mingw32/bin:$PATH" - export GIMP_DISTRIB=`realpath ./gimp-w32` -elif [[ "$MSYSTEM" == "MINGW64" ]]; then - export ARTIFACTS_SUFFIX="-w64" - export MSYS_PREFIX="/c/msys64/mingw64/" - export PATH="/mingw64/bin:$PATH" - export GIMP_DISTRIB=`realpath ./gimp-w64` -else # [[ "$MSYSTEM" == "CLANGARM64" ]]; - export ARTIFACTS_SUFFIX="-arm64" - export MSYS_PREFIX="/c/msys64/clangarm64/" - export PATH="/clangarm64/bin:$PATH" - export GIMP_DISTRIB=`realpath ./gimp-arm64` +if [[ "$MSYSTEM_CARCH" == "aarch64" ]]; then + export ARTIFACTS_SUFFIX="-a64" + export MSYS_PREFIX="c:/msys64${MSYSTEM_PREFIX}" + export GIMP_DISTRIB=`realpath ./gimp-a64` +elif [[ "$CROSSROAD_PLATFORM" == "w64" ]] || [[ "$MSYSTEM_CARCH" == "x86_64" ]]; then + export ARTIFACTS_SUFFIX="-x64" + export MSYS_PREFIX="c:/msys64${MSYSTEM_PREFIX}" + export GIMP_DISTRIB=`realpath ./gimp-x64` +else # [[ "$CROSSROAD_PLATFORM" == "w32" ]] || [[ "$MSYSTEM_CARCH" == "i686" ]]; + export ARTIFACTS_SUFFIX="-x86" + export MSYS_PREFIX="c:/msys64${MSYSTEM_PREFIX}" + export GIMP_DISTRIB=`realpath ./gimp-x86` fi -# Update everything + +if [[ "$BUILD_TYPE" != "CI_CROSS" ]]; then +# Install the required (pre-built) packages again pacman --noconfirm -Suy -# Install the required (pre-built) packages again export DEPS_PATH="build/windows/gitlab-ci/all-deps-uni.txt" sed -i "s/DEPS_ARCH_/${MINGW_PACKAGE_PREFIX}-/g" $DEPS_PATH export GIMP_DEPS=`cat $DEPS_PATH` pacman --noconfirm -S --needed base-devel $GIMP_DEPS +fi + +# Package deps and GIMP files export GIMP_PREFIX="`realpath ./_install`${ARTIFACTS_SUFFIX}" export PATH="$GIMP_PREFIX/bin:$PATH" +if [[ "$BUILD_TYPE" == "CI_CROSS" ]]; then + export MSYS_PREFIX="$GIMP_PREFIX" +fi -# Package ressources. +## Copy a previously built wrapper at tree root, less messy than +## having to look inside bin/, in the middle of all the DLLs. +## This utility also configure the interpreters. +## Then, copy a built README that make clear the utility of .cmd. mkdir -p ${GIMP_DISTRIB} -cp -fr ${GIMP_PREFIX}/etc ${GIMP_DISTRIB} -cp -fr ${GIMP_PREFIX}/include ${GIMP_DISTRIB} -#cp -fr ${GIMP_PREFIX}/ssl ${GIMP_DISTRIB} -cp -fr ${GIMP_PREFIX}/share ${GIMP_DISTRIB} +cp -fr ${GIMP_PREFIX}/*.cmd ${GIMP_DISTRIB}/ +cp -fr ${GIMP_PREFIX}/*.txt ${GIMP_DISTRIB}/ -# Package executables. -mkdir ${GIMP_DISTRIB}/bin -cp -fr ${GIMP_PREFIX}/bin/gimp*.exe ${GIMP_DISTRIB}/bin/ -# With the native Windows build, it's directly in bin/ -#mkdir ${GIMP_DISTRIB}/libexec -#cp -fr ${GIMP_PREFIX}/libexec/gimp*.exe ${GIMP_DISTRIB}/libexec/ +## Modules. +mkdir ${GIMP_DISTRIB}/etc +cp -fr ${MSYS_PREFIX}/etc/fonts/ ${GIMP_DISTRIB}/etc/ +cp -fr ${GIMP_PREFIX}/etc/gimp/ ${GIMP_DISTRIB}/etc/ +cp -fr ${MSYS_PREFIX}/etc/gtk-*/ ${GIMP_DISTRIB}/etc/ -# Add a wrapper at tree root, less messy than having to look for the -# binary inside bin/, in the middle of all the DLLs. -echo "bin\gimp-2.99.exe" > ${GIMP_DISTRIB}/gimp.cmd -# Package library data and modules. -cp -fr ${MSYS_PREFIX}/etc/fonts ${GIMP_DISTRIB}/etc/ -cp -fr ${MSYS_PREFIX}/etc/gtk-3.0 ${GIMP_DISTRIB}/etc/ +## Headers. +mkdir ${GIMP_DISTRIB}/include +cp -fr ${GIMP_PREFIX}/include/babl-*/ ${GIMP_DISTRIB}/include/ +cp -fr ${GIMP_PREFIX}/include/gegl-*/ ${GIMP_DISTRIB}/include/ +cp -fr ${GIMP_PREFIX}/include/gimp-*/ ${GIMP_DISTRIB}/include/ -mkdir ${GIMP_DISTRIB}/lib/ -cp -fr ${GIMP_PREFIX}/lib/gimp ${GIMP_DISTRIB}/lib/ -cp -fr ${GIMP_PREFIX}/lib/gegl-0.4 ${GIMP_DISTRIB}/lib/ -cp -fr ${GIMP_PREFIX}/lib/babl-0.1 ${GIMP_DISTRIB}/lib/ -cp -fr ${MSYS_PREFIX}/lib/girepository-1.0 ${GIMP_DISTRIB}/lib/ -cp -fr ${GIMP_PREFIX}/lib/girepository-1.0/* ${GIMP_DISTRIB}/lib/girepository-1.0/ +## Library data. +mkdir ${GIMP_DISTRIB}/lib +cp -fr ${GIMP_PREFIX}/lib/babl-*/ ${GIMP_DISTRIB}/lib/ +cp -fr ${MSYS_PREFIX}/lib/gdk-pixbuf-*/ ${GIMP_DISTRIB}/lib/ +cp -fr ${GIMP_PREFIX}/lib/gegl-*/ ${GIMP_DISTRIB}/lib/ +cp -fr ${GIMP_PREFIX}/lib/gimp/ ${GIMP_DISTRIB}/lib/ +cp -fr ${MSYS_PREFIX}/lib/gio/ ${GIMP_DISTRIB}/lib/ -cp -fr ${MSYS_PREFIX}/lib/gio ${GIMP_DISTRIB}/lib/ -cp -fr ${MSYS_PREFIX}/lib/gdk-pixbuf-2.0 ${GIMP_DISTRIB}/lib/ -cp -fr ${MSYS_PREFIX}/lib/gtk-3.0 ${GIMP_DISTRIB}/lib/ +aList=$(find ${GIMP_DISTRIB}/lib/ -iname '*.a') && aArray=($aList) +for a in "${aArray[@]}"; do + rm $a +done +rm ${GIMP_DISTRIB}/lib/gegl-*/*.json -cp -fr ${MSYS_PREFIX}/lib/python3.11 ${GIMP_DISTRIB}/lib/ -cp -fr ${MSYS_PREFIX}/share/ghostscript ${GIMP_DISTRIB}/share/ -cp -fr ${MSYS_PREFIX}/share/glib-2.0 ${GIMP_DISTRIB}/share/ -cp -fr ${MSYS_PREFIX}/share/libthai ${GIMP_DISTRIB}/share/ -cp -fr ${MSYS_PREFIX}/share/libwmf ${GIMP_DISTRIB}/share/ -cp -fr ${MSYS_PREFIX}/share/mypaint-data ${GIMP_DISTRIB}/share/ -cp -fr ${MSYS_PREFIX}/share/poppler ${GIMP_DISTRIB}/share/ +## Resources. +mkdir ${GIMP_DISTRIB}/share +cp -fr ${MSYS_PREFIX}/share/ghostscript/ ${GIMP_DISTRIB}/share/ +rm -r ${GIMP_DISTRIB}/share/ghostscript/*/doc +cp -fr ${GIMP_PREFIX}/share/gimp/ ${GIMP_DISTRIB}/share/ +export GLIB_PATH=`echo ${MSYS_PREFIX}/share/glib-*/schemas` +GLIB_PATH=$(sed "s|${MSYS_PREFIX}/||g" <<< $GLIB_PATH) +mkdir -p ${GIMP_DISTRIB}/${GLIB_PATH} +cp -fr ${MSYS_PREFIX}/share/glib-*/schemas/ ${GIMP_DISTRIB}/share/glib-*/ -cp -fr ${MSYS_PREFIX}/share/lua/ ${GIMP_DISTRIB}/share/ -cp -fr ${MSYS_PREFIX}/lib/lua/ ${GIMP_DISTRIB}/lib/ +### Adwaita can be used as the base icon set. +mkdir -p ${GIMP_DISTRIB}/share/icons +cp -fr ${MSYS_PREFIX}/share/icons/Adwaita/ ${GIMP_DISTRIB}/share/icons/ +cp -fr ${GIMP_PREFIX}/share/icons/hicolor/ ${GIMP_DISTRIB}/share/icons/ -# XXX Are these themes really needed? -cp -fr ${MSYS_PREFIX}/share/themes ${GIMP_DISTRIB}/share/ +cp -fr ${MSYS_PREFIX}/share/libthai/ ${GIMP_DISTRIB}/share/ +cp -fr ${MSYS_PREFIX}/share/libwmf/ ${GIMP_DISTRIB}/share/ -# Only copy from langs supported in GIMP. +### Only copy from langs supported in GIMP. +cp -fr ${GIMP_PREFIX}/share/locale/ ${GIMP_DISTRIB}/share/ for dir in ${GIMP_DISTRIB}/share/locale/*/; do lang=`basename "$dir"`; # TODO: ideally we could be a bit more accurate and copy only the @@ -95,93 +106,70 @@ for dir in ${GIMP_DISTRIB}/share/locale/*/; do fi done; -# Only one iso-codes file is useful. +mkdir -p ${GIMP_DISTRIB}/share/man/man1 +mkdir -p ${GIMP_DISTRIB}/share/man/man5 +cp -fr ${GIMP_PREFIX}/share/man/man1/gimp* ${GIMP_DISTRIB}/share/man/man1/ +cp -fr ${GIMP_PREFIX}/share/man/man5/gimp* ${GIMP_DISTRIB}/share/man/man5/ +mkdir ${GIMP_DISTRIB}/share/metainfo +cp -fr ${GIMP_PREFIX}/share/metainfo/org.gimp*.xml ${GIMP_DISTRIB}/share/metainfo/ +cp -fr ${MSYS_PREFIX}/share/mypaint-data/ ${GIMP_DISTRIB}/share/ +cp -fr ${MSYS_PREFIX}/share/poppler/ ${GIMP_DISTRIB}/share/ + +### Only one iso-codes file is useful. mkdir -p ${GIMP_DISTRIB}/share/xml/iso-codes cp -fr ${MSYS_PREFIX}/share/xml/iso-codes/iso_639.xml ${GIMP_DISTRIB}/share/xml/iso-codes/ -# Adwaita can be used as the base icon set. -cp -fr ${MSYS_PREFIX}/share/icons/Adwaita ${GIMP_DISTRIB}/share/icons/ -# Gdbus is needed to avoid warnings in CMD. -cp -fr ${MSYS_PREFIX}/bin/gdbus.exe ${GIMP_DISTRIB}/bin +## Executables and DLLs. -# XXX Why are these for exactly? -cp -fr ${MSYS_PREFIX}/bin/gspawn*.exe ${GIMP_DISTRIB}/bin/ - -# We save the list of already copied DLLs to keep a state between dll_link runs. +### We save the list of already copied DLLs to keep a state between 3_package-gimp-uni_dep runs. rm -f done-dll.list -python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gspawn-win*-helper.exe ${GIMP_PREFIX}/ ${MSYS_PREFIX} ${GIMP_DISTRIB} --output-dll-list done-dll.list -python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gspawn-win*-helper-console.exe ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list +### Minimal executables for the 'bin' folder +mkdir ${GIMP_DISTRIB}/bin +binArray=("${MSYS_PREFIX}/bin/bzip2.exe" + "${MSYS_PREFIX}/bin/dot.exe" + "${MSYS_PREFIX}/bin/gdbus.exe" + "${MSYS_PREFIX}/bin/gdk-pixbuf-query-loaders.exe" + "${GIMP_PREFIX}/bin/gimp*.exe" + "${MSYS_PREFIX}/bin/gspawn*.exe") +for exe in "${binArray[@]}"; do + cp -fr $exe ${GIMP_DISTRIB}/bin/ +done -# XXX Does not look like it's needed anymore. Check? -cp -fr ${MSYS_PREFIX}/bin/gdk-pixbuf-query-loaders.exe ${GIMP_DISTRIB}/bin/ -python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gdk-pixbuf-query-loaders.exe ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list +## Optional executables, .DLLs and resources for GObject Introspection support +if [[ "$BUILD_TYPE" != "CI_CROSS" ]]; then + cp -fr ${MSYS_PREFIX}/bin/libgirepository-*.dll ${GIMP_DISTRIB}/bin/ + python3 build/windows/gitlab-ci/3_package-gimp-uni_dep.py ${GIMP_DISTRIB}/bin/libgirepository-*.dll ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list + cp -fr ${MSYS_PREFIX}/lib/girepository-*/ ${GIMP_DISTRIB}/lib/ + cp -fr ${GIMP_PREFIX}/lib/girepository-*/* ${GIMP_DISTRIB}/lib/girepository-*/ + cp -fr ${GIMP_PREFIX}/share/gir-*/ ${GIMP_DISTRIB}/share/ -# XXX Why is bzip2.exe needed? -cp -fr ${MSYS_PREFIX}/bin/bzip2.exe ${GIMP_DISTRIB}/bin/ -python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/bzip2.exe ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list - -# Executables for supported interpreters. -cp -fr ${MSYS_PREFIX}/bin/pythonw.exe ${GIMP_DISTRIB}/bin/ -python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/pythonw.exe ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list -cp -fr ${MSYS_PREFIX}/bin/python3w.exe ${GIMP_DISTRIB}/bin/ -python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/python3w.exe ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list -cp -fr ${MSYS_PREFIX}/bin/python3.exe ${GIMP_DISTRIB}/bin/ -python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/python3.exe ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list - -if [[ "$MSYSTEM" == "CLANGARM64" ]]; then - cp -fr ${MSYS_PREFIX}/bin/lua5.1.exe ${GIMP_DISTRIB}/bin/ - python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/lua5.1.exe ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list -else cp -fr ${MSYS_PREFIX}/bin/luajit.exe ${GIMP_DISTRIB}/bin/ - python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/luajit.exe ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list + cp -fr ${MSYS_PREFIX}/lib/lua/ ${GIMP_DISTRIB}/lib/ + cp -fr ${MSYS_PREFIX}/share/lua/ ${GIMP_DISTRIB}/share/ + + cp -fr ${MSYS_PREFIX}/bin/python*.exe ${GIMP_DISTRIB}/bin/ + cp -fr ${MSYS_PREFIX}/lib/python*/ ${GIMP_DISTRIB}/lib/ + + cp -fr ${GIMP_PREFIX}/share/vala/ ${GIMP_DISTRIB}/share/ +else + # Just to ensure there is no introspected files that will output annoying warnings + # This is needed because meson.build files can have flaws + goiList=$(find ${GIMP_DISTRIB} \( -iname '*.lua' -or -iname '*.py' -or -iname '*.scm' -or -iname '*.vala' \)) && goiArray=($goiList) + for goi in "${goiArray[@]}"; do + rm $goi + done fi -# Executable for "gegl:introspect" from graphviz package. -cp -fr ${MSYS_PREFIX}/bin/dot.exe ${GIMP_DISTRIB}/bin/ -python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/dot.exe ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list - -# Generate share/glib-2.0/schemas/gschemas.compiled -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/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-2.99.exe ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list - -python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-console-2.99.exe ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list - -python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-debug-resume.exe ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list - -python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-debug-tool-2.99.exe ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list - -python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-test-clipboard-2.99.exe ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list - -python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimptool-2.99.exe ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list - -for dll in ${GIMP_DISTRIB}/lib/babl-0.1/*.dll; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list; -done -for dll in ${GIMP_DISTRIB}/lib/gegl-0.4/*.dll; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list; -done -for dll in ${GIMP_DISTRIB}/lib/gio/modules/*.dll; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list; -done -for dll in ${GIMP_DISTRIB}/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.dll; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list; -done -for dll in ${GIMP_DISTRIB}/lib/gimp/2.99/modules/*.dll; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list; -done -for dll in ${GIMP_DISTRIB}/lib/gimp/2.99/plug-ins/*/*.exe; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list; +### Needed DLLs for the executables in the 'bin' folder +binList=$(find ${GIMP_DISTRIB}/bin/ -iname '*.exe') && binArray=($binList) +for bin in "${binArray[@]}"; do + python3 build/windows/gitlab-ci/3_package-gimp-uni_dep.py $bin ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list; done -# Libraries for GObject Introspection. - -cp -fr ${MSYS_PREFIX}/bin/libgirepository-1.0-1.dll ${GIMP_DISTRIB}/bin/ -python3 build/windows/gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/libgirepository-1.0-1.dll ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list - -for dll in ${GIMP_DISTRIB}/lib/python3.11/site-packages/*/*.dll; do - python3 build/windows/gitlab-ci/dll_link.py $dll ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list; -done +### Needed DLLs for the executables and DLLs in the 'lib' sub-folders +libList=$(find ${GIMP_DISTRIB}/lib/ \( -iname '*.dll' -or -iname '*.exe' \)) && libArray=($libList) +for lib in "${libArray[@]}"; do + python3 build/windows/gitlab-ci/3_package-gimp-uni_dep.py $lib ${GIMP_PREFIX}/ ${MSYS_PREFIX}/ ${GIMP_DISTRIB} --output-dll-list done-dll.list; +done \ No newline at end of file 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 d8327b8bb8..7c13704c8f 100644 --- a/build/windows/gitlab-ci/3_package-gimp-uni_sym.sh +++ b/build/windows/gitlab-ci/3_package-gimp-uni_sym.sh @@ -7,23 +7,20 @@ else export OBJCOPY_OPTIONS="-v" fi -if [ -z "$1" ] -then - 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 '*.debug' -exec "$0" {} + -else - while [ -n "$1" ] - do - FP="$1" - NAME="${FP##*/}" - DIR="${FP%/*}" - echo "$FP -> $DIR/.debug" - if [ ! -d "$DIR/.debug" ] - then - mkdir "$DIR/.debug" - fi - mv "$FP" "$DIR/.debug" - shift - done -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 \; + +# Copy .debug to .debug folder +dbgList=$(find . -iname '*.debug') && dbgArray=($dbgList) +for dbg in "${dbgArray[@]}"; do + FP="$dbg" 0> /dev/null + NAME="${FP##*/}" 0> /dev/null + DIR="${FP%/*}" 0> /dev/null + echo "$FP -> $DIR/.debug" 0> /dev/null + if [ ! -d "$DIR/.debug" ]; then + mkdir "$DIR/.debug" + fi + mv "$FP" "$DIR/.debug" +done