diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2015-10-19 18:26:40 +0300 |
---|---|---|
committer | Alexander Kanavin <alex.kanavin@gmail.com> | 2019-12-13 17:07:51 +0100 |
commit | 0488022dec024293ed4548b6c50d389904fb0ce8 (patch) | |
tree | 06187444b08a73e7e78141acc8f7179b31aba792 | |
parent | 3eb5b8b1051d101a9653a2b0b7d4dc8b85bfca89 (diff) | |
download | gobject-introspection-0488022dec024293ed4548b6c50d389904fb0ce8.tar.gz |
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.
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
-rw-r--r-- | giscanner/scannermain.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py index 4b723695..e6c7b47e 100644 --- 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 |