summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorL. E. Segovia <amy@centricular.com>2024-02-21 09:20:25 -0300
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2024-03-08 17:15:37 +0000
commitd807bf05ecc33479d334ab75c21f48fcf5c930f6 (patch)
treed23bc1790d21c1d1d2e3e24d763ded709db9f3f8
parent5ee03471c25185b927f9308529a4d2090a275a73 (diff)
gobject-introspection: Allow using g-ir-scanner with MSVC
See https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/448 Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1378>
-rw-r--r--recipes/gobject-introspection.recipe5
-rw-r--r--recipes/gobject-introspection/0001-giscanner-Allow-passing-full-paths-to-libraries-with.patch61
2 files changed, 66 insertions, 0 deletions
diff --git a/recipes/gobject-introspection.recipe b/recipes/gobject-introspection.recipe
index 466b798d..a78d1cd7 100644
--- a/recipes/gobject-introspection.recipe
+++ b/recipes/gobject-introspection.recipe
@@ -13,6 +13,11 @@ class Recipe(recipe.Recipe):
licenses_bins = [License.GPLv2Plus]
deps = ['glib']
+ patches = [
+ # https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/448
+ name + '/0001-giscanner-Allow-passing-full-paths-to-libraries-with.patch',
+ ]
+
files_bins = ['g-ir-annotation-tool', 'g-ir-compiler', 'g-ir-doc-tool', 'g-ir-generate', 'g-ir-scanner']
files_libs = ['libgirepository-1.0']
files_typelibs = ['cairo-1.0',
diff --git a/recipes/gobject-introspection/0001-giscanner-Allow-passing-full-paths-to-libraries-with.patch b/recipes/gobject-introspection/0001-giscanner-Allow-passing-full-paths-to-libraries-with.patch
new file mode 100644
index 00000000..c0d75ee6
--- /dev/null
+++ b/recipes/gobject-introspection/0001-giscanner-Allow-passing-full-paths-to-libraries-with.patch
@@ -0,0 +1,61 @@
+From 912d605421eff8385881e0a4bd0d6bfbc9e1c4a2 Mon Sep 17 00:00:00 2001
+From: "L. E. Segovia" <amy@amyspark.me>
+Date: Fri, 16 Feb 2024 21:37:45 -0300
+Subject: [PATCH] giscanner: Allow passing full paths to libraries with MSVC
+
+This is used by Meson's generate_gir call.
+---
+ giscanner/ccompiler.py | 17 ++++++++++++-----
+ 1 file changed, 12 insertions(+), 5 deletions(-)
+
+diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
+index 2912fe0e..b397ba20 100644
+--- a/giscanner/ccompiler.py
++++ b/giscanner/ccompiler.py
+@@ -253,13 +253,16 @@ class CCompiler(object):
+ runtime_paths.append(library_path)
+
+ for library in libraries + extra_libraries:
+- if self.check_is_msvc():
++ if os.path.isfile(library):
++ # If we get a real filename, just use it as-is
++ args.append(library)
++ elif self.check_is_msvc():
+ # Note that Visual Studio builds do not use libtool!
+ if library != 'm':
+ args.append(library + '.lib')
+ else:
+ # If we get a real filename, just use it as-is
+- if library.endswith(".la") or os.path.isfile(library):
++ if library.endswith(".la"):
+ args.append(library)
+ else:
+ args.append('-l' + library)
+@@ -277,10 +280,13 @@ class CCompiler(object):
+ # of GLib in gobject-introspection itself.
+
+ for library in libraries:
+- if self.check_is_msvc():
+- # Visual Studio: don't attempt to link to m.lib
++ if os.path.isfile(library):
++ # If we get a real filename, just use it as-is
++ args.append(library)
++ elif self.check_is_msvc():
++ # Note that Visual Studio builds do not use libtool!
+ if library != 'm':
+- args.append(library + ".lib")
++ args.append(library + '.lib')
+ else:
+ if library.endswith(".la"): # explicitly specified libtool library
+ args.append(library)
+@@ -390,6 +396,7 @@ class CCompiler(object):
+ found = False
+ candidates = [
+ 'lib%s.dll.a' % lib,
++ 'lib%s.dll.lib' % lib, # rust cdylib
+ 'lib%s.a' % lib,
+ '%s.dll.a' % lib,
+ '%s.a' % lib,
+--
+2.42.0.windows.2
+