diff options
author | Nicola Fontana <ntd@entidi.it> | 2016-02-12 11:04:11 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2018-01-25 22:10:25 +0000 |
commit | 15a28c945f192863c6b0a9818fa3a0713e3d4076 (patch) | |
tree | c2a08f2293ba13620b16ce3ee016c3b15dce7fa7 | |
parent | b8da3c080103ba06da8ebd81d6cffbeda8b1bd13 (diff) | |
download | gobject-introspection-15a28c945f192863c6b0a9818fa3a0713e3d4076.tar.gz |
Allow overriding of the host os name
Added the GI_HOST_OS environment variable to eventually specify the host
OS explicitely. It fall backs to os.name to retain backward
compatibility.
https://bugzilla.gnome.org/show_bug.cgi?id=761985
-rw-r--r-- | Makefile.introspection | 2 | ||||
-rw-r--r-- | giscanner/dumper.py | 2 | ||||
-rw-r--r-- | giscanner/shlibs.py | 4 | ||||
-rw-r--r-- | giscanner/utils.py | 4 |
4 files changed, 8 insertions, 4 deletions
diff --git a/Makefile.introspection b/Makefile.introspection index 042cc65e..5b38e355 100644 --- a/Makefile.introspection +++ b/Makefile.introspection @@ -85,7 +85,7 @@ _gir_silent_compiler = $(_gir_silent_compiler_$(V)) _gir_silent_compiler_ = $(_gir_silent_compiler_$(_gir_verbosity)) _gir_silent_compiler_0 = @echo " GICOMP $(1)"; -_gir_default_scanner_env = CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" CC="$(CC)" PKG_CONFIG="$(PKG_CONFIG)" DLLTOOL="$(DLLTOOL)" +_gir_default_scanner_env = CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" CC="$(CC)" PKG_CONFIG="$(PKG_CONFIG)" GI_HOST_OS="$(GI_HOST_OS)" DLLTOOL="$(DLLTOOL)" # # Creates a GIR by scanning C headers/sources diff --git a/giscanner/dumper.py b/giscanner/dumper.py index 7f77bd24..3c7220bc 100644 --- a/giscanner/dumper.py +++ b/giscanner/dumper.py @@ -227,7 +227,7 @@ class DumpCompiler(object): else: args.extend(['-o', output]) if libtool: - if os.name == 'nt': + if utils.host_os() == 'nt': args.append('-Wl,--export-all-symbols') else: args.append('-export-dynamic') diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py index 4e459571..525bdba2 100644 --- a/giscanner/shlibs.py +++ b/giscanner/shlibs.py @@ -29,7 +29,7 @@ import platform import re import subprocess -from .utils import get_libtool_command, extract_libtool_shlib +from .utils import get_libtool_command, extract_libtool_shlib, host_os from .ccompiler import CCompiler @@ -94,7 +94,7 @@ def _resolve_non_libtool(options, binary, libraries): else: binary.args[0] = old_argdir - if os.name == 'nt': + if host_os() == 'nt': cc = CCompiler() shlibs = cc.resolve_windows_libs(libraries, options) diff --git a/giscanner/utils.py b/giscanner/utils.py index 4865ca8c..09132b2d 100644 --- a/giscanner/utils.py +++ b/giscanner/utils.py @@ -184,6 +184,10 @@ def cflag_real_include_path(cflag): return "-I" + os.path.realpath(cflag[2:]) +def host_os(): + return os.environ.get("GI_HOST_OS", os.name) + + def which(program): def is_exe(fpath): return os.path.isfile(fpath) and os.access(fpath, os.X_OK) |