summaryrefslogtreecommitdiff
path: root/recipes
diff options
context:
space:
mode:
authorL. E. Segovia <amy@centricular.com>2024-05-17 21:47:16 +0000
committerNirbheek Chauhan <nirbheek@centricular.com>2024-05-29 19:36:26 +0530
commit1ca4dd4f80cafac74e896d45ed0991e5cc79d96e (patch)
tree80e06139dba01f1f6557f69873fe0497d1825df9 /recipes
parent13414d666085b01e1c877dac288923adceba1336 (diff)
gobject-introspection: Fix g-ir-scanner failing to run with rpath-relative libraries
Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1481>
Diffstat (limited to 'recipes')
-rw-r--r--recipes/gobject-introspection.recipe3
-rw-r--r--recipes/gobject-introspection/0002-dumper-Fix-introspection-binaries-missing-rpaths-for.patch43
2 files changed, 45 insertions, 1 deletions
diff --git a/recipes/gobject-introspection.recipe b/recipes/gobject-introspection.recipe
index a78d1cd7..7e6b9bbe 100644
--- a/recipes/gobject-introspection.recipe
+++ b/recipes/gobject-introspection.recipe
@@ -15,7 +15,8 @@ class Recipe(recipe.Recipe):
patches = [
# https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/448
- name + '/0001-giscanner-Allow-passing-full-paths-to-libraries-with.patch',
+ f'{name}/0001-giscanner-Allow-passing-full-paths-to-libraries-with.patch',
+ f'{name}/0002-dumper-Fix-introspection-binaries-missing-rpaths-for.patch'
]
files_bins = ['g-ir-annotation-tool', 'g-ir-compiler', 'g-ir-doc-tool', 'g-ir-generate', 'g-ir-scanner']
diff --git a/recipes/gobject-introspection/0002-dumper-Fix-introspection-binaries-missing-rpaths-for.patch b/recipes/gobject-introspection/0002-dumper-Fix-introspection-binaries-missing-rpaths-for.patch
new file mode 100644
index 00000000..7cec5f73
--- /dev/null
+++ b/recipes/gobject-introspection/0002-dumper-Fix-introspection-binaries-missing-rpaths-for.patch
@@ -0,0 +1,43 @@
+From b4d17a6a3cf4ef572818fddd52269c83fb03f63a Mon Sep 17 00:00:00 2001
+Message-ID: <b4d17a6a3cf4ef572818fddd52269c83fb03f63a.1715982305.git.amy@amyspark.me>
+From: "L. E. Segovia" <amy@amyspark.me>
+Date: Fri, 17 May 2024 21:39:10 +0000
+Subject: [PATCH 2/2] dumper: Fix introspection binaries missing rpaths for
+ relative dylibs
+
+Apple expects dylibs to have an ID of the form `@rpath/libyadda.dylib`.
+For this convention to work, a RPATH entry pointing to the library
+prefix and/or to the relative location of said prefix w.r.t the
+dependent executable or library, must be inserted.
+
+This need previously did not arose because gobject-introspection
+implicitly relied on the consumers having IDs set to their absolute
+paths. This is no longer the case with GStreamer's Cerbero, which now
+sanitizes RPATHs, load commands, and dylib IDs at install time.
+
+The simplest and most obvious fix is to ensure that, for each library
+load path, the corresponding rpath entry is inserted.
+---
+ giscanner/dumper.py | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/giscanner/dumper.py b/giscanner/dumper.py
+index 74a494b..cdb5400 100644
+--- a/giscanner/dumper.py
++++ b/giscanner/dumper.py
+@@ -252,6 +252,12 @@ class DumpCompiler(object):
+ args.extend(pkg_config_libs)
+ self._compiler.get_external_link_flags(args, self._options.libraries)
+
++ if sys.platform == 'darwin':
++ # If the libraries' ID are of the form (@rpath/libfoo.dylib),
++ # then nothing previously can have added the needed rpaths
++ rpath_entries_to_add = [lib.replace('-L/', '-Wl,-rpath,/') for lib in pkg_config_libs if lib.startswith('-L/')]
++ args.extend(rpath_entries_to_add)
++
+ if not self._compiler.check_is_msvc():
+ for ldflag in shlex.split(os.environ.get('LDFLAGS', '')):
+ args.append(ldflag)
+--
+2.44.0
+