kumquat-buildroot/package/gobject-introspection/0006-giscanner-add-a-lib-dirs-envvar-option.patch

74 lines
3.5 KiB
Diff
Raw Normal View History

package/gobject-introspection: new package GObject introspection is a middleware layer between C libraries (using GObject) and language bindings. The C library can be scanned at compile time and generate a metadata file, in addition to the actual native C library. Then at runtime, language bindings can read this metadata and automatically provide bindings to call into the C library. There's an XML format called GIR used by GObject-Introspection. The purpose of it is to provide a standard structure to access the complete available API that a library or other unit of code exports. It's language-agnostic using namespaces to separate core, language, or library-specific functionality. Cross-compiling gobject-introspection is not an easy task. The main issue is that in the process of creating the XML files, gobject-introspection must first run and scan the binary, which, if the binary is cross-compiled, would not typically be possible from the host system. Because of this limitation, we use several wrappers to call instead first out qemu, which runs the native scanner to create the binaries. There are seven total patches and four different wrapper files needed to successfully cross-compile and run this package, many of them are from open-embedded, but one of them is of my own doing. 1) Revert a previous, incomplete attempt at adding cross-compiling support. 2) Add support for cross-compiling with meson. 3) Disable tests. 4) Add an option to use a binary wrapper; this patch will force giscanner to use a wrapper executable to run binaries it's producing, instead of attempting to run them from the host. 5) Add an option to use an LDD wrapper, again, useful for cross-compiled environments. 6) Add a --lib-dirs-envar option to pass to giscanner. (See patch for details.) 7) Add rpath-links to ccompiler: when passing the PACKAGE_GIR_EXTRA_LIBS_PATH to the ccompiler.py script, ccompiler.py needs to add -Wl,-rpath-link to the environment for the package to correctly link against the passed on paths. 8) Ignore error return codes from ldd-wrapper because prelink-rtld returns 127 when it can't find a library, which breaks subprocess.check_output(). Signed-off-by: Adam Duskett <Aduskett@gmail.com> Tested-by: Yegor Yefremov <yegorslists@googlemail.com> Tested-by: Giulio Benetti <giulio.benetti@benettiengineering.com> [yann.morin.1998@free.fr: - host-prelink-cross has no Kconfig entry - reorder dependencies for arch deps first ] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-02-11 17:34:04 +01:00
From 3a9b3d8179b7eb9d2cc93da31578945bc03a45c3 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Fri, 27 Apr 2018 12:56:15 -0400
Subject: [PATCH] giscanner: add a --lib-dirs-envvar option
By default LD_LIBRARY_PATH is set to the list of target library paths;
this breaks down in cross-compilation environment, as we need to run a
native emulation wrapper rather than the target binary itself. This patch
allows exporting those paths to a different environment variable
which can be picked up and used by the wrapper.
Upstream-Status: Pending
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Adam Duskett <aduskett@gmail.com>
---
giscanner/ccompiler.py | 4 ++--
giscanner/dumper.py | 3 ++-
giscanner/scannermain.py | 3 +++
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
index d10327c..6cf25d5 100644
--- a/giscanner/ccompiler.py
+++ b/giscanner/ccompiler.py
@@ -174,7 +174,7 @@ class CCompiler(object):
self._cflags_no_deprecation_warnings = "-Wno-deprecated-declarations"
- def get_internal_link_flags(self, args, libtool, libraries, extra_libraries, libpaths):
+ def get_internal_link_flags(self, args, libtool, libraries, extra_libraries, libpaths, lib_dirs_envvar):
# An "internal" link is where the library to be introspected
# is being built in the current directory.
@@ -184,7 +184,7 @@ class CCompiler(object):
if os.name == 'nt':
runtime_path_envvar = ['LIB', 'PATH']
else:
- runtime_path_envvar = ['LD_LIBRARY_PATH', 'DYLD_FALLBACK_LIBRARY_PATH']
+ runtime_path_envvar = ['LD_LIBRARY_PATH', 'DYLD_FALLBACK_LIBRARY_PATH'] if not lib_dirs_envvar else [lib_dirs_envvar]
# Search the current directory first
# (This flag is not supported nor needed for Visual C++)
args.append('-L.')
diff --git a/giscanner/dumper.py b/giscanner/dumper.py
index 3c7220b..0abd565 100644
--- a/giscanner/dumper.py
+++ b/giscanner/dumper.py
@@ -244,7 +244,8 @@ class DumpCompiler(object):
libtool,
self._options.libraries,
self._options.extra_libraries,
- self._options.library_paths)
+ self._options.library_paths,
+ self._options.lib_dirs_envvar)
args.extend(pkg_config_libs)
else:
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
index d262785..51c9570 100755
--- a/giscanner/scannermain.py
+++ b/giscanner/scannermain.py
@@ -126,6 +126,9 @@ def _get_option_parser():
parser.add_option("", "--use-ldd-wrapper",
action="store", dest="ldd_wrapper", default=None,
help="wrapper to use instead of ldd (useful when cross-compiling)")
+ parser.add_option("", "--lib-dirs-envvar",
+ action="store", dest="lib_dirs_envvar", default=None,
+ help="environment variable to write a list of library directories to (for running the transient binary), instead of standard LD_LIBRARY_PATH")
parser.add_option("", "--program-arg",
action="append", dest="program_args", default=[],
help="extra arguments to program")
--
2.14.3