build/windows: Reorder Win bundling script to be consistent with AppImage

The AppImage script organization is way more clear to understand what is
needed to make a GIMP bundle so let's reproduce here with adaptations.
This commit is contained in:
Bruno Lopes 2025-08-13 21:11:57 -03:00
parent 03172b7196
commit ff157df094
No known key found for this signature in database

View file

@ -75,7 +75,7 @@ def clean(base_path, pattern):
path.unlink()
## Prepare bundle
## PREPARE BUNDLE
GIMP_DISTRIB.mkdir(parents=True, exist_ok=True)
### Prevent Git going crazy
(GIMP_DISTRIB / ".gitignore").write_text("*\n")
@ -90,8 +90,86 @@ with open("config.h") as file:
(GIMP_DISTRIB / "gimp.cmd").write_text(f"powershell bin\\gimp-{os.getenv('GIMP_MUTEX_VERSION')}.exe\n")
## Settings.
## BUNDLE BASE (BARE MINIMUM TO RUN GTK APPS).
### Needed to not pollute output. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/8877
bundle(MSYSTEM_PREFIX, "bin/gdbus.exe")
### Needed for hyperlink support etc... See: https://gitlab.gnome.org/GNOME/gimp/-/issues/12288
####...when running from `gimp*.exe --verboses`
bundle(MSYSTEM_PREFIX, "bin/gspawn*-console.exe")
if not os.getenv("GIMP_UNSTABLE") and os.getenv("GIMP_RELEASE"):
####...when running from `gimp*.exe`
bundle(MSYSTEM_PREFIX, "bin/gspawn*-helper.exe")
### Needed for file dialogs (only .compiled file is needed on MS Windows)
bundle(MSYSTEM_PREFIX, "share/glib-*/schemas/gschemas.compiled")
### Needed to open remote files
bundle(MSYSTEM_PREFIX, "lib/gio")
### Needed to not crash UI. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/6165
bundle(MSYSTEM_PREFIX, "share/icons/Adwaita")
### Needed by GTK to use icon themes. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/5080
bundle(GIMP_PREFIX, "share/icons/hicolor")
### Needed to loading icons in GUI
bundle(MSYSTEM_PREFIX, "lib/gdk-pixbuf-*/*/loaders.cache")
bundle(MSYSTEM_PREFIX, "lib/gdk-pixbuf-*/*/loaders/libpixbufloader-png.dll")
bundle(MSYSTEM_PREFIX, "lib/gdk-pixbuf-*/*/loaders/pixbufloader_svg.dll")
## CORE FEATURES.
bundle(GIMP_PREFIX, "bin/libgimp*.dll")
bundle(GIMP_PREFIX, "lib/gimp")
bundle(GIMP_PREFIX, "lib/babl-*")
bundle(GIMP_PREFIX, "lib/gegl-*")
bundle(GIMP_PREFIX, "share/gimp")
lang_array = [Path(f).stem for f in glob(str(Path(GIMP_SOURCE)/"po/*.po"))]
for lang in lang_array:
bundle(GIMP_PREFIX, f"share/locale/{lang}/LC_MESSAGES/*.mo")
if (Path(MSYSTEM_PREFIX)/f"share/locale/{lang}/LC_MESSAGES").exists():
# Needed for eventually used widgets, GTK inspector etc
bundle(MSYSTEM_PREFIX, f"share/locale/{lang}/LC_MESSAGES/gtk*.mo")
# For language list in text tool options
bundle(MSYSTEM_PREFIX, f"share/locale/{lang}/LC_MESSAGES/iso_639_3.mo")
bundle(GIMP_PREFIX, "etc/gimp")
## OTHER FEATURES AND PLUG-INS.
### mypaint brushes
bundle(MSYSTEM_PREFIX, "share/mypaint-data/2.0")
### Needed for 'th' word breaking in Text tool etc
bundle(MSYSTEM_PREFIX, "share/libthai")
### Needed for full CJK and Cyrillic support in file-pdf
bundle(MSYSTEM_PREFIX, "share/poppler")
### Needed for file-wmf work
bundle(MSYSTEM_PREFIX, "share/libwmf")
### Needed for 'Show image graph'.
### Note: we want the same test as around the global variable
### show_debug_menu in app/main.c
if (os.getenv("GIMP_UNSTABLE") or not os.getenv("GIMP_RELEASE")) and "32" not in MSYSTEM_PREFIX:
#### See: https://gitlab.gnome.org/GNOME/gimp/-/issues/6045
bundle(MSYSTEM_PREFIX, "bin/dot.exe")
#### See: https://gitlab.gnome.org/GNOME/gimp/-/issues/12119
bundle(MSYSTEM_PREFIX, "bin/libgvplugin_dot*.dll")
bundle(MSYSTEM_PREFIX, "bin/libgvplugin_pango*.dll")
bundle(MSYSTEM_PREFIX, "bin/config6")
### Binaries for GObject Introspection support. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/13170
bundle(GIMP_PREFIX, "lib/girepository-*/*.typelib")
bundle(MSYSTEM_PREFIX, "bin/libgirepository-*.dll")
#### Python support
#####python.exe is needed for plug-ins output in `gimp-console*.exe`
bundle(MSYSTEM_PREFIX, "bin/python.exe")
if not os.getenv("GIMP_UNSTABLE") and os.getenv("GIMP_RELEASE"):
#####pythonw.exe is needed to run plug-ins silently in `gimp*.exe`
bundle(MSYSTEM_PREFIX, "bin/pythonw.exe")
bundle(MSYSTEM_PREFIX, "lib/python*")
clean(GIMP_DISTRIB, "lib/python*/*.pyc")
#### FIXME: luajit crashes at startup: See: https://gitlab.gnome.org/GNOME/gimp/-/issues/11597
#bundle(MSYSTEM_PREFIX, "bin/luajit.exe")
#bundle(MSYSTEM_PREFIX, "lib/lua")
#bundle(MSYSTEM_PREFIX, "share/lua")
### Support for legacy Win clipboard images: https://gitlab.gnome.org/GNOME/gimp/-/issues/4802
bundle(MSYSTEM_PREFIX, "lib/gdk-pixbuf-*/*/loaders/libpixbufloader-bmp.dll")
### Support for non .PAT patterns: https://gitlab.gnome.org/GNOME/gimp/-/issues/12351
bundle(MSYSTEM_PREFIX, "lib/gdk-pixbuf-*/*/loaders/libpixbufloader-jpeg.dll")
bundle(MSYSTEM_PREFIX, "lib/gdk-pixbuf-*/*/loaders/libpixbufloader-gif.dll")
bundle(MSYSTEM_PREFIX, "lib/gdk-pixbuf-*/*/loaders/libpixbufloader-tiff.dll")
### Needed for fontconfig
bundle(MSYSTEM_PREFIX, "etc/fonts")
#### Avoid other programs breaking the cache. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/1366
@ -104,92 +182,11 @@ new_text = text.replace(
fonts_conf.write_text(new_text)
## Library data.
bundle(GIMP_PREFIX, "lib/gimp")
bundle(GIMP_PREFIX, "lib/babl-*")
bundle(GIMP_PREFIX, "lib/gegl-*")
### Needed to open remote files
bundle(MSYSTEM_PREFIX, "lib/gio")
### Needed to loading icons in GUI
bundle(MSYSTEM_PREFIX, "lib/gdk-pixbuf-*/*/loaders.cache")
bundle(MSYSTEM_PREFIX, "lib/gdk-pixbuf-*/*/loaders/libpixbufloader-png.dll")
bundle(MSYSTEM_PREFIX, "lib/gdk-pixbuf-*/*/loaders/pixbufloader_svg.dll")
### Support for legacy Win clipboard images: https://gitlab.gnome.org/GNOME/gimp/-/issues/4802
bundle(MSYSTEM_PREFIX, "lib/gdk-pixbuf-*/*/loaders/libpixbufloader-bmp.dll")
### Support for non .PAT patterns: https://gitlab.gnome.org/GNOME/gimp/-/issues/12351
bundle(MSYSTEM_PREFIX, "lib/gdk-pixbuf-*/*/loaders/libpixbufloader-jpeg.dll")
bundle(MSYSTEM_PREFIX, "lib/gdk-pixbuf-*/*/loaders/libpixbufloader-gif.dll")
bundle(MSYSTEM_PREFIX, "lib/gdk-pixbuf-*/*/loaders/libpixbufloader-tiff.dll")
## Resources.
bundle(GIMP_PREFIX, "share/gimp")
### Needed for file dialogs (only .compiled file is needed on MS Windows)
bundle(MSYSTEM_PREFIX, "share/glib-*/schemas/gschemas.compiled")
### Needed to not crash UI. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/6165
bundle(MSYSTEM_PREFIX, "share/icons/Adwaita")
### Needed by GTK to use icon themes. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/5080
bundle(GIMP_PREFIX, "share/icons/hicolor")
### Needed for 'th' word breaking in Text tool etc
bundle(MSYSTEM_PREFIX, "share/libthai")
### Needed for file-wmf work
bundle(MSYSTEM_PREFIX, "share/libwmf")
### Only copy from langs supported in GIMP.
lang_array = [Path(f).stem for f in glob(str(Path(GIMP_SOURCE)/"po/*.po"))]
for lang in lang_array:
bundle(GIMP_PREFIX, f"share/locale/{lang}/LC_MESSAGES/*.mo")
if (Path(MSYSTEM_PREFIX)/f"share/locale/{lang}/LC_MESSAGES").exists():
# Needed for eventually used widgets, GTK inspector etc
bundle(MSYSTEM_PREFIX, f"share/locale/{lang}/LC_MESSAGES/gtk*.mo")
# For language list in text tool options
bundle(MSYSTEM_PREFIX, f"share/locale/{lang}/LC_MESSAGES/iso_639_3.mo")
### mypaint brushes
bundle(MSYSTEM_PREFIX, "share/mypaint-data/2.0")
### Needed for full CJK and Cyrillic support in file-pdf
bundle(MSYSTEM_PREFIX, "share/poppler")
## Executables and DLLs.
## MAIN EXECUTABLES AND DEPENDENCIES
### Minimal (and some additional) executables for the 'bin' folder
bundle(GIMP_PREFIX, "bin/gimp*.exe")
bundle(GIMP_PREFIX, "bin/libgimp*.dll")
### Bundled just to promote GEGL. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/10580
bundle(GIMP_PREFIX, "bin/gegl.exe")
# Note: we want the same test as around the global variable
# show_debug_menu in app/main.c
if (os.getenv("GIMP_UNSTABLE") or not os.getenv("GIMP_RELEASE")) and "32" not in MSYSTEM_PREFIX:
### Needed for 'Show image graph'.
#### See: https://gitlab.gnome.org/GNOME/gimp/-/issues/6045
bundle(MSYSTEM_PREFIX, "bin/dot.exe")
#### See: https://gitlab.gnome.org/GNOME/gimp/-/issues/12119
bundle(MSYSTEM_PREFIX, "bin/libgvplugin_dot*.dll")
bundle(MSYSTEM_PREFIX, "bin/libgvplugin_pango*.dll")
bundle(MSYSTEM_PREFIX, "bin/config6")
### Needed to not pollute output. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/8877
bundle(MSYSTEM_PREFIX, "bin/gdbus.exe")
### Needed for hyperlink support etc... See: https://gitlab.gnome.org/GNOME/gimp/-/issues/12288
#...when running from `gimp*.exe --verbose`
bundle(MSYSTEM_PREFIX, "bin/gspawn*-console.exe")
if not os.getenv("GIMP_UNSTABLE") and os.getenv("GIMP_RELEASE"):
#...when running from `gimp*.exe`
bundle(MSYSTEM_PREFIX, "bin/gspawn*-helper.exe")
## Binaries for GObject Introspection support. See: https://gitlab.gnome.org/GNOME/gimp/-/issues/13170
bundle(GIMP_PREFIX, "lib/girepository-*/*.typelib")
bundle(MSYSTEM_PREFIX, "bin/libgirepository-*.dll")
### Python support
#python.exe is needed for plug-ins output in `gimp-console*.exe`
bundle(MSYSTEM_PREFIX, "bin/python.exe")
if not os.getenv("GIMP_UNSTABLE") and os.getenv("GIMP_RELEASE"):
#pythonw.exe is needed to run plug-ins silently in `gimp*.exe`
bundle(MSYSTEM_PREFIX, "bin/pythonw.exe")
bundle(MSYSTEM_PREFIX, "lib/python*")
clean(GIMP_DISTRIB, "lib/python*/*.pyc")
### FIXME: luajit crashes at startup: See: https://gitlab.gnome.org/GNOME/gimp/-/issues/11597
#bundle(MSYSTEM_PREFIX, "bin/luajit.exe")
#bundle(MSYSTEM_PREFIX, "lib/lua")
#bundle(MSYSTEM_PREFIX, "share/lua")
### We save the list of already copied DLLs to keep a state between 2_bundle-gimp-uni_dep runs.
done_dll = Path(f"{os.getenv('MESON_BUILD_ROOT')}/done-dll.list")
done_dll.unlink(missing_ok=True)
@ -205,7 +202,8 @@ for dir in ["bin", "lib"]:
str(GIMP_DISTRIB), "--output-dll-list", done_dll.as_posix()
], check=True)
### .pdb (CodeView) debug symbols from babl, gegl and GIMP binaries
## .PDB/CODEVIEW DEBUG SYMBOLS (from babl, gegl and GIMP binaries)
bundle(GIMP_PREFIX, "bin/*.pdb")
### Remove .pdb without corresponding binaries (depends on what was choosen to be bundled above)
files = os.listdir(GIMP_DISTRIB / "bin")
@ -227,7 +225,7 @@ for bin_path in GIMP_DISTRIB.rglob("*"):
continue
## Development files (to build GEGL filters and GIMP plug-ins).
## DEVELOPMENT FILES (to build GEGL filters and GIMP plug-ins).
clean(GIMP_DISTRIB, "lib/*.a")
bundle(GIMP_PREFIX, "include/gimp-*")
bundle(GIMP_PREFIX, "include/babl-*")