[pygobject/pygobject-3-30: 2/2] meson: Don't link against libpython on non-Windows systems. Fixes #253



commit 190420152f4eac57b197bf6593627d37ebc633ae
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Thu Sep 6 20:44:03 2018 +0200

    meson: Don't link against libpython on non-Windows systems. Fixes #253
    
    While on Windows it needs to link against it, on Unix systems
    it doesn't have to if the process loading it has all the symbols
    already loaded (python executable itself, or something dlopening
    libpython with RTLD_GLOBAL before).
    
    While on Fedora things get linked by default that's not the case with
    Debian based distros and macOS, so most software has to deal with it
    anyway and we ignore Fedora here for now.
    
    Ideally this should get handled in meson itself, see:
    https://github.com/mesonbuild/meson/issues/4117

 gi/meson.build | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gi/meson.build b/gi/meson.build
index ded10ace..c1afd689 100644
--- a/gi/meson.build
+++ b/gi/meson.build
@@ -65,8 +65,15 @@ python.install_sources(python_sources,
   subdir : 'gi'
 )
 
+# https://github.com/mesonbuild/meson/issues/4117
+if host_machine.system() == 'windows'
+  python_ext_dep = python_dep
+else
+  python_ext_dep = python_dep.partial_dependency(compile_args: true)
+endif
+
 giext = python.extension_module('_gi', sources,
-  dependencies : [python_dep, glib_dep, gi_dep, ffi_dep],
+  dependencies : [python_ext_dep, glib_dep, gi_dep, ffi_dep],
   include_directories: include_directories('..'),
   install: true,
   subdir : 'gi',
@@ -75,7 +82,7 @@ giext = python.extension_module('_gi', sources,
 
 if with_pycairo
   gicairoext = python.extension_module('_gi_cairo', ['pygi-foreign-cairo.c'],
-    dependencies : [python_dep, glib_dep, gi_dep, ffi_dep, pycairo_dep, cairo_dep, cairo_gobject_dep],
+    dependencies : [python_ext_dep, glib_dep, gi_dep, ffi_dep, pycairo_dep, cairo_dep, cairo_gobject_dep],
     install: true,
     subdir : 'gi',
     c_args: pyext_c_args + main_c_args)


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