From patchwork Thu Aug 20 15:10:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danny Milosavljevic X-Patchwork-Id: 23713 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id BB0ED27BBE6; Thu, 20 Aug 2020 16:15:14 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 6354927BBE5 for ; Thu, 20 Aug 2020 16:15:13 +0100 (BST) Received: from localhost ([::1]:57320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8mHY-0003kq-DM for patchwork@mira.cbaines.net; Thu, 20 Aug 2020 11:15:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8mEZ-0007L1-2D for guix-patches@gnu.org; Thu, 20 Aug 2020 11:12:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60225) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k8mEY-00071c-Mm for guix-patches@gnu.org; Thu, 20 Aug 2020 11:12:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k8mEY-0006D4-IT for guix-patches@gnu.org; Thu, 20 Aug 2020 11:12:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42958] [PATCH core-updates 07/29] gnu: gobject-introspection: Add patches back. Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 20 Aug 2020 15:12:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42958 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 42958@debbugs.gnu.org Cc: Raghav Gururajan , Danny Milosavljevic Received: via spool by 42958-submit@debbugs.gnu.org id=B42958.159793629123665 (code B ref 42958); Thu, 20 Aug 2020 15:12:06 +0000 Received: (at 42958) by debbugs.gnu.org; 20 Aug 2020 15:11:31 +0000 Received: from localhost ([127.0.0.1]:43502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k8mDs-00069P-Ra for submit@debbugs.gnu.org; Thu, 20 Aug 2020 11:11:31 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:42340) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k8mDR-00063W-23 for 42958@debbugs.gnu.org; Thu, 20 Aug 2020 11:11:04 -0400 Received: from dayas.lan (80-110-126-103.cgn.dynamic.surfer.at [80.110.126.103]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 608693360398; Thu, 20 Aug 2020 17:10:56 +0200 (CEST) From: Danny Milosavljevic Date: Thu, 20 Aug 2020 17:10:28 +0200 Message-Id: <20200820151050.9529-7-dannym@scratchpost.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200820151050.9529-1-dannym@scratchpost.org> References: <20200820150914.9443-1-dannym@scratchpost.org> <20200820151050.9529-1-dannym@scratchpost.org> MIME-Version: 1.0 Tags: patch X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches From: Raghav Gururajan * gnu/packages/glib.scm (gobject-introspection): Add patches back. [source][patches]: Add gobject-introspection-cc.patch, gobject-introspection-girepository.patch and gobject-introspection-absolute-shlib-path.patch. * gnu/packages/patches/gobject-introspection-cc.patch: New file. * gnu/packages/patches/gobject-introspection-girepository.patch: New file. * gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch: New file. * gnu/local.mk (dist_patch_DATA): Add them. Signed-off-by: Danny Milosavljevic --- gnu/local.mk | 3 + gnu/packages/glib.scm | 7 +- ...ct-introspection-absolute-shlib-path.patch | 166 ++++++++++++++++++ .../patches/gobject-introspection-cc.patch | 14 ++ .../gobject-introspection-girepository.patch | 25 +++ 5 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch create mode 100644 gnu/packages/patches/gobject-introspection-cc.patch create mode 100644 gnu/packages/patches/gobject-introspection-girepository.patch diff --git a/gnu/local.mk b/gnu/local.mk index 278879334c..ae708248e8 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1065,6 +1065,9 @@ dist_patch_DATA = \ %D%/packages/patches/gnupg-default-pinentry.patch \ %D%/packages/patches/gnutls-skip-trust-store-test.patch \ %D%/packages/patches/gnutls-cross.patch \ + %D%/packages/patches/gobject-introspection-absolute-shlib-path.patch \ + %D%/packages/patches/gobject-introspection-cc.patch \ + %D%/packages/patches/gobject-introspection-girepository.patch \ %D%/packages/patches/go-skip-gc-test.patch \ %D%/packages/patches/gpm-glibc-2.26.patch \ %D%/packages/patches/gpsbabel-minizip.patch \ diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm index 1221612fbb..b5a37bb0cd 100644 --- a/gnu/packages/glib.scm +++ b/gnu/packages/glib.scm @@ -339,7 +339,12 @@ threads, dynamic loading, and an object system.") name "/" (version-major+minor version) "/" name "-" version ".tar.xz")) (sha256 - (base32 "19vz7vp10h0zj3f491yk72dp89bix6rgkzxg4qcm4d6151ksxgl0")))) + (base32 "19vz7vp10h0zj3f491yk72dp89bix6rgkzxg4qcm4d6151ksxgl0")) + (patches + (search-patches + "gobject-introspection-cc.patch" + "gobject-introspection-girepository.patch" + "gobject-introspection-absolute-shlib-path.patch")))) (build-system meson-build-system) (arguments `(#:glib-or-gtk? #t)) ; To wrap binaries and/or compile schemas diff --git a/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch b/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch new file mode 100644 index 0000000000..956fa617c3 --- /dev/null +++ b/gnu/packages/patches/gobject-introspection-absolute-shlib-path.patch @@ -0,0 +1,166 @@ +# Names of libraries included in typelib files are opened by dlopen. Here we +# add the full path. +# +# This patch was provided by Luca Bruno for +# 'gobject-introspection' 1.40.0 in Nix. +# +# It has since been updated to work with newer versions of +# gobject-introspection. +--- a/giscanner/scannermain.py ++++ b/giscanner/scannermain.py +@@ -95,6 +95,39 @@ def get_windows_option_group(parser): + return group + + ++def _get_default_fallback_libpath(): ++ # Newer multiple-output-optimized stdenv has an environment variable ++ # $outputLib which in turn specifies another variable which then is used as ++ # the destination for the library contents (${!outputLib}/lib). ++ store_path = os.environ.get(os.environ.get("outputLib")) if "outputLib" in os.environ else None ++ if store_path is None: ++ outputs = os.environ.get("outputs", "out").split() ++ if "lib" in outputs: ++ # For multiple output derivations let's try whether there is a $lib ++ # environment variable and use that as the base store path. ++ store_path = os.environ.get("lib") ++ elif "out" in outputs: ++ # Otherwise we have a single output derivation, so the libraries ++ # most certainly will end up in "$out/lib". ++ store_path = os.environ.get("out") ++ ++ if store_path is not None: ++ # Even if we have a $lib as output, there still should be a $lib/lib ++ # directory. ++ return os.path.join(store_path, 'lib') ++ else: ++ # If we haven't found a possible scenario, let's return an empty string ++ # so that the shared library won't be prepended with a path. ++ # ++ # Note that this doesn't mean that all hope is lost, because after all ++ # we can still use --fallback-library-path to set one. ++ # ++ # Also, we're not returning None, because that would make it very ++ # difficult to disable adding fallback paths altogether using something ++ # like: --fallback-library-path="" ++ return "" ++ ++ + def _get_option_parser(): + parser = optparse.OptionParser('%prog [options] sources', + version='%prog ' + giscanner.__version__) +@@ -205,6 +238,10 @@ match the namespace prefix.""") + parser.add_option("", "--filelist", + action="store", dest="filelist", default=[], + help="file containing headers and sources to be scanned") ++ parser.add_option("", "--fallback-library-path", ++ action="store", dest="fallback_libpath", ++ default=_get_default_fallback_libpath(), ++ help="Path to prepend to unknown shared libraries") + + group = get_preprocessor_option_group(parser) + parser.add_option_group(group) +--- a/giscanner/shlibs.py ++++ b/giscanner/shlibs.py +@@ -57,6 +57,14 @@ def _ldd_library_pattern(library_name): + $""" % re.escape(library_name), re.VERBOSE) + + ++def _ldd_library_guix_pattern(library_name): ++ store_dir = re.escape( ++ os.environ.get("NIX_STORE", default="/gnu/store") ++ ) ++ pattern = r'(%s(?:/[^/]*)+lib%s[^A-Za-z0-9_-][^\s\(\)]*)' ++ return re.compile(pattern % (store_dir, re.escape(library_name))) ++ ++ + # This is a what we do for non-la files. We assume that we are on an + # ELF-like system where ldd exists and the soname extracted with ldd is + # a filename that can be opened with dlopen(). +@@ -106,7 +112,8 @@ def _resolve_non_libtool(options, binary, libraries): + output = output.decode("utf-8", "replace") + + shlibs = resolve_from_ldd_output(libraries, output) +- return list(map(sanitize_shlib_path, shlibs)) ++ fallback_libpath = options.fallback_libpath or ""; ++ return list(map(lambda p: os.path.join(fallback_libpath, p), map(sanitize_shlib_path, shlibs))) + + + def sanitize_shlib_path(lib): +@@ -115,19 +122,18 @@ def sanitize_shlib_path(lib): + # In case we get relative paths on macOS (like @rpath) then we fall + # back to the basename as well: + # https://gitlab.gnome.org/GNOME/gobject-introspection/issues/222 +- if sys.platform == "darwin": +- if not os.path.isabs(lib): +- return os.path.basename(lib) +- return lib +- else: ++ ++ # Always use absolute paths if available ++ if not os.path.isabs(lib): + return os.path.basename(lib) ++ return lib + + + def resolve_from_ldd_output(libraries, output): + patterns = {} + for library in libraries: + if not os.path.isfile(library): +- patterns[library] = _ldd_library_pattern(library) ++ patterns[library] = (_ldd_library_pattern(library), _ldd_library_guix_pattern(library)) + if len(patterns) == 0: + return [] + +@@ -139,8 +145,12 @@ def resolve_from_ldd_output(libraries, output): + if line.endswith(':'): + continue + for word in line.split(): +- for library, pattern in patterns.items(): +- m = pattern.match(word) ++ for library, (pattern, guix_pattern) in patterns.items(): ++ store_dir = os.environ.get("NIX_STORE", default="/gnu/store") ++ if line.find(store_dir) != -1: ++ m = guix_pattern.match(word) ++ else: ++ m = pattern.match(word) + if m: + del patterns[library] + shlibs.append(m.group()) + +--- a/giscanner/utils.py ++++ b/giscanner/utils.py +@@ -111,17 +111,11 @@ def extract_libtool_shlib(la_file): + if dlname is None: + return None + +- # Darwin uses absolute paths where possible; since the libtool files never +- # contain absolute paths, use the libdir field +- if platform.system() == 'Darwin': +- dlbasename = os.path.basename(dlname) +- libdir = _extract_libdir_field(la_file) +- if libdir is None: +- return dlbasename +- return libdir + '/' + dlbasename +- # From the comments in extract_libtool(), older libtools had +- # a path rather than the raw dlname +- return os.path.basename(dlname) ++ dlbasename = os.path.basename(dlname) ++ libdir = _extract_libdir_field(la_file) ++ if libdir is None: ++ return dlbasename ++ return libdir + '/' + dlbasename + + + def extract_libtool(la_file): +--- a/tests/scanner/test_shlibs.py ++++ b/tests/scanner/test_shlibs.py +@@ -40,6 +64,7 @@ class TestLddParser(unittest.TestCase): + + self.assertEqual( + sanitize_shlib_path('/foo/bar'), +- '/foo/bar' if sys.platform == 'darwin' else 'bar') ++ # Always use an absolute filename for Guix ++ '/foo/bar') + + def test_unresolved_library(self): +output = '' diff --git a/gnu/packages/patches/gobject-introspection-cc.patch b/gnu/packages/patches/gobject-introspection-cc.patch new file mode 100644 index 0000000000..6a86b56b44 --- /dev/null +++ b/gnu/packages/patches/gobject-introspection-cc.patch @@ -0,0 +1,14 @@ +Use gcc as the default C compiler if CC is not set. + +diff -ru gobject-introspection-1.58.1.orig/giscanner/__init__.py gobject-introspection-1.58.1/giscanner/__init__.py +--- gobject-introspection-1.58.1.orig/giscanner/__init__.py 1970-01-01 01:00:00.000000000 +0100 ++++ gobject-introspection-1.58.1/giscanner/__init__.py 2018-12-03 13:33:28.788971299 +0100 +@@ -22,6 +22,8 @@ + builddir = os.environ.get('UNINSTALLED_INTROSPECTION_BUILDDIR') + if builddir is not None: + __path__.append(os.path.join(builddir, 'giscanner')) ++if not 'CC' in os.environ: ++ os.environ['CC'] = 'gcc' + try: + from ._version import __version__ + except ImportError: diff --git a/gnu/packages/patches/gobject-introspection-girepository.patch b/gnu/packages/patches/gobject-introspection-girepository.patch new file mode 100644 index 0000000000..380617f27f --- /dev/null +++ b/gnu/packages/patches/gobject-introspection-girepository.patch @@ -0,0 +1,25 @@ +--- a/girepository/gitypelib.c.orig ++++ b/girepository/gitypelib.c +@@ -2296,7 +2296,22 @@ _g_typelib_do_dlopen (GITypelib *typelib) + { + GModule *module; + ++ /* 'gobject-introspection' doesn't store the path of shared ++ libraries into '.typelib' and '.gir' files. Shared ++ libraries are searched for in the dynamic linker search ++ path. In Guix we patch 'gobject-introspection' such that ++ it stores the absolute path of shared libraries in ++ '.typelib' and '.gir' files. Here, in order to minimize ++ side effects, we make sure that if the library is not ++ found at the indicated path location, we try with just ++ the basename and the system dynamic library ++ infrastructure, as per default behaviour of the ++ library. */ + module = load_one_shared_library (shlibs[i]); ++ if (module == NULL && g_path_is_absolute (shlibs[i])) ++ { ++ module = load_one_shared_library (g_basename(shlibs[i])); ++ } + + if (module == NULL) + {