7687a396e8
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>
53 lines
2.3 KiB
Diff
53 lines
2.3 KiB
Diff
From 704b888d0abfb01067352c40156f49f655691c7c Mon Sep 17 00:00:00 2001
|
|
From: Alexander Kanavin <alex.kanavin@gmail.com>
|
|
Date: Mon, 19 Oct 2015 18:26:40 +0300
|
|
Subject: [PATCH] giscanner: add --use-binary-wrapper option
|
|
|
|
With this option, giscanner will use a wrapper executable to run
|
|
binaries it's producing, instead of running them directly. This
|
|
is useful when binaries are cross-compiled and cannot be run directly,
|
|
but they can be run using for example QEMU emulation.
|
|
|
|
Upstream-Status: Pending [review on oe-core list]
|
|
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
|
|
Signed-off-by: Adam Duskett <aduskett@gmail.com>
|
|
---
|
|
giscanner/scannermain.py | 14 ++++++++++++++
|
|
1 file changed, 14 insertions(+)
|
|
|
|
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
|
|
index 633496f..d684cd0 100755
|
|
--- a/giscanner/scannermain.py
|
|
+++ b/giscanner/scannermain.py
|
|
@@ -120,6 +120,9 @@ def _get_option_parser():
|
|
parser.add_option("", "--program",
|
|
action="store", dest="program", default=None,
|
|
help="program to execute")
|
|
+ parser.add_option("", "--use-binary-wrapper",
|
|
+ action="store", dest="wrapper", default=None,
|
|
+ help="wrapper to use for running programs (useful when cross-compiling)")
|
|
parser.add_option("", "--program-arg",
|
|
action="append", dest="program_args", default=[],
|
|
help="extra arguments to program")
|
|
@@ -417,6 +420,17 @@ def create_binary(transformer, options, args):
|
|
gdump_parser.get_error_quark_functions())
|
|
|
|
shlibs = resolve_shlibs(options, binary, options.libraries)
|
|
+ if options.wrapper:
|
|
+ # The wrapper needs the binary itself, not the libtool wrapper script,
|
|
+ # so we check if libtool has sneaked the binary into .libs subdirectory
|
|
+ # and adjust the path accordingly
|
|
+ import os.path
|
|
+ dir_name, binary_name = os.path.split(binary.args[0])
|
|
+ libtool_binary = os.path.join(dir_name, '.libs', binary_name)
|
|
+ if os.path.exists(libtool_binary):
|
|
+ binary.args[0] = libtool_binary
|
|
+ # Then prepend the wrapper to the command line to execute
|
|
+ binary.args = [options.wrapper] + binary.args
|
|
gdump_parser.set_introspection_binary(binary)
|
|
gdump_parser.parse()
|
|
return shlibs
|
|
--
|
|
2.7.0
|
|
|