From d5f41b296bf7135b38f014af85938e198868562d Mon Sep 17 00:00:00 2001 From: Bruno Lopes Date: Sun, 17 Dec 2023 11:06:22 -0300 Subject: [PATCH] build/windows, data, extensions, plug-ins: Fix Build omissions - Fix "no icons" errors generating loaders.cache with .cmd (CI-Cross). ! This is a sub-optimal fix, but it's better than a useless build. - Fix "no interpreter" errors generating .interp with Meson (CI-Native) and generating .interp and copying .typelib with .cmd (Local-Native). ! This is a sub-optimal fix to Local-Native, but plug-ins will work. - Fix "no iso" error copying iso_639.xml with Meson (Local-Native). --- .../gitlab-ci/1_build-deps-crossroad.sh | 45 ++++++++--- .../gitlab-ci/2_build-gimp-crossroad.sh | 16 ++++ build/windows/gitlab-ci/2_build-gimp-msys2.sh | 50 ++++++++++++- data/meson.build | 8 ++ extensions/lua.interp.in | 5 ++ extensions/meson.build | 14 ++++ plug-ins/python/meson.build | 6 +- plug-ins/python/pygimp.interp.in | 8 +- .../gimp-script-fu-interpreter.interp.in | 4 + plug-ins/script-fu/meson.build | 75 +++++++++++-------- 10 files changed, 181 insertions(+), 50 deletions(-) create mode 100644 extensions/lua.interp.in create mode 100644 plug-ins/script-fu/gimp-script-fu-interpreter.interp.in diff --git a/build/windows/gitlab-ci/1_build-deps-crossroad.sh b/build/windows/gitlab-ci/1_build-deps-crossroad.sh index b9850fcbf7..9395679acd 100644 --- a/build/windows/gitlab-ci/1_build-deps-crossroad.sh +++ b/build/windows/gitlab-ci/1_build-deps-crossroad.sh @@ -42,14 +42,41 @@ if [ $? -ne 0 ]; then exit 1; fi +# Build (part of) GIMP if [ "x$CROSSROAD_PLATFORM" = "xw64" ]; then - # Generate the loaders.cache file for GUI image support. - # Note: this is mostly for distribution so I initially wanted to - # have these in "win64-nightly" job but "win32-nightly" also - # requires the same file (and I fail to install wine32) whereas - # Gitlab "needs" field requires jobs to be from a prior stage. So I - # generate this here, with dependencies. - wine ${CROSSROAD_PREFIX}/bin/gdk-pixbuf-query-loaders.exe ${CROSSROAD_PREFIX}/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.dll > ${CROSSROAD_PREFIX}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache - sed -i "s&$CROSSROAD_PREFIX/&&" ${CROSSROAD_PREFIX}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache - sed -i '/.dll\"/s*/*\\\\*g' ${CROSSROAD_PREFIX}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache + ## Generator of the gio 'giomodule.cache' to fix error about + ## libgiognutls.dll that prevents generating loaders.cache + gio='' + gio+="libgiognomeproxy.dll: gio-proxy-resolver\n" + gio+="libgiognutls.dll: gio-tls-backend\n" + gio+="libgiolibproxy.dll: gio-proxy-resolver\n" + gio+="libgioopenssl.dll: gio-tls-backend\n" + printf "%b" "$gio" > ${CROSSROAD_PREFIX}/lib/gio/modules/giomodule.cache + + ## NOT WORKING: Fallback generator of the pixbuf 'loaders.cache' for GUI image support + export GDK_PATH=`echo ${CROSSROAD_PREFIX}/lib/gdk-pixbuf-*/*/` + GDK_PATH=$(sed "s|${CROSSROAD_PREFIX}/||g" <<< $GDK_PATH) + wine ${CROSSROAD_PREFIX}/bin/gdk-pixbuf-query-loaders.exe ${CROSSROAD_PREFIX}/${GDK_PATH}loaders/*.dll > ${CROSSROAD_PREFIX}/${GDK_PATH}loaders.cache + sed -i "s&$CROSSROAD_PREFIX/&&" ${CROSSROAD_PREFIX}/${GDK_PATH}/loaders.cache + sed -i '/.dll\"/s*/*\\\\*g' ${CROSSROAD_PREFIX}/${GDK_PATH}/loaders.cache + + ## Generator of the glib 'gschemas.compiled' + export GLIB_PATH=`echo ${CROSSROAD_PREFIX}/share/glib-*/schemas/` + GLIB_PATH=$(sed "s|${CROSSROAD_PREFIX}/||g" <<< $GLIB_PATH) + wine glib-compile-schemas --targetdir=${CROSSROAD_PREFIX}/${GLIB_PATH} ${CROSSROAD_PREFIX}/${GLIB_PATH} fi + +## XXX Functional fix to the problem of non-configured interpreters +## XXX Also, functional generator of the pixbuf 'loaders.cache' for GUI image support +echo "@echo off + echo This is a CI crossbuild of GIMP. + :: Don't run this under PowerShell since it produces UTF-16 files. + echo .js (JavaScript) plug-ins ^|^ NOT supported! + echo .lua (Lua) 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! + bin\gdk-pixbuf-query-loaders.exe lib\gdk-pixbuf-2.0\2.10.0\loaders\*.dll > lib\gdk-pixbuf-2.0\2.10.0\loaders.cache + echo. + bin\gimp-2.99.exe" > ${CROSSROAD_PREFIX}/gimp.cmd +echo "Please run the gimp.cmd file to know the actual plug-in support." > ${CROSSROAD_PREFIX}/README.txt \ No newline at end of file diff --git a/build/windows/gitlab-ci/2_build-gimp-crossroad.sh b/build/windows/gitlab-ci/2_build-gimp-crossroad.sh index 663fb0f052..857def309a 100644 --- a/build/windows/gitlab-ci/2_build-gimp-crossroad.sh +++ b/build/windows/gitlab-ci/2_build-gimp-crossroad.sh @@ -16,3 +16,19 @@ cd .. # Copy the required packages and (part of) GIMP from the deps artifact cp -fr $CROSSROAD_PREFIX/ _install${ARTIFACTS_SUFFIX}/ + +if [[ "x$CROSSROAD_PLATFORM" = "xw32" ]]; then + # We fail to install wine32 in x86 dep job and Gitlab "needs" field + # requires jobs to be from a prior stage, so we take from the x64 dep job + export CROSSROAD_PREFIX=".local/share/crossroad/roads/w64/gimp" + + cp ${CROSSROAD_PREFIX}/lib/gio/modules/giomodule.cache _install${ARTIFACTS_SUFFIX}/lib/gio/modules + + export GDK_PATH=`echo ${CROSSROAD_PREFIX}/lib/gdk-pixbuf-*/*/` + GDK_PATH=$(sed "s|${CROSSROAD_PREFIX}/||g" <<< $GDK_PATH) + cp ${CROSSROAD_PREFIX}/${GDK_PATH}loaders.cache _install${ARTIFACTS_SUFFIX}/${GDK_PATH} + + export GLIB_PATH=`echo ${CROSSROAD_PREFIX}/share/glib-*/schemas/` + GLIB_PATH=$(sed "s|${CROSSROAD_PREFIX}/||g" <<< $GLIB_PATH) + cp ${CROSSROAD_PREFIX}/${GLIB_PATH}gschemas.compiled _install${ARTIFACTS_SUFFIX}/${GLIB_PATH} +fi diff --git a/build/windows/gitlab-ci/2_build-gimp-msys2.sh b/build/windows/gitlab-ci/2_build-gimp-msys2.sh index 5427ef1c86..bd6d86f504 100644 --- a/build/windows/gitlab-ci/2_build-gimp-msys2.sh +++ b/build/windows/gitlab-ci/2_build-gimp-msys2.sh @@ -87,11 +87,55 @@ else fi -if [[ "$BUILD_TYPE" == "CI_NATIVE" ]]; then - cd .. +# XXX Functional fix to the problem of non-configured interpreters +make_cmd() { + echo "@echo off + echo This is a $1 native build of GIMP. + :: Don't run this under PowerShell since it produces UTF-16 files. + echo .js (JavaScript) plug-ins ^|^ NOT supported! + ( + echo lua=$2\bin\luajit.exe + echo luajit=$2\bin\luajit.exe + echo /usr/bin/lua=$2\bin\luajit.exe + echo /usr/bin/luajit=$2\bin\luajit.exe + echo :Lua:E::lua::luajit: + ) >%cd%\lib\gimp\2.99\interpreters\lua.interp + echo .lua (Lua) plug-ins ^|^ supported. + ( + 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\2.99\interpreters\pygimp.interp + echo .py (Python) plug-ins ^|^ supported. + ( + echo gimp-script-fu-interpreter=%cd%\bin\gimp-script-fu-interpreter-3.0.exe + echo gimp-script-fu-interpreter-3.0=%cd%\bin\gimp-script-fu-interpreter-3.0.exe + echo /usr/bin/gimp-script-fu-interpreter=%cd%\bin\gimp-script-fu-interpreter-3.0.exe + echo :ScriptFu:E::scm::gimp-script-fu-interpreter-3.0.exe: + ) >%cd%\lib\gimp\2.99\interpreters\gimp-script-fu-interpreter.interp + echo .scm (ScriptFu) plug-ins ^|^ supported. + echo .vala (Vala) plug-ins ^|^ supported. + echo. + @if not exist $2\lib\girepository-1.0\babl*.typelib (copy lib\girepository-1.0\babl*.typelib $2\lib\girepository-1.0) > nul + @if not exist $2\lib\girepository-1.0\gegl*.typelib (copy lib\girepository-1.0\gegl*.typelib $2\lib\girepository-1.0) > nul + @if not exist $2\lib\girepository-1.0\gimp*.typelib (copy lib\girepository-1.0\gimp*.typelib $2\lib\girepository-1.0) > nul + set PATH=%PATH%;$2\bin + bin\gimp-2.99.exe" > ${GIMP_PREFIX}/gimp.cmd + sed -i 's|c:/|c:\\|g;s|msys64/|msys64\\|g' ${GIMP_PREFIX}/gimp.cmd + echo "Please run the gimp.cmd file to get proper plug-in support."> ${GIMP_PREFIX}/README.txt +} +if [[ "$BUILD_TYPE" == "CI_NATIVE" ]]; then + make_cmd CI %cd% + + cd .. + #ccache --show-stats # XXX Moving back the prefix to be used as artifacts. mv "${GIMP_PREFIX}" . -fi +else + make_cmd local $MSYS2_PREFIX +fi \ No newline at end of file diff --git a/data/meson.build b/data/meson.build index 159ebdcd96..c9ff295a4d 100644 --- a/data/meson.build +++ b/data/meson.build @@ -26,3 +26,11 @@ configure_file( install: true, install_dir: gimpdatadir, ) + +# Fix iso-codes warning (Local-Native only) +if platform_windows and not meson.is_cross_build() + install_data( + join_paths(isocodes_location, 'iso_639.xml'), + install_dir: join_paths(get_option('datadir'), 'xml/iso-codes') +) +endif \ No newline at end of file diff --git a/extensions/lua.interp.in b/extensions/lua.interp.in new file mode 100644 index 0000000000..183a754aaf --- /dev/null +++ b/extensions/lua.interp.in @@ -0,0 +1,5 @@ +lua=@LUA_PATH@luajit.exe +luajit=@LUA_PATH@luajit.exe +/usr/bin/luajit=@LUA_PATH@luajit.exe +/usr/bin/lua=@LUA_PATH@luajit.exe +:Lua:E::lua::luajit: diff --git a/extensions/meson.build b/extensions/meson.build index 4c40775c09..3bb1681644 100644 --- a/extensions/meson.build +++ b/extensions/meson.build @@ -1 +1,15 @@ subdir('goat-exercises') + +# Fallback fix to the problem of non-configured interpreters +if platform_windows and not meson.is_cross_build() and lua.found() + lua_config = configuration_data() + lua_config.set('LUA_PATH', '') + + configure_file( + input : 'lua.interp.in', + output: 'lua.interp', + configuration: lua_config, + install: true, + install_dir: gimpplugindir / 'interpreters', + ) +endif \ No newline at end of file diff --git a/plug-ins/python/meson.build b/plug-ins/python/meson.build index 1bd8cf1d3c..efefe1f7da 100644 --- a/plug-ins/python/meson.build +++ b/plug-ins/python/meson.build @@ -38,10 +38,10 @@ foreach plugin : plugins endforeach endforeach - -if python.found() +# Fallback fix to the problem of non-configured interpreters +if platform_windows and not meson.is_cross_build() and python.found() python_config = configuration_data() - python_config.set('PYTHON_PATH', python.full_path()) + python_config.set('PYTHON_PATH', '') configure_file( input : 'pygimp.interp.in', diff --git a/plug-ins/python/pygimp.interp.in b/plug-ins/python/pygimp.interp.in index aea643a3d8..28cccf017e 100644 --- a/plug-ins/python/pygimp.interp.in +++ b/plug-ins/python/pygimp.interp.in @@ -1,5 +1,5 @@ -python=@PYTHON_PATH@ -python3=@PYTHON_PATH@ -/usr/bin/python=@PYTHON_PATH@ -/usr/bin/python3=@PYTHON_PATH@ +python=@PYTHON_PATH@python.exe +python3=@PYTHON_PATH@python.exe +/usr/bin/python=@PYTHON_PATH@python.exe +/usr/bin/python3=@PYTHON_PATH@python.exe :Python:E::py::python3: diff --git a/plug-ins/script-fu/gimp-script-fu-interpreter.interp.in b/plug-ins/script-fu/gimp-script-fu-interpreter.interp.in new file mode 100644 index 0000000000..70d5bfa597 --- /dev/null +++ b/plug-ins/script-fu/gimp-script-fu-interpreter.interp.in @@ -0,0 +1,4 @@ +gimp-script-fu-interpreter=@SCRIPTFU_PATH@gimp-script-fu-interpreter-3.0.exe +gimp-script-fu-interpreter-3.0=@SCRIPTFU_PATH@gimp-script-fu-interpreter-3.0.exe +/usr/bin/gimp-script-fu-interpreter=@SCRIPTFU_PATH@gimp-script-fu-interpreter-3.0.exe +,ScriptFu,E,,scm,,@SCRIPTFU_PATH@gimp-script-fu-interpreter-3.0.exe, diff --git a/plug-ins/script-fu/meson.build b/plug-ins/script-fu/meson.build index 8f2745905f..5d5598cbf9 100644 --- a/plug-ins/script-fu/meson.build +++ b/plug-ins/script-fu/meson.build @@ -28,38 +28,51 @@ plugin_sources = [ 'script-fu.c', ] -if platform_windows - plugin_sources += windows.compile_resources( - plugin_rc, - args: [ - '--define', 'ORIGINALFILENAME_STR="@0@"'.format(executable_name+'.exe'), - '--define', 'INTERNALNAME_STR="@0@"' .format(executable_name), - '--define', 'TOP_SRCDIR="@0@"' .format(meson.project_source_root()), +if not meson.is_cross_build() + if platform_windows + plugin_sources += windows.compile_resources( + plugin_rc, + args: [ + '--define', 'ORIGINALFILENAME_STR="@0@"'.format(executable_name+'.exe'), + '--define', 'INTERNALNAME_STR="@0@"' .format(executable_name), + '--define', 'TOP_SRCDIR="@0@"' .format(meson.project_source_root()), + ], + include_directories: [ + rootInclude, appInclude, + ], + ) + + # Fallback fix to the problem of non-configured interpreters + scriptfu_config = configuration_data() + scriptfu_config.set('SCRIPTFU_PATH', '') + configure_file( + input : 'gimp-script-fu-interpreter.interp.in', + output: 'gimp-script-fu-interpreter.interp', + configuration: scriptfu_config, + install: true, + install_dir: gimpplugindir / 'interpreters', + ) + endif + + # Several components use Gtk + + # libscriptfu is installed to standard place; no rpath necessary + + executable(executable_name, + plugin_sources, + dependencies: [ + libgimpui_dep, + math, + gi, + ], + c_args: [ + '-DG_LOG_DOMAIN="scriptfu"', ], include_directories: [ - rootInclude, appInclude, + libscriptfuInclude, ], + link_with : [libscriptfuconsole, libscriptfu ], + install: true, + install_dir: gimpplugindir / 'plug-ins' / executable_name, ) -endif - -# Several components use Gtk - -# libscriptfu is installed to standard place; no rpath necessary - -executable(executable_name, - plugin_sources, - dependencies: [ - libgimpui_dep, - math, - gi, - ], - c_args: [ - '-DG_LOG_DOMAIN="scriptfu"', - ], - include_directories: [ - libscriptfuInclude, - ], - link_with : [libscriptfuconsole, libscriptfu ], - install: true, - install_dir: gimpplugindir / 'plug-ins' / executable_name, -) +endif \ No newline at end of file