]> code.ossystems Code Review - openembedded-core.git/blob
f21eaca855677f4352d3bf81ba5b4776cba11952
[openembedded-core.git] /
1 From 704b888d0abfb01067352c40156f49f655691c7c Mon Sep 17 00:00:00 2001
2 From: Alexander Kanavin <alex.kanavin@gmail.com>
3 Date: Mon, 19 Oct 2015 18:26:40 +0300
4 Subject: [PATCH 3/5] giscanner: add --use-binary-wrapper option
5
6 With this option, giscanner will use a wrapper executable to run
7 binaries it's producing, instead of running them directly. This
8 is useful when binaries are cross-compiled and cannot be run directly,
9 but they can be run using for example QEMU emulation.
10
11 Upstream-Status: Pending [review on oe-core list]
12 Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
13 ---
14  giscanner/scannermain.py | 14 ++++++++++++++
15  1 file changed, 14 insertions(+)
16
17 diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
18 index 633496f..d684cd0 100755
19 --- a/giscanner/scannermain.py
20 +++ b/giscanner/scannermain.py
21 @@ -124,6 +124,9 @@ def _get_option_parser():
22      parser.add_option("", "--program",
23                        action="store", dest="program", default=None,
24                        help="program to execute")
25 +    parser.add_option("", "--use-binary-wrapper",
26 +                      action="store", dest="wrapper", default=None,
27 +                      help="wrapper to use for running programs (useful when cross-compiling)")
28      parser.add_option("", "--program-arg",
29                        action="append", dest="program_args", default=[],
30                        help="extra arguments to program")
31 @@ -419,6 +422,17 @@ def create_binary(transformer, options, args):
32                                                gdump_parser.get_error_quark_functions())
33  
34      shlibs = resolve_shlibs(options, binary, options.libraries)
35 +    if options.wrapper:
36 +        # The wrapper needs the binary itself, not the libtool wrapper script,
37 +        # so we check if libtool has sneaked the binary into .libs subdirectory
38 +        # and adjust the path accordingly
39 +        import os.path
40 +        dir_name, binary_name  = os.path.split(binary.args[0])
41 +        libtool_binary = os.path.join(dir_name, '.libs', binary_name)
42 +        if os.path.exists(libtool_binary):
43 +            binary.args[0] = libtool_binary
44 +       # Then prepend the wrapper to the command line to execute
45 +        binary.args = [options.wrapper] + binary.args
46      gdump_parser.set_introspection_binary(binary)
47      gdump_parser.parse()
48      return shlibs
49 -- 
50 2.7.0
51