diff --git a/build/windows/2_build-gimp-msys2.ps1 b/build/windows/2_build-gimp-msys2.ps1 index 0e3a744fe5..bdfacf3c5f 100644 --- a/build/windows/2_build-gimp-msys2.ps1 +++ b/build/windows/2_build-gimp-msys2.ps1 @@ -17,6 +17,8 @@ if (-not $GITLAB_CI) } git submodule update --init + + $NON_RELOCATABLE_OPTION = '-Drelocatable-bundle=no' } @@ -50,7 +52,7 @@ if (-not (Test-Path _build\build.ninja -Type Leaf)) #There is no GJS for Windows. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/5891 meson setup _build -Dprefix="$GIMP_PREFIX" -Djavascript=disabled ` -Ddirectx-sdk-dir="$MSYS2_PREFIX/$MSYSTEM_PREFIX" -Denable-default-bin=enabled ` - -Dbuild-id='org.gimp.GIMP_official' $INSTALLER_OPTION $STORE_OPTION + -Dbuild-id='org.gimp.GIMP_official' $INSTALLER_OPTION $STORE_OPTION $NON_RELOCATABLE_OPTION } Set-Location _build ninja diff --git a/build/windows/2_bundle-gimp-uni_base.sh b/build/windows/2_bundle-gimp-uni_base.sh index d072ba762b..2a9f947f3f 100644 --- a/build/windows/2_bundle-gimp-uni_base.sh +++ b/build/windows/2_bundle-gimp-uni_base.sh @@ -4,7 +4,7 @@ set -e 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." + echo -e "\033[31m(ERROR)\033[0m: Script called standalone. Please, build GIMP targeting installer or msix creation and this script will be called automatically." exit 1 fi @@ -31,34 +31,25 @@ else gimp_mutex_version=$(echo $gimp_app_version | sed 's/^[^0-9]*\([0-9]*\).*$/\1/') fi -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 +## System prefix: on Windows, it is MSYSTEM_PREFIX; on Linux it is set by crossroad export MSYS_PREFIX=$(grep 'Main binary:' 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" + export MSYS_PREFIX="$CROSSROAD_PREFIX/../msys2" 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}" +## Bundle dir: we make a "perfect" bundle separated from GIMP_PREFIX +#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}" bundle () { @@ -73,9 +64,7 @@ bundle () 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 + echo "Bundling $target_path to $parent_path" mkdir -p "$parent_path" cp -fru "$target_path" $parent_path >/dev/null 2>&1 || continue done @@ -86,27 +75,23 @@ bundle () clean () { - if [ "$PERFECT_BUNDLE" ]; then - 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 "Cleaning $1/$2" - fi - rm $path_dest_full - done + 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 "Cleaning $1/$2" + fi + rm $path_dest_full + done } ## Prevent Git going crazy mkdir -p $GIMP_DISTRIB -if [ "$PERFECT_BUNDLE" ]; then - echo "*" > $GIMP_DISTRIB/.gitignore -fi +echo "*" > $GIMP_DISTRIB/.gitignore ## Add a wrapper at tree root, less messy than having to look for the ## binary inside bin/, in the middle of all the DLLs. diff --git a/meson.build b/meson.build index 44932ffaa5..e1b7450805 100644 --- a/meson.build +++ b/meson.build @@ -2128,8 +2128,8 @@ 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 +# On Windows, install deps in a bundle before distributing +if get_option('windows-installer') or get_option('ms-store') install_win_bundling_script = find_program('build/windows/2_bundle-gimp-uni_base.sh') meson.add_install_script(install_win_bundling_script) endif