From 9ab481647cbdba56ed55091d596cf6e45498de5c Mon Sep 17 00:00:00 2001 From: Bruno Date: Thu, 17 Oct 2024 07:45:43 -0300 Subject: [PATCH] build/windows: Port building scripts to use Windows native shell From now, Windows contributors can use the default shell provided by the OS (which is PS since Windows build 10.0.14971.0), like Linux and macOS users do. We still use MSYS2 but not the POSIX shell. This change adds these features: '1_build-deps-msys2.sh' is now '1_build-deps-msys2.ps1' - Faster clonning by using 'git-scm' (the MSYS2 one had performance problems) - Easier to use non-MSYS2 binaries, not only 'git-scm' but also official meson, deps from vckpg etc. This is a needed step towards the future use of MSVC. '2_build-gimp-msys2.sh' is now '2_build-gimp-msys2.ps1' - By default, vanilla builds (normally triggered on PS) will create a bundle, dropping the need of 'gimp.cmd' (that adressed .typelib and .interp limits), which is inline with other (Cmake-based) projects like Darktable and Inkscape. This change is important because even Windows devs more experienced than me get confused with the relocatibility stuff, which is the default on Windows. '2_bundle-gimp-uni_base.sh' - As a result of the change above, bundling code was changed to be a bit faster. It still is, however, painfully slow, since meson doesn't have a 'install()' function like Cmake to prepend targets in Ninja's 'install_manifest.txt'. Since we are not using a POSIX shell (nor 'mintty') anymore: - GIMP can be built from every path easily with R. Click "Open Terminal", with IDE integrations etc, without needing to manual tweak MSYS2 .ini files etc. We could tweak MSYS2 to get the features above but not top-tier integration. - Developers can be more aware of Windows native vars, paths etc, and avoid bugs Some build files were improved to support the 'Windows way of doing things'. - No need to close and reopen terminal anymore after running 'pacman -Suy'! --- REGRESSION: Vala plug-ins are temporarely gone due to 'vapigen' bugs, a small regression since this is a gnomeish language but I will investigate how to fix. --- .gitlab-ci.yml | 60 +++--- build/windows/1_build-deps-msys2.ps1 | 104 +++++++++ build/windows/1_build-deps-msys2.sh | 108 ---------- build/windows/2_build-gimp-crossroad.sh | 20 -- build/windows/2_build-gimp-msys2.ps1 | 55 +++++ build/windows/2_build-gimp-msys2.sh | 138 ------------ build/windows/2_bundle-gimp-uni_base.sh | 199 ++++++++---------- build/windows/2_bundle-gimp-uni_dep.py | 2 +- build/windows/all-deps-uni.txt | 1 - build/windows/installer/3_dist-gimp-inno.ps1 | 29 +-- .../windows/installer/3_dist-gimp-inno_sym.sh | 2 +- build/windows/store/3_dist-gimp-winsdk.ps1 | 6 +- gimp-data | 2 +- meson.build | 9 + pdb/meson.build | 10 +- 15 files changed, 308 insertions(+), 437 deletions(-) create mode 100644 build/windows/1_build-deps-msys2.ps1 delete mode 100644 build/windows/1_build-deps-msys2.sh create mode 100644 build/windows/2_build-gimp-msys2.ps1 delete mode 100644 build/windows/2_build-gimp-msys2.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 93f8c08c9a..fb51198434 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -415,7 +415,7 @@ gimp-win-x64-cross: paths: - gimp-x64/ - _build-cross/meson-logs/meson-log.txt - - done-dll.list + - _build-cross/done-dll.list expire_in: 2 days ## WINDOWS pipelines (native MSYS2) ## @@ -448,10 +448,18 @@ gimp-win-x64-cross: variables: STORE_OPTION: '-Dms-store=true' - <<: *CI_RELEASE - variables: - CHERE_INVOKING: "yes" - # We use the same universal variables but not directly from PS - before_script: [] + # We don't use the universal variables since we use PS + before_script: + # MSYS2 config + - $MSYS2_PREFIX = 'C:/msys64' + - $env:Path = "$MSYS2_PREFIX/$MSYSTEM_PREFIX/bin;$MSYS2_PREFIX/usr/bin;" + $env:Path + # Build-time vars + # FIXME:'gimpenv' have buggy code about Windows paths + - $GIMP_PREFIX = "$PWD\_install".Replace('\', '/') + - $env:Path = $env:Path + ";$GIMP_PREFIX/bin" + - $env:PKG_CONFIG_PATH = "$MSYS2_PREFIX/$MSYSTEM_PREFIX/lib/pkgconfig;$MSYS2_PREFIX/$MSYSTEM_PREFIX/share/pkgconfig;$GIMP_PREFIX/lib/pkgconfig" + - $env:XDG_DATA_DIRS = "$MSYS2_PREFIX/$MSYSTEM_PREFIX/share;$GIMP_PREFIX/share" + - $env:GI_TYPELIB_PATH = "$MSYS2_PREFIX/$MSYSTEM_PREFIX/lib/girepository-1.0;$GIMP_PREFIX/lib/girepository-1.0" ## WINDOWS Aarch64 CI (native MSYS2) ## .win-a64: @@ -462,15 +470,7 @@ gimp-win-x64-cross: tags: - windows-aarch64 variables: - MSYSTEM: "CLANGARM64" - before_script: - # Verification to prevent the job from failing because stuck pacman (ARM only) - - $stuck = Test-Path -Path "C:\msys64\var\lib\pacman\db.lck" -PathType Leaf - - if ($stuck -eq "True") { - Remove-Item -Force -Path "C:\msys64\var\lib\pacman\db.lck"; - Write-Output "Cleaned previous stuck pacman" } - - taskkill /F /FI "MODULES eq msys-2.0.dll" - - Start-Job -ScriptBlock{sleep 90; taskkill /t /F /IM "pacman.exe"} + MSYSTEM_PREFIX: clangarm64 deps-win-a64: extends: .win-a64 @@ -479,7 +479,7 @@ deps-win-a64: needs: [] stage: dependencies script: - - C:\msys64\usr\bin\bash -lc "bash build/windows/1_build-deps-msys2.sh" + - build/windows/1_build-deps-msys2.ps1 artifacts: paths: - _install/ @@ -494,12 +494,12 @@ gimp-win-a64: needs: ["deps-win-a64"] stage: gimp script: - - C:\msys64\usr\bin\bash -lc "bash build/windows/2_build-gimp-msys2.sh" + - build/windows/2_build-gimp-msys2.ps1 artifacts: paths: - gimp-a64/ - _build/meson-logs/meson-log.txt - - done-dll.list + - _build/done-dll.list # Needed by dist-installer-weekly and dist-store-weekly - _build/config.h - _build/build/windows/installer/ @@ -516,7 +516,7 @@ gimp-win-a64: tags: - win32-ps variables: - MSYSTEM: "CLANG64" + MSYSTEM_PREFIX: clang64 deps-win-x64: extends: .win-x64 @@ -525,7 +525,7 @@ deps-win-x64: needs: [] stage: dependencies script: - - C:\msys64\usr\bin\bash -lc "bash build/windows/1_build-deps-msys2.sh" + - build/windows/1_build-deps-msys2.ps1 artifacts: paths: - _install/ @@ -538,11 +538,11 @@ gimp-win-x64: needs: ["deps-win-x64"] stage: gimp script: - - C:\msys64\usr\bin\bash -lc "bash build/windows/2_build-gimp-msys2.sh" + - build/windows/2_build-gimp-msys2.ps1 artifacts: paths: - gimp-x64/ - - done-dll.list + - _build/done-dll.list expire_in: 2 days ## WINDOWS x86 CI (native MSYS2) ## @@ -555,9 +555,10 @@ gimp-win-x64: tags: - win32-ps variables: - MSYSTEM: "MINGW32" - CC: "ccache cc" - CXX: "ccache c++" + MSYSTEM_PREFIX: mingw32 + MINGW_PACKAGE_PREFIX: mingw-w64-i686 + CC: cc + CXX: c++ CC_LD: bfd CXX_LD: bfd @@ -568,7 +569,7 @@ deps-win-x86: needs: [] stage: dependencies script: - - C:\msys64\usr\bin\bash -lc "bash build/windows/1_build-deps-msys2.sh" + - build/windows/1_build-deps-msys2.ps1 artifacts: paths: - _install/ @@ -581,13 +582,13 @@ gimp-win-x86: needs: ["deps-win-x86"] stage: gimp script: - - C:\msys64\usr\bin\bash -lc "bash build/windows/2_build-gimp-msys2.sh" + - build/windows/2_build-gimp-msys2.ps1 # We split 32-bit DWARF symbols here because LLVM-objcopy do NOT support them - - C:\msys64\usr\bin\bash -lc "bash build/windows/installer/3_dist-gimp-inno_sym.sh" + - bash build/windows/installer/3_dist-gimp-inno_sym.sh artifacts: paths: - gimp-x86/ - - done-dll.list + - _build/done-dll.list expire_in: 2 days @@ -783,11 +784,8 @@ dist-installer-weekly: stage: distribution tags: - windows-aarch64 - variables: - MSYSTEM: "CLANGARM64" cache: [] script: - - C:\msys64\usr\bin\bash -lc "bash build/windows/installer/3_dist-gimp-inno_sym.sh" - build/windows/installer/3_dist-gimp-inno.ps1 artifacts: expose_as: 'Windows exe' diff --git a/build/windows/1_build-deps-msys2.ps1 b/build/windows/1_build-deps-msys2.ps1 new file mode 100644 index 0000000000..fb51b2c7d8 --- /dev/null +++ b/build/windows/1_build-deps-msys2.ps1 @@ -0,0 +1,104 @@ +#!/usr/bin/env pwsh + +if (-not $GITLAB_CI) + { + # Make the script work locally + if (-not (Test-Path build\windows) -and -not (Test-Path 1_build-deps-msys2.ps1 -Type Leaf) -or $PSScriptRoot -notlike "*build\windows*") + { + Write-Host '(ERROR): Script called from wrong dir. Please, read: https://developer.gimp.org/core/setup/build/windows/' -ForegroundColor Red + exit 1 + } + elseif (Test-Path 1_build-deps-msys2.ps1 -Type Leaf) + { + Set-Location ..\.. + } + + $GIT_DEPTH = '1' + } + + +# Install the required (pre-built) packages for babl, GEGL and GIMP +#https://github.com/msys2/msys2-installer/issues/85 +$MSYS2_PREFIX = 'C:/msys64' +if ($MSYSTEM_PREFIX -eq 'mingw32') + { + Write-Host '(WARNING): 32-bit builds will be dropped in a future release. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/10922' -ForegroundColor Yellow + } +elseif ((Get-WmiObject -Class Win32_ComputerSystem).SystemType -like 'ARM64*') + { + $MSYSTEM_PREFIX = 'clangarm64' + $MINGW_PACKAGE_PREFIX = 'mingw-w64-clang-aarch64' + } +elseif ((Get-WmiObject -Class Win32_ComputerSystem).SystemType -like 'x64*') + { + $MSYSTEM_PREFIX = 'clang64' + $MINGW_PACKAGE_PREFIX = 'mingw-w64-clang-x86_64' + } +$env:Path = "$MSYS2_PREFIX/$MSYSTEM_PREFIX/bin;$MSYS2_PREFIX/usr/bin;" + $env:Path + +#https://github.com/msys2/MSYS2-packages/issues/4340 +$PACMAN_CONF = "$MSYS2_PREFIX\etc\pacman.conf" +Copy-Item $PACMAN_CONF "$PACMAN_CONF.bak" +(Get-Content $PACMAN_CONF) | Foreach-Object {$_ -replace "SigLevel = Required","SigLevel = DatabaseNever"} | +Set-Content $PACMAN_CONF +pacman --noconfirm -Suy +pacman --noconfirm -S --needed base-devel $MINGW_PACKAGE_PREFIX-toolchain (Get-Content build/windows/all-deps-uni.txt).Replace('${MINGW_PACKAGE_PREFIX}',$MINGW_PACKAGE_PREFIX).Replace(' \','') +Remove-Item $PACMAN_CONF +Rename-Item "$PACMAN_CONF.bak" $PACMAN_CONF + + +# Prepare env +$GIMP_DIR = $PWD + +if (-not $GITLAB_CI) + { + Set-Location .. + + if (-not $GIMP_PREFIX) + { + $GIMP_PREFIX = "$PWD\_install" + } + + Invoke-Expression ((Get-Content $GIMP_DIR\.gitlab-ci.yml | Select-String 'env:Path \+' -Context 0,3) -replace '> ','' -replace '- ','') + } + + +# Build babl and GEGL +function self_build ([string]$dep, [string]$option1, [string]$option2) + { + ## Make sure that the deps repos are fine + if (-not (Test-Path $dep)) + { + $repo="https://gitlab.gnome.org/GNOME/$dep.git" + + # For tagged jobs (i.e. release or test jobs for upcoming releases), use the + # last tag. Otherwise use the default branch's HEAD. + if ($CI_COMMIT_TAG) + { + $tag = (git ls-remote --exit-code --refs --sort=version:refname $repo refs/tags/GIMP_[0-9]*_* | Select-Object -Last 1).Split('refs/')[-1] + $git_options="--branch=$tag" + Write-Output "Using tagged release of ${dep}: $tag" + } + + git clone $git_options --depth $GIT_DEPTH $repo + } + Set-Location $dep + git pull + + ## Configure and/or build + if (-not (Test-Path _build\build.ninja -Type Leaf)) + { + meson setup _build -Dprefix="$GIMP_PREFIX" $option1 $option2 + } + Set-Location _build + ninja + ninja install + ccache --show-stats + Set-Location ../.. + } + +#https://gitlab.gnome.org/GNOME/babl/-/issues/97 +self_build babl '-Dwith-docs=false' '-Denable-vapi=false' +self_build gegl '-Dworkshop=true' '-Dvapigen=disabled' + +Set-Location $GIMP_DIR diff --git a/build/windows/1_build-deps-msys2.sh b/build/windows/1_build-deps-msys2.sh deleted file mode 100644 index d13b836f05..0000000000 --- a/build/windows/1_build-deps-msys2.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/bash - -set -e - -if [ -z "$GITLAB_CI" ]; then - # Make the script work locally - if [ "$0" != 'build/windows/1_build-deps-msys2.sh' ] && [ ${PWD/*\//} != 'windows' ]; then - echo -e '\033[31m(ERROR)\033[0m: Script called from wrong dir. Please, read: https://developer.gimp.org/core/setup/build/windows/' - exit 1 - elif [ ${PWD/*\//} = 'windows' ]; then - cd ../.. - fi - export GIT_DEPTH=1 - GIMP_DIR=$(echo "${PWD##*/}/") - cd $(dirname $PWD) -fi - -if [ "$MSYSTEM_CARCH" = "i686" ]; then - echo -e "\033[33m(WARNING)\033[0m: 32-bit builds will be dropped in a future release. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/10922" -fi - - -# Install the required (pre-built) packages for babl, GEGL and GIMP -if [ "$MSYSTEM_CARCH" != "aarch64" ]; then - # https://gitlab.gnome.org/GNOME/gimp/-/issues/10782 - pacman --noconfirm -Suy -fi -# Beginning of install code block -DEPS_LIST=$(cat ${GIMP_DIR}build/windows/all-deps-uni.txt | - sed "s/\${MINGW_PACKAGE_PREFIX}-/${MINGW_PACKAGE_PREFIX}-/g" | - sed 's/\\//g') - -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 - fi -else - pacman --noconfirm -S --needed git \ - base-devel \ - ${MINGW_PACKAGE_PREFIX}-toolchain \ - $DEPS_LIST -fi -# End of install code block - - -# Prepare env -## We need to create the condition this ugly way to not break CI -if [ "$GITLAB_CI" ]; then - export GIMP_PREFIX="$PWD/_install" -elif [ -z "$GITLAB_CI" ] && [ -z "$GIMP_PREFIX" ]; then - export GIMP_PREFIX="$PWD/_install" -fi -## Universal variables from .gitlab-ci.yml -IFS=$'\n' VAR_ARRAY=($(cat ${GIMP_DIR}.gitlab-ci.yml | sed -n '/export PATH=/,/GI_TYPELIB_PATH}\"/p' | sed 's/ - //')) -IFS=$' \t\n' -for VAR in "${VAR_ARRAY[@]}"; do - eval "$VAR" || continue -done - - -# Build babl and GEGL -self_build () -{ - # Clone source only if not already cloned or downloaded - repo="https://gitlab.gnome.org/GNOME/$1.git" - - if [ "$CI_COMMIT_TAG" != "" ]; then - # For tagged jobs (i.e. release or test jobs for upcoming releases), use the - # last tag. Otherwise use the default branch's HEAD. - tag=$(git ls-remote --tags --exit-code --refs "$repo" | grep -oi "${1}_[0-9]*_[0-9]*_[0-9]*" | sort --version-sort | tail -1) - git_options="--branch=$tag" - echo "Using tagged release of $1: $tag" - fi - - if [ ! -d "$1" ]; then - git clone $git_options --depth $GIT_DEPTH $repo || exit 1 - else - cd $1 && git pull && cd .. - fi - - # Build - if [ ! -f "$1/_build/build.ninja" ]; then - mkdir -p $1/_build && cd $1/_build - meson setup .. -Dprefix="$GIMP_PREFIX" $2 - else - cd $1/_build - fi - ninja - ninja install - ccache --show-stats - cd ../.. -} - -self_build babl '-Dwith-docs=false' -self_build gegl '-Dworkshop=true' diff --git a/build/windows/2_build-gimp-crossroad.sh b/build/windows/2_build-gimp-crossroad.sh index 15d5d91ead..423ee4c473 100644 --- a/build/windows/2_build-gimp-crossroad.sh +++ b/build/windows/2_build-gimp-crossroad.sh @@ -75,24 +75,4 @@ ninja ninja install ccache --show-stats cd .. - -## Wrapper just for easier GIMP running (to not look at the huge bin/ folder with many .DLLs) -GIMP_APP_VERSION=$(grep GIMP_APP_VERSION _build$ARTIFACTS_SUFFIX/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/') -echo "@echo off - echo This is a CI crossbuild of GIMP. - echo .js (JavaScript) plug-ins ^|^ NOT supported! - echo .py (Python) plug-ins ^|^ NOT supported! - echo .scm (ScriptFu) plug-ins ^|^ NOT supported! - echo .vala (Vala) plug-ins ^|^ NOT supported! - echo. - bin\gimp-$GIMP_APP_VERSION.exe" > ${CROSSROAD_PREFIX}/gimp.cmd - -if [ "$GITLAB_CI" ]; then - # Copy GIMP and all its deps to improvised GIMP_PREFIX - cp -fr $CROSSROAD_PREFIX/ _install$ARTIFACTS_SUFFIX - - # Bundle GIMP - bash build/windows/2_bundle-gimp-uni_base.sh --authorized -fi - fi # END OF CROSSROAD ENV diff --git a/build/windows/2_build-gimp-msys2.ps1 b/build/windows/2_build-gimp-msys2.ps1 new file mode 100644 index 0000000000..c0a21668ff --- /dev/null +++ b/build/windows/2_build-gimp-msys2.ps1 @@ -0,0 +1,55 @@ +#!/usr/bin/env pwsh + +if (-not $GITLAB_CI) + { + # Make the script work locally + if (-not (Test-Path build\windows) -and -not (Test-Path 2_build-gimp-msys2.ps1 -Type Leaf) -or $PSScriptRoot -notlike "*build\windows*") + { + Write-Host '(ERROR): Script called from wrong dir. Please, read: https://developer.gimp.org/core/setup/build/windows/' -ForegroundColor Red + exit 1 + } + elseif (Test-Path 2_build-gimp-msys2.ps1 -Type Leaf) + { + Set-Location ..\.. + } + + git submodule update --init + } + + +# Install the required (pre-built) packages for babl, GEGL and GIMP (again) +Invoke-Expression ((Get-Content build\windows\1_build-deps-msys2.ps1 | Select-String 'MSYS2_PREFIX =' -Context 0,17) -replace '> ','') + +if ($GITLAB_CI) + { + Invoke-Expression ((Get-Content build\windows\1_build-deps-msys2.ps1 | Select-String 'PACMAN_CONF =' -Context 0,7) -replace '> ','') + } + + +# Prepare env +if (-not $GITLAB_CI) + { + if (-not $GIMP_PREFIX) + { + #FIXME:'gimpenv' have buggy code about Windows paths + $GIMP_PREFIX = "$PWD\..\_install".Replace('\', '/') + } + + Invoke-Expression ((Get-Content .gitlab-ci.yml | Select-String 'env:Path \+' -Context 0,3) -replace '> ','' -replace '- ','') + } + + +# Build GIMP +if (-not (Test-Path _build\build.ninja -Type Leaf)) + { + #https://gitlab.gnome.org/GNOME/gimp/-/issues/11200 + #https://gitlab.gnome.org/GNOME/gimp/-/issues/5891 + meson setup _build -Dprefix="$GIMP_PREFIX" -Dgi-docgen=disabled -Djavascript=disabled -Dvala=disabled ` + -Ddirectx-sdk-dir="$MSYS2_PREFIX/$MSYSTEM_PREFIX" -Denable-default-bin=enabled ` + -Dbuild-id='org.gimp.GIMP_official' $INSTALLER_OPTION $STORE_OPTION + } +Set-Location _build +ninja +ninja install +ccache --show-stats +Set-Location .. diff --git a/build/windows/2_build-gimp-msys2.sh b/build/windows/2_build-gimp-msys2.sh deleted file mode 100644 index bf52dfadde..0000000000 --- a/build/windows/2_build-gimp-msys2.sh +++ /dev/null @@ -1,138 +0,0 @@ -#!/bin/bash - -set -e - -if [ -z "$GITLAB_CI" ]; then - # Make the script work locally - if [ "$0" != 'build/windows/2_build-gimp-msys2.sh' ] && [ ${PWD/*\//} != 'windows' ]; then - echo -e '\033[31m(ERROR)\033[0m: Script called from wrong dir. Please, read: https://developer.gimp.org/core/setup/build/windows/' - exit 1 - elif [ ${PWD/*\//} = 'windows' ]; then - cd ../.. - fi - git submodule update --init --force -fi - -if [ "$MSYSTEM_CARCH" = "i686" ]; then - echo -e "\033[33m(WARNING)\033[0m: 32-bit builds will be dropped in a future release. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/10922" -fi - - -if [ "$GITLAB_CI" ]; then - # Install the required (pre-built) packages for GIMP again - # We take code from deps script to better maintenance - echo "$(cat build/windows/1_build-deps-msys2.sh | - sed -n '/# Beginning of install/,/# End of install/p')" | bash -fi - - -# Prepare env -## We need to create the condition this ugly way to not break CI -if [ "$GITLAB_CI" ]; then - export GIMP_PREFIX="$PWD/_install" -elif [ -z "$GITLAB_CI" ] && [ -z "$GIMP_PREFIX" ]; then - export GIMP_PREFIX="$PWD/../_install" -fi -## Universal variables from .gitlab-ci.yml -IFS=$'\n' VAR_ARRAY=($(cat .gitlab-ci.yml | sed -n '/export PATH=/,/GI_TYPELIB_PATH}\"/p' | sed 's/ - //')) -IFS=$' \t\n' -for VAR in "${VAR_ARRAY[@]}"; do - eval "$VAR" || continue -done - - -# Build GIMP -if [ -z "$GITLAB_CI" ] && [ "$1" != "--relocatable" ]; then - echo "(INFO): GIMP will be built in MSYS2 friendly mode" - export bundle_option='-Drelocatable-bundle=no' -elif [ "$GITLAB_CI" ] || [ "$1" = '--relocatable' ]; then - echo "(INFO): GIMP will be built as a relocatable bundle" - export bundle_option='-Drelocatable-bundle=yes' -fi -if [ -z "$GITLAB_CI" ] && [ "$1" = '--relocatable' ]; then - export INSTALLER_OPTION='-Dwindows-installer=true' - export STORE_OPTION='-Dms-store=true' -fi -export MESON_OPTIONS="$bundle_option $INSTALLER_OPTION $STORE_OPTION" - -if [ ! -f "_build/build.ninja" ]; then - mkdir -p "_build" && cd "_build" - echo "$1" > last_mode - # We disable javascript as we are not able for the time being to add a - # javascript interpreter with GObject Introspection (GJS/spidermonkey - # and Seed/Webkit are the 2 contenders so far, but they are not - # available on MSYS2 and we are told it's very hard to build them). - # TODO: re-enable javascript plug-ins when we can figure this out. - meson setup .. -Dprefix="${GIMP_PREFIX}" \ - -Dgi-docgen=disabled \ - -Djavascript=disabled \ - -Ddirectx-sdk-dir="${MSYSTEM_PREFIX}" \ - -Denable-default-bin=enabled \ - -Dbuild-id=org.gimp.GIMP_official $MESON_OPTIONS -else - cd "_build" - if [[ $(head -1 last_mode) != "$1" ]]; then - echo "$1" > last_mode - meson setup .. --reconfigure $MESON_OPTIONS - fi -fi -ninja -ninja install -ccache --show-stats -cd .. - - -# Wrapper just for easier GIMP running -make_cmd () -{ - if [ "$4" == "do_wizardry" ]; then - interp_pyt="( - echo python=$2\bin\python.exe - echo python3=$2\bin\python.exe - echo /usr/bin/python=$2\bin\python.exe - echo /usr/bin/python3=$2\bin\python.exe - echo :Python:E::py::python: - ) >%cd%\lib\gimp\GIMP_API_VERSION\interpreters\pygimp.interp" - interp_scm="( - echo gimp-script-fu-interpreter=%cd%\bin\gimp-script-fu-interpreter-GIMP_API_VERSION.exe - echo gimp-script-fu-interpreter-GIMP_API_VERSION=%cd%\bin\gimp-script-fu-interpreter-GIMP_API_VERSION.exe - echo /usr/bin/gimp-script-fu-interpreter=%cd%\bin\gimp-script-fu-interpreter-GIMP_API_VERSION.exe - echo :ScriptFu:E::scm::gimp-script-fu-interpreter-GIMP_API_VERSION.exe: - ) >%cd%\lib\gimp\GIMP_API_VERSION\interpreters\gimp-script-fu-interpreter.interp" - cp_typelib="@if not exist MSYS2_PREFIX\lib\girepository-1.0\babl*.typelib (copy lib\girepository-1.0\babl*.typelib $2\lib\girepository-1.0) > nul - @if not exist MSYS2_PREFIX\lib\girepository-1.0\gegl*.typelib (copy lib\girepository-1.0\gegl*.typelib $2\lib\girepository-1.0) > nul - @if not exist MSYS2_PREFIX\lib\girepository-1.0\gimp*.typelib (copy lib\girepository-1.0\gimp*.typelib $2\lib\girepository-1.0) > nul" - set_path="set PATH=%PATH%;$2\bin" - dl_typelib="@if exist MSYS2_PREFIX\lib\girepository-1.0\babl*.typelib (if exist lib\girepository-1.0\babl*.typelib (del $2\lib\girepository-1.0\babl*.typelib)) > nul - @if exist MSYS2_PREFIX\lib\girepository-1.0\gegl*.typelib (if exist lib\girepository-1.0\gegl*.typelib (del $2\lib\girepository-1.0\gegl*.typelib)) > nul - @if exist MSYS2_PREFIX\lib\girepository-1.0\gimp*.typelib (if exist lib\girepository-1.0\gimp*.typelib (del $2\lib\girepository-1.0\gimp*.typelib)) > nul" - fi - echo "@echo off - echo This is a $1 native build of GIMP$3. - echo .js (JavaScript) plug-ins ^|^ NOT supported! - $interp_pyt - echo .py (Python) plug-ins ^|^ supported. - $interp_scm - echo .scm (ScriptFu) plug-ins ^|^ supported. - echo .vala (Vala) plug-ins ^|^ supported. - echo. - $cp_typelib - $set_path - bin\gimp-GIMP_APP_VERSION.exe - $dl_typelib" > ${GIMP_PREFIX}/gimp.cmd - sed -i "s/GIMP_API_VERSION/$(grep GIMP_PKGCONFIG_VERSION _build/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/')/g" ${GIMP_PREFIX}/gimp.cmd - sed -i "s/GIMP_APP_VERSION/$(grep GIMP_APP_VERSION _build/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/')/g" ${GIMP_PREFIX}/gimp.cmd - sed -i -e "s|MSYS2_PREFIX|c:\/msys64${MSYSTEM_PREFIX}|g" -e 's|c:/|c:\\|g;s|msys64/|msys64\\|g' ${GIMP_PREFIX}/gimp.cmd -} - -if [ -z "$GITLAB_CI" ] && [ "$1" != "--relocatable" ]; then - make_cmd local MSYS2_PREFIX " (please run bin/gimp-GIMP_APP_VERSION.exe under $MSYSTEM shell)" do_wizardry -elif [ "$GITLAB_CI" ] || [ "$1" = "--relocatable" ]; then - make_cmd CI %cd% "" -fi - - -if [ "$GITLAB_CI" ] || [ "$1" = "--relocatable" ]; then - # Bundle GIMP - bash build/windows/2_bundle-gimp-uni_base.sh --authorized -fi diff --git a/build/windows/2_bundle-gimp-uni_base.sh b/build/windows/2_bundle-gimp-uni_base.sh index b33cc26f72..d01279ccb4 100644 --- a/build/windows/2_bundle-gimp-uni_base.sh +++ b/build/windows/2_bundle-gimp-uni_base.sh @@ -2,30 +2,12 @@ set -e -if [ "$1" != '--authorized' ] && [ "$1" != '--force' ]; then - # We can't easily figure out if GIMP was built relocatable so - # let's prevent contributors from creating broken bundles - echo -e "\033[31m(ERROR)\033[0m: Script called standalone. Please, run GIMP build script with '--relocatable' or this bundling script with '--force'" +if [ -z "$MESON_BUILD_ROOT" ]; then + # Let's prevent contributors from creating broken bundles + echo -e "\033[31m(ERROR)\033[0m: Script called standalone. Please, just build GIMP and this script will be called automatically." exit 1 fi -if [ "$1" = '--force' ] && [ "$MSYSTEM_CARCH" = "i686" ]; then - echo -e "\033[33m(WARNING)\033[0m: 32-bit builds will be dropped in a future release. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/10922" -fi - - -# NOTE: The bundling scripts, different from building scripts, need to set -# the ARTIFACTS_SUFFIX, even locally: 1) to avoid confusion (bundle dirs are -# relocatable so can be copied to a machine with other arch); and 2) to our -# dist scripts fallback code be able to identify what they are distributing -if [ "$MSYSTEM_CARCH" = "aarch64" ]; then - export ARTIFACTS_SUFFIX="-a64" -elif [ "$CI_JOB_NAME" = "gimp-win-x64-cross" ] || [ "$MSYSTEM_CARCH" = "x86_64" ]; then - export ARTIFACTS_SUFFIX="-x64" -else # [ "$MSYSTEM_CARCH" = "i686" ]; - export ARTIFACTS_SUFFIX="-x86" -fi - if [[ "$CI_JOB_NAME" =~ "cross" ]]; then apt-get update @@ -39,109 +21,118 @@ fi # Bundle deps and GIMP files -if [[ "$CI_JOB_NAME" =~ "cross" ]]; then - export GIMP_PREFIX="`realpath ./_install-cross`" - export MSYS_PREFIX="$GIMP_PREFIX" -else - if [ "$GITLAB_CI" ]; then - export GIMP_PREFIX="$PWD/_install" - elif [ -z "$GITLAB_CI" ] && [ -z "$GIMP_PREFIX" ]; then - export GIMP_PREFIX="$PWD/../_install" - fi - export MSYS_PREFIX="$MSYSTEM_PREFIX" +export GIMP_SOURCE=$(echo $MESON_SOURCE_ROOT | sed 's|\\|/|g') +grep -q 'windows-installer=true' meson-logs/meson-log.txt && export INSTALLER_OPTION_ON=1 +grep -q 'ms-store=true' meson-logs/meson-log.txt && export STORE_OPTION_ON=1 +if [ "$GITLAB_CI" ] || [ "$INSTALLER_OPTION_ON" ] || [ "$STORE_OPTION_ON" ]; then + export PERFECT_BUNDLE=1 +fi + +## GIMP prefix: as set at meson configure time +export GIMP_PREFIX=$(echo $MESON_INSTALL_DESTDIR_PREFIX | sed 's|\\|/|g') +## System prefix: on Windows shell, it is manually set; on POSIX shell, it is set by crossroad +export MSYS_PREFIX=$(grep 'Main binary:' $MESON_BUILD_ROOT/meson-logs/meson-log.txt | sed 's|Main binary: ||' | sed 's|\\bin\\python.exe||' | sed 's|\\|/|g') +if [ "$CROSSROAD_PLATFORM" ]; then + export MSYS_PREFIX="$GIMP_PREFIX" +fi +## Bundle dir: normally, we make a quick bundling; on CI, we make a "perfect" bundling +export GIMP_DISTRIB="$GIMP_PREFIX" +if [ "$PERFECT_BUNDLE" ]; then + #NOTE: The bundling script need to set ARTIFACTS_SUFFIX to our dist scripts + #fallback code be able to identify what arch they are distributing + #https://github.com/msys2/MSYS2-packages/issues/4960 + if [[ "$MSYS_PREFIX" =~ "clangarm64" ]]; then + export ARTIFACTS_SUFFIX="a64" + elif [[ "$MSYS_PREFIX" =~ "clang64" ]] || [ "$CROSSROAD_PLATFORM" = "w64" ]; then + export ARTIFACTS_SUFFIX="x64" + else # [ "$MSYS_PREFIX" =~ "mingw32" ]; + export ARTIFACTS_SUFFIX="x86" + fi + export GIMP_DISTRIB="$GIMP_SOURCE/gimp-${ARTIFACTS_SUFFIX}" fi -export GIMP_DISTRIB="`realpath ./gimp`${ARTIFACTS_SUFFIX}" bundle () { - check_recurse=${2##*/} - # Copy files with wildcards - if [[ "$check_recurse" =~ '*' ]] && [[ ! "$check_recurse" =~ '/' ]]; then - path_dest_parent=$(echo $1/${2%/*} | sed "s|${1}/||") - mkdir -p "$GIMP_DISTRIB/$path_dest_parent" - bundledArray=($(find $1/${2%/*} -maxdepth 1 -name ${2##*/})) - for path_origin_full2 in "${bundledArray[@]}"; do - echo "(INFO): copying $path_origin_full2 to $GIMP_DISTRIB/$path_dest_parent" - cp $path_origin_full2 "$GIMP_DISTRIB/$path_dest_parent" - done - # Copy specific file or specific folder - else - path_origin_full=$(echo $1/$2) - if [[ "$2" =~ '/' ]]; then - path_dest_parent=$(dirname $path_origin_full | sed "s|${1}/||") + limited_search_path=$(dirname $(echo $2 | sed "s|${2%%/*}/|$1/${2%%/*}/|g" | sed "s|*|no_scape|g")) + search_path=$(echo $(echo $limited_search_path | sed "s|no_scape|*|g")) + bundledArray=($(find "$search_path" -maxdepth 1 -name ${2##*/})) + for target_path in "${bundledArray[@]}"; do + bundled_path=$(echo $target_path | sed "s|$1/|$GIMP_DISTRIB/|g") + parent_path=$(dirname $bundled_path) + if [ "$1" != "$GIMP_PREFIX" ] || [ "$PERFECT_BUNDLE" ]; then + echo "Bundling $target_path to $parent_path" fi - if [ -d "$path_origin_full" ] || [ -f "$path_origin_full" ]; then - mkdir -p "$GIMP_DISTRIB/$path_dest_parent" - echo "(INFO): copying $path_origin_full to $GIMP_DISTRIB/$path_dest_parent" - cp -r "$path_origin_full" "$GIMP_DISTRIB/$path_dest_parent" - else - echo -e "\033[33m(WARNING)\033[0m: $path_origin_full does not exist!" - fi - fi + mkdir -p "$parent_path" + cp -fru "$target_path" $parent_path >/dev/null 2>&1 || continue + done } clean () { - if [[ "$2" =~ '/' ]]; then - cleanedArray=($(find $1/${2%/*} -iname ${2##*/})) - else - cleanedArray=($(find $1/ -iname ${2##*/})) - fi - for path_dest_full in "${cleanedArray[@]}"; do - if [[ "$path_dest_full" = "${cleanedArray[0]}" ]]; then - echo "(INFO): cleaning $1/$2" + if [ "$PERFECT_BUNDLE" ]; then + if [[ "$2" =~ '/' ]]; then + cleanedArray=($(find $1/${2%/*} -iname ${2##*/})) + else + cleanedArray=($(find $1/ -iname ${2##*/})) fi - rm $path_dest_full - done + for path_dest_full in "${cleanedArray[@]}"; do + if [[ "$path_dest_full" = "${cleanedArray[0]}" ]]; then + echo "Cleaning $1/$2" + fi + rm $path_dest_full + done + fi } ## Prevent Git going crazy mkdir -p $GIMP_DISTRIB -echo "*" > $GIMP_DISTRIB/.gitignore +if [ "$PERFECT_BUNDLE" ]; then + echo "*" > $GIMP_DISTRIB/.gitignore +fi -## Copy a previously built wrapper at tree root, less messy than -## having to look inside bin/, in the middle of all the DLLs. -## This also configure the interpreters for local builds as courtesy. -bundle "$GIMP_PREFIX" gimp.cmd +## Add a wrapper at tree root, less messy than having to look for the +## binary inside bin/, in the middle of all the DLLs. +gimp_app_version=$(grep GIMP_APP_VERSION $MESON_BUILD_ROOT/config.h | head -1 | sed 's/^.*"\([^"]*\)"$/\1/') +echo "bin\gimp-$gimp_app_version.exe" > $GIMP_DISTRIB/gimp.cmd ## Settings. -bundle "$GIMP_PREFIX" etc/gimp/ +bundle "$GIMP_PREFIX" etc/gimp ### Needed for fontconfig -bundle "$MSYS_PREFIX" etc/fonts/ +bundle "$MSYS_PREFIX" etc/fonts ## Headers (in evaluation): https://gitlab.gnome.org/GNOME/gimp/-/issues/6378. -#bundle $GIMP_PREFIX/include/gimp-*/ -#bundle $GIMP_PREFIX/include/babl-*/ -#bundle $GIMP_PREFIX/include/gegl-*/ +#bundle $GIMP_PREFIX/include/gimp-* +#bundle $GIMP_PREFIX/include/babl-* +#bundle $GIMP_PREFIX/include/gegl-* ## Library data. -bundle "$GIMP_PREFIX" lib/gimp/ -bundle "$GIMP_PREFIX" lib/babl-*/ -bundle "$GIMP_PREFIX" lib/gegl-*/ -bundle "$MSYS_PREFIX" lib/gio/ +bundle "$GIMP_PREFIX" lib/gimp +bundle "$GIMP_PREFIX" lib/babl-* +bundle "$GIMP_PREFIX" lib/gegl-* +bundle "$MSYS_PREFIX" lib/gio bundle "$MSYS_PREFIX" lib/gdk-pixbuf-*/*/loaders.cache bundle "$MSYS_PREFIX" lib/gdk-pixbuf-*/*/loaders/libpixbufloader-png.dll -bundle "$MSYS_PREFIX" lib/gdk-pixbuf-*/*/loaders/libpixbufloader-svg.dll +bundle "$MSYS_PREFIX" lib/gdk-pixbuf-*/*/loaders/pixbufloader_svg.dll clean "$GIMP_DISTRIB" lib/*.a ## Resources. -bundle "$GIMP_PREFIX" share/gimp/ +bundle "$GIMP_PREFIX" share/gimp ### Needed for file dialogs bundle "$MSYS_PREFIX" share/glib-*/schemas/gschemas.compiled ### https://gitlab.gnome.org/GNOME/gimp/-/issues/6165 -bundle "$MSYS_PREFIX" share/icons/Adwaita/ +bundle "$MSYS_PREFIX" share/icons/Adwaita ### https://gitlab.gnome.org/GNOME/gimp/-/issues/5080 -bundle "$GIMP_PREFIX" share/icons/hicolor/ +bundle "$GIMP_PREFIX" share/icons/hicolor ### Needed for file-wmf work -bundle "$MSYS_PREFIX" share/libwmf/ +bundle "$MSYS_PREFIX" share/libwmf ### Only copy from langs supported in GIMP. -lang_array=($(echo $(ls po/*.po | - sed -e 's|po/||g' -e 's|.po||g' | sort) | +lang_array=($(echo $(ls $GIMP_SOURCE/po/*.po | + sed -e "s|$GIMP_SOURCE/po/||g" -e 's|.po||g' | sort) | tr '\n\r' ' ')) for lang in "${lang_array[@]}"; do bundle "$GIMP_PREFIX" share/locale/$lang/LC_MESSAGES/*.mo @@ -154,9 +145,9 @@ done ### Needed for welcome page bundle "$GIMP_PREFIX" share/metainfo/org.gimp*.xml ### mypaint brushes -bundle "$MSYS_PREFIX" share/mypaint-data/ +bundle "$MSYS_PREFIX" share/mypaint-data ### Needed for full CJK and Cyrillic support in file-pdf -bundle "$MSYS_PREFIX" share/poppler/ +bundle "$MSYS_PREFIX" share/poppler ## Executables and DLLs. @@ -166,6 +157,7 @@ rm -f done-dll.list ### Minimal (and some additional) executables for the 'bin' folder bundle "$GIMP_PREFIX" bin/gimp*.exe +bundle "$GIMP_PREFIX" bin/libgimp*.dll ### https://gitlab.gnome.org/GNOME/gimp/-/issues/10580 bundle "$GIMP_PREFIX" bin/gegl*.exe ### https://gitlab.gnome.org/GNOME/gimp/-/issues/6045 @@ -175,16 +167,16 @@ bundle "$MSYS_PREFIX" bin/gdbus.exe ### Optional binaries for GObject Introspection support if [ "$CI_JOB_NAME" != 'gimp-win-x64-cross' ]; then - bundle "$GIMP_PREFIX" lib/girepository-*/ - bundle "$MSYS_PREFIX" lib/girepository-*/ + bundle "$GIMP_PREFIX" lib/girepository-* + bundle "$MSYS_PREFIX" lib/girepository-* # https://gitlab.gnome.org/GNOME/gimp/-/issues/11597 #bundle "$MSYS_PREFIX" bin/luajit.exe - #bundle "$MSYS_PREFIX" lib/lua/ - #bundle "$MSYS_PREFIX" share/lua/ + #bundle "$MSYS_PREFIX" lib/lua + #bundle "$MSYS_PREFIX" share/lua bundle "$MSYS_PREFIX" bin/python*.exe - bundle "$MSYS_PREFIX" lib/python*/ + bundle "$MSYS_PREFIX" lib/python* clean "$GIMP_DISTRIB" lib/python*/*.pyc else # Just to ensure there is no introspected files that will output annoying warnings @@ -195,16 +187,16 @@ else clean "$GIMP_DISTRIB" *.vala fi -### Deps (DLLs) of the binaries in 'lib' and 'bin' dirs -echo "(INFO): searching for dependencies of $GIMP_DISTRIB/lib in $GIMP_PREFIX and $MSYS_PREFIX" -libArray=($(find "$GIMP_DISTRIB/lib" \( -iname '*.dll' -or -iname '*.exe' \))) -for dep in "${libArray[@]}"; do - python3 build/windows/2_bundle-gimp-uni_dep.py $dep $GIMP_PREFIX/ $MSYS_PREFIX/ $GIMP_DISTRIB --output-dll-list done-dll.list; -done -echo "(INFO): searching for dependencies of $GIMP_DISTRIB/bin in $GIMP_PREFIX and $MSYS_PREFIX" +### Deps (DLLs) of the binaries in 'bin' and 'lib' dirs +echo "Searching for dependencies of $GIMP_DISTRIB/bin in $MSYS_PREFIX and $GIMP_PREFIX" binArray=($(find "$GIMP_DISTRIB/bin" \( -iname '*.dll' -or -iname '*.exe' \))) for dep in "${binArray[@]}"; do - python3 build/windows/2_bundle-gimp-uni_dep.py $dep $GIMP_PREFIX/ $MSYS_PREFIX/ $GIMP_DISTRIB --output-dll-list done-dll.list; + python3 $GIMP_SOURCE/build/windows/2_bundle-gimp-uni_dep.py $dep $MSYS_PREFIX/ $GIMP_PREFIX/ $GIMP_DISTRIB --output-dll-list done-dll.list; +done +echo "Searching for dependencies of $GIMP_DISTRIB/lib in $MSYS_PREFIX and $GIMP_PREFIX" +libArray=($(find "$GIMP_DISTRIB/lib" \( -iname '*.dll' -or -iname '*.exe' \))) +for dep in "${libArray[@]}"; do + python3 $GIMP_SOURCE/build/windows/2_bundle-gimp-uni_dep.py $dep $MSYS_PREFIX/ $GIMP_PREFIX/ $GIMP_DISTRIB --output-dll-list done-dll.list; done ### .pdb (CodeView) debug symbols @@ -212,8 +204,3 @@ done #if [ "$CI_JOB_NAME" != "gimp-win-x64-cross" ]; then # cp -fr ${GIMP_PREFIX}/bin/*.pdb ${GIMP_DISTRIB}/bin/ #fi - - -# Delete wrapper to prevent contributors from running a -# relocatable build expecting it to work non-relocatable -rm -r $GIMP_PREFIX/gimp.cmd diff --git a/build/windows/2_bundle-gimp-uni_dep.py b/build/windows/2_bundle-gimp-uni_dep.py index 243e21c203..99712d896f 100644 --- a/build/windows/2_bundle-gimp-uni_dep.py +++ b/build/windows/2_bundle-gimp-uni_dep.py @@ -147,7 +147,7 @@ def copy_dlls(dll_list, srcdirs, destdir): for srcdir in srcdirs: full_file_name = os.path.join(srcdir, bindir, dll) if os.path.isfile(full_file_name): - sys.stdout.write("(INFO): copying {} to {}\n".format(full_file_name, destbin)) + sys.stdout.write("Bundling {} to {}\n".format(full_file_name, destbin)) shutil.copy(full_file_name, destbin) break else: diff --git a/build/windows/all-deps-uni.txt b/build/windows/all-deps-uni.txt index 7f7ed0d514..92734b98db 100644 --- a/build/windows/all-deps-uni.txt +++ b/build/windows/all-deps-uni.txt @@ -47,5 +47,4 @@ ${MINGW_PACKAGE_PREFIX}-python-gobject \ ${MINGW_PACKAGE_PREFIX}-qoi \ ${MINGW_PACKAGE_PREFIX}-shared-mime-info \ ${MINGW_PACKAGE_PREFIX}-suitesparse \ -${MINGW_PACKAGE_PREFIX}-vala \ ${MINGW_PACKAGE_PREFIX}-xpm-nox diff --git a/build/windows/installer/3_dist-gimp-inno.ps1 b/build/windows/installer/3_dist-gimp-inno.ps1 index 4f13aa2f0c..2835fe878e 100644 --- a/build/windows/installer/3_dist-gimp-inno.ps1 +++ b/build/windows/installer/3_dist-gimp-inno.ps1 @@ -9,7 +9,7 @@ param ($revision = '0', $GIMPA64 = 'gimp-a64') # This script needs a bit of MSYS2 to work -$Env:CHERE_INVOKING = "yes" +Invoke-Expression ((Get-Content build\windows\1_build-deps-msys2.ps1 | Select-String 'MSYS2_PREFIX =' -Context 0,17) -replace '> ','') # 1. GET INNO @@ -42,7 +42,7 @@ Set-Alias iscc "$INNO_PATH\iscc.exe" $CONFIG_PATH = "$BUILD_DIR\config.h" if (-not (Test-Path "$CONFIG_PATH")) { - Write-Host "(ERROR): config.h file not found. You can run 'build/windows/2_build-gimp-msys2.sh --relocatable' or configure GIMP with 'meson setup' on some MSYS2 shell to generate it.'" -ForegroundColor red + Write-Host "(ERROR): config.h file not found. You can run 'build/windows/2_build-gimp-msys2.ps1' or configure GIMP to generate it.'" -ForegroundColor red exit 1 } @@ -88,7 +88,7 @@ Write-Output "(INFO): Arch: universal (x86, x64 and arm64)" # 3. PREPARE INSTALLER "SOURCE" if (-not (Test-Path "$BUILD_DIR\build\windows\installer")) { - Write-Host "(ERROR): Installer assets not found. You can run 'build/windows/2_build-gimp-msys2.sh --relocatable' or configure GIMP with '-Dwindows-installer=true' on some MSYS2 shell to build them." -ForegroundColor red + Write-Host "(ERROR): Installer assets not found. You can tweak 'build/windows/2_build-gimp-msys2.ps1' or configure GIMP with '-Dwindows-installer=true' to build them." -ForegroundColor red exit 1 } @@ -123,7 +123,7 @@ function fix_msg ([string]$langsdir) Set-Location $langsdir (Get-Content fix_msg.sh) | Foreach-Object {$_ -replace "AppVer","$APPVER"} | Set-Content fix_msg.sh - C:\msys64\usr\bin\bash -lc "bash fix_msg.sh" + bash fix_msg.sh Remove-Item fix_msg.sh Set-Location $GIMP_BASE @@ -160,24 +160,9 @@ if ($GITLAB_CI) } } -## FIXME: We can't do this on CI -if (-not $GITLAB_CI) - { - Write-Output "(INFO): extracting .debug symbols from bundles" - - #$Env:MSYSTEM = "MINGW32" - #C:\msys64\usr\bin\bash -lc 'bash build/windows/installer/3_dist-gimp-inno_sym.sh' | Out-Null - - if ($Env:PROCESSOR_ARCHITECTURE -eq 'ARM64') - { - $Env:MSYSTEM = "CLANGARM64" - } - else - { - $Env:MSYSTEM = "CLANG64" - } - C:\msys64\usr\bin\bash -lc 'bash build/windows/installer/3_dist-gimp-inno_sym.sh' | Out-Null - } +## Split .debug symbols +Write-Output "(INFO): extracting .debug symbols from bundles" +bash build/windows/installer/3_dist-gimp-inno_sym.sh | Out-Null # 5. CONSTRUCT .EXE INSTALLER diff --git a/build/windows/installer/3_dist-gimp-inno_sym.sh b/build/windows/installer/3_dist-gimp-inno_sym.sh index d9df51f603..6ad1f7469b 100644 --- a/build/windows/installer/3_dist-gimp-inno_sym.sh +++ b/build/windows/installer/3_dist-gimp-inno_sym.sh @@ -1,6 +1,6 @@ #!/bin/bash -if [ "$MSYSTEM_CARCH" != 'i686' ]; then +if [ "$MSYSTEM_PREFIX" != 'mingw32' ]; then archsArray=('-a64' '-x64') else diff --git a/build/windows/store/3_dist-gimp-winsdk.ps1 b/build/windows/store/3_dist-gimp-winsdk.ps1 index 5627eeea58..3b4c225791 100644 --- a/build/windows/store/3_dist-gimp-winsdk.ps1 +++ b/build/windows/store/3_dist-gimp-winsdk.ps1 @@ -30,7 +30,7 @@ Set-Alias 'signtool' "$win_sdk_path\signtool.exe" $config_path = "$build_dir\config.h" if (-not (Test-Path "$config_path")) { - Write-Host "(ERROR): config.h file not found. You can run 'build/windows/2_build-gimp-msys2.sh --relocatable' or configure GIMP with 'meson setup' on some MSYS2 shell to generate it." -ForegroundColor red + Write-Host "(ERROR): config.h file not found. You can run 'build/windows/2_build-gimp-msys2.ps1' or configure GIMP to generate it." -ForegroundColor red exit 1 } @@ -107,7 +107,7 @@ Write-Output "(INFO): Identity: $IDENTITY_NAME | Version: $CUSTOM_GIMP_VERSION ( # Autodetects what arch bundles will be packaged if (-not (Test-Path "$a64_bundle") -and -not (Test-Path "$x64_bundle")) { - Write-Host "(ERROR): No bundle found. You can run 'build/windows/2_build-gimp-msys2.sh --relocatable' on some MSYS2 shell to make one." -ForegroundColor red + Write-Host "(ERROR): No bundle found. You can tweak 'build/windows/2_build-gimp-msys2.ps1' or configure GIMP with '-Dms-store=true' to make one." -ForegroundColor red exit 1 } elseif ((Test-Path "$a64_bundle") -and -not (Test-Path "$x64_bundle")) @@ -203,7 +203,7 @@ foreach ($bundle in $supported_archs) $icons_path = "$build_dir\build\windows\store\Assets" if (-not (Test-Path "$icons_path")) { - Write-Host "(ERROR): MS Store icons not found. You can run 'build/windows/2_build-gimp-msys2.sh --relocatable' or configure GIMP with '-Dms-store=true' on some MSYS2 shell to build them." -ForegroundColor red + Write-Host "(ERROR): MS Store icons not found. You can tweak 'build/windows/2_build-gimp-msys2.ps1' or configure GIMP with '-Dms-store=true' to build them." -ForegroundColor red exit 1 } Write-Output "(INFO): generating resources.pri from $icons_path" diff --git a/gimp-data b/gimp-data index 31009e305c..da582e7e04 160000 --- a/gimp-data +++ b/gimp-data @@ -1 +1 @@ -Subproject commit 31009e305c101967c7e274e31dee364b47f2beb8 +Subproject commit da582e7e041689014fd175e39f10b7a7d32d526c diff --git a/meson.build b/meson.build index e66841f9fb..1e6902f31c 100644 --- a/meson.build +++ b/meson.build @@ -1929,6 +1929,9 @@ if meson.can_run_host_binaries() and have_gobject_introspection gimp_run_env.append('GIMP_TESTING_INTERPRETER_DIRS', meson.global_build_root() / 'extensions/') gimp_run_env.set('GIMP_TESTING_ENVIRON_DIRS', meson.global_source_root() / 'data/environ/') + # Makes build errors output way less polluted, making easier to debug + gimp_run_env.set('GIMP3_LOCALEDIR', meson.global_build_root() / 'po-plug-ins') + gimp_run_env.prepend('GI_TYPELIB_PATH', prefix / 'lib/girepository-1.0/') if platform_osx gimp_run_env.prepend('GI_TYPELIB_PATH', meson.global_build_root() / 'libgimp/tmp') @@ -2077,6 +2080,12 @@ pkgconfig.generate(libgimpui, # meson.add_install_script(install_win_debug_script) #endif +# On Windows, install deps making a bundle in the prefix +if platform_windows and relocatable_bundle + install_win_bundling_script = find_program('build/windows/2_bundle-gimp-uni_base.sh') + meson.add_install_script(install_win_bundling_script) +endif + ################################################################################ # Subdir installations diff --git a/pdb/meson.build b/pdb/meson.build index f2c6a9b0dd..9f9a196df7 100644 --- a/pdb/meson.build +++ b/pdb/meson.build @@ -75,17 +75,17 @@ enum_headers = [ ] # Perl environment -perlsrcdir = meson.current_source_dir() -perlbindir = meson.current_build_dir() +perlsrcdir = meson.current_source_dir().replace('\\', '/') +perlbindir = meson.current_build_dir().replace('\\', '/') perl_env = [ 'PDBGEN_BACKUP=' + (pdbgen_backup ? '1' : '0'), 'PDBGEN_GROUPS=' + (pdbgen_groups ? '1' : '0'), 'rootme=' + perlbindir, 'srcdir=' + perlsrcdir, - 'destdir=' + meson.project_build_root(), - 'builddir=' + meson.project_build_root(), - 'topsrcdir=' + meson.project_source_root(), + 'destdir=' + meson.project_build_root().replace('\\', '/'), + 'builddir=' + meson.project_build_root().replace('\\', '/'), + 'topsrcdir=' + meson.project_source_root().replace('\\', '/'), ] groups_pl_content = '# This file is autogenerated\n'