Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.09 3.0 kB view raw
1From 944d5467e1655aac20a14325631df6daccaf5804 Mon Sep 17 00:00:00 2001 2From: Jan Tojnar <jtojnar@gmail.com> 3Date: Sun, 3 Mar 2019 01:13:46 +0100 4Subject: [PATCH] Fix building on Nix 5 6./configure.py tries to find dbus-python header in dbus-1 includedir 7obtained from pkg-config or from --dbus flag. Unfortunately, when supplied, 8it also uses the flag for locating dbus-1 headers. This fails on Nix, 9since every package is installed into its own immutable tree so we cannot 10use a single directory for both dbus-python and dbus-1. We can fix this by 11using pkg-config for finding dbus-python headers too. 12 13Additionally, the build system also tries to install the dbus support module 14to dbus-python tree. Often, it is possible to handle this in pkgconfig as well [1] 15but unfortunately, dbus-python does not export the moduledir in its pc file 16so I have decided to solve this with an extra configure flag. 17 18[1]: https://www.bassi.io/articles/2018/03/15/pkg-config-and-paths/ 19--- 20 configure.py | 13 +++++++++++-- 21 1 file changed, 11 insertions(+), 2 deletions(-) 22 23diff --git a/configure.py b/configure.py 24index a3450ca3..440d90a2 100644 25--- a/configure.py 26+++ b/configure.py 27@@ -905,6 +905,9 @@ class TargetConfiguration: 28 if opts.pydbusincdir is not None: 29 self.pydbus_inc_dir = opts.pydbusincdir 30 31+ if opts.pydbusmoduledir is not None: 32+ self.pydbus_module_dir = opts.pydbusmoduledir 33+ 34 if opts.pyuicinterpreter is not None: 35 self.pyuic_interpreter = opts.pyuicinterpreter 36 37@@ -1184,6 +1187,11 @@ def create_optparser(target_config): 38 metavar="DIR", 39 help="the directory containing the dbus/dbus-python.h header is " 40 "DIR [default: supplied by pkg-config]") 41+ g.add_option("--dbus-moduledir", dest='pydbusmoduledir', type='string', 42+ default=None, action='callback', callback=store_abspath, 43+ metavar="DIR", 44+ help="the directory where dbus support module will be installed to" 45+ "DIR [default: obtained from dbus.mainloop python module]") 46 p.add_option_group(g) 47 48 # Installation. 49@@ -2149,7 +2157,7 @@ def check_dbus(target_config, verbose): 50 51 inform("Checking to see if the dbus support module should be built...") 52 53- cmd = 'pkg-config --cflags-only-I --libs dbus-1' 54+ cmd = 'pkg-config --cflags-only-I --libs dbus-1 dbus-python' 55 56 if verbose: 57 sys.stdout.write(cmd + "\n") 58@@ -2178,7 +2186,8 @@ def check_dbus(target_config, verbose): 59 inform("The Python dbus module doesn't seem to be installed.") 60 return 61 62- target_config.pydbus_module_dir = dbus.mainloop.__path__[0] 63+ if target_config.pydbus_module_dir == '': 64+ target_config.pydbus_module_dir = dbus.mainloop.__path__[0] 65 66 # Try and find dbus-python.h. We don't use pkg-config because it is broken 67 # for dbus-python (at least for versions up to and including v0.81.0). 68-- 692.18.0 70