libgimp: generate build-only GIR/Typelib variants for macOS.

The previous commit worked for all the compiled executables, but for Python
plug-ins (and likely all other GObject-Introspected bindings), we need to
generate a temporary typelib linking to the in-build-directory libgimp*
libraries.

This is similar to what the script `package/macports_build_app.sh` does for
packaging in gimp-macos-build repository.
This commit is contained in:
Jehan 2024-04-14 16:20:39 +02:00
parent a78c41d2a3
commit 3e980d5ad4
3 changed files with 54 additions and 5 deletions

View File

@ -0,0 +1,33 @@
#!/bin/sh
# macOS-only script to generate temporary .gir and .typelib files only to be
# used during build, pointing to the non-installed libgimp* libraries.
# This allows to run non-installed GIMP binaries in a macOS development
# environment.
gimp_gir="$1"
gimp_typelib="$2"
gimpui_gir="$3"
gimpui_typelib="$4"
builddir="$5"
prefix="$6"
g_ir_compiler="$7"
echo PWD: $PWD
echo ARGS: "$*"
# This is only for macOS.
mkdir -p $builddir/tmp/
cp -f "$gimp_gir" "$gimpui_gir" "$builddir/tmp/"
cd "$builddir/tmp/"
gimp_gir=`basename "$gimp_gir"`
gimpui_gir=`basename "$gimpui_gir"`
gimp_typelib=`basename "$gimp_typelib"`
gimpui_typelib=`basename "$gimpui_typelib"`
sed -i '' "s|${prefix}/*||g" "$gimp_gir" "$gimpui_gir"
sed -i '' "s|@rpath/||g" "$gimp_gir" "$gimpui_gir"
sed -i '' 's|lib/\(libgimp\(ui\)\?-\([0-9.]*\).dylib\)|libgimp/\1|g; s|lib/\(libgimp\([a-z]*\)-\([0-9.]*\).dylib\)|libgimp\2/\1|g;' "$gimp_gir" "$gimpui_gir"
$g_ir_compiler --includedir=${prefix}/share/gir-1.0/ --includedir=. "$gimp_gir" -o "${gimp_typelib}"
$g_ir_compiler --includedir=${prefix}/share/gir-1.0/ --includedir=. "$gimpui_gir" -o "${gimpui_typelib}"
echo "/* Generated on `date`. */" > $builddir/macos-typelib.stamp

View File

@ -521,6 +521,17 @@ else
install: true,
)
if platform_osx
g_ir_compiler = find_program('g-ir-compiler')
gimp_exe_typelib = custom_target('macos-typelib.stamp',
output: [ 'macos-typelib.stamp' ],
command: [
'make-in-build-typelib.sh', libgimp_gir, libgimpui_gir,
meson.current_build_dir(), prefix, g_ir_compiler
],
build_by_default: true)
endif
if have_vala
vapi_deps = [
'babl-0.1',

View File

@ -1846,11 +1846,12 @@ gimp_run_env=environment()
if meson.can_run_host_binaries()
if enable_console_bin
gimp_exe_depends = gimpconsole_exe
gimp_real_exe = gimpconsole_exe
else
gimp_exe_depends = gimpmain_exe
gimp_real_exe = gimpmain_exe
endif
gimp_run_env.set('GIMP_SELF_IN_BUILD', gimp_exe_depends.full_path())
gimp_exe_depends = [gimp_real_exe]
gimp_run_env.set('GIMP_SELF_IN_BUILD', gimp_real_exe.full_path())
menu_paths=meson.global_build_root() / 'menus:' + meson.global_source_root() / 'menus'
gimp_run_env.set('GIMP_TESTING_MENUS_PATH', menu_paths)
@ -1863,7 +1864,11 @@ if meson.can_run_host_binaries()
gimp_run_env.set('GIMP_TESTING_ENVIRON_DIRS', meson.global_source_root() / 'data/environ/')
gimp_run_env.prepend('GI_TYPELIB_PATH', prefix / 'lib/girepository-1.0/')
gimp_run_env.prepend('GI_TYPELIB_PATH', meson.global_build_root() / 'libgimp')
if platform_osx
gimp_run_env.prepend('GI_TYPELIB_PATH', meson.global_build_root() / 'libgimp/tmp')
else
gimp_run_env.prepend('GI_TYPELIB_PATH', meson.global_build_root() / 'libgimp')
endif
gimp_run_env.prepend('LD_LIBRARY_PATH', meson.global_build_root() / 'libgimp')
gimp_run_env.prepend('LD_LIBRARY_PATH', meson.global_build_root() / 'libgimpbase')
@ -1891,7 +1896,7 @@ if meson.can_run_host_binaries()
gimp_run_env.set('GIMP_GI_DIR', gi.get_variable('libdir'))
gimp_run_env.set('GIMP_TEMP_UPDATE_RPATH', gimp_exe_depends.full_path())
gimp_run_env.set('GIMP_TEMP_UPDATE_RPATH', gimp_real_exe.full_path())
gimp_run_env.prepend('GIMP_TEMP_UPDATE_RPATH', libgimp.full_path())
gimp_run_env.prepend('GIMP_TEMP_UPDATE_RPATH', libgimpbase.full_path())
gimp_run_env.prepend('GIMP_TEMP_UPDATE_RPATH', libgimpcolor.full_path())