[gtk-mac-bundler] Handle Gir shared library refs with no path component.



commit 93edee7e2d0ec8230aaf5acb21452202b10cd678
Author: John Ralls <jralls ceridwen us>
Date:   Fri Aug 16 13:12:58 2019 -0700

    Handle Gir shared library refs with no path component.
    
    Meson builds do this because Meson sets @rpath on the built library, not
    setting the installation path until install. g-ir-scanner doesn't know what
    to do with @rpath so it punts.

 bundler/project.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/bundler/project.py b/bundler/project.py
index 734a206..fd7dea5 100644
--- a/bundler/project.py
+++ b/bundler/project.py
@@ -392,7 +392,17 @@ class GirFile(Path):
             typelib = os.path.join(typelib_dest, name + '.typelib')
             with open (gir_file, "w", encoding="utf8") as target:
                 for line in lines:
-                    target.write(re.sub(lib_path, self.bundle_path, line))
+                    if re.match('\s*shared-library=', line):
+                        (new_line, subs) = re.subn(lib_path, self.bundle_path, line)
+                        if subs:
+                            target.write(new_line)
+                        else:
+                            (car, cadr, cddr) = re.split('"', line, 2)
+                            new_line = "".join([car, '"', os.path.join(self.bundle_path, cadr), '"'])
+                            target.write(new_line)
+                    else:
+                        target.write(line)
+
             call(['g-ir-compiler', '--output=' + typelib, gir_file])
             return typelib
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]