diff options
author | Olivier Crête <olivier.crete@collabora.com> | 2016-07-06 11:18:29 -0400 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-10-20 12:45:24 +0300 |
commit | e2595a0191cc7ea6c7b7366eca3c32963b12aee0 (patch) | |
tree | c3e4bc5768f4181101913969a61119f4104df9a5 | |
parent | d650b37b547f34a69e8c9cf0bd04f34a8a87627c (diff) |
config: Differentiate between cross-compiling and executable prefix
Clean up the different between cross-compiling, which means that the
target is not the build system, and executable prefix, which means that
the build system can execute binaries from the target prefix
https://bugzilla.gnome.org/show_bug.cgi?id=768493
-rw-r--r-- | cerbero/bootstrap/build_tools.py | 4 | ||||
-rw-r--r-- | cerbero/config.py | 16 | ||||
-rw-r--r-- | recipes/glib-networking.recipe | 2 |
3 files changed, 13 insertions, 9 deletions
diff --git a/cerbero/bootstrap/build_tools.py b/cerbero/bootstrap/build_tools.py index 4d343741..0bb5141c 100644 --- a/cerbero/bootstrap/build_tools.py +++ b/cerbero/bootstrap/build_tools.py @@ -41,7 +41,7 @@ class BuildTools (BootstrapperBase): # if cross-compiling or not on linux, make sure we have gtk-doc if self.config.target_platform != Platform.LINUX or\ - not self.config.prefix_is_executable(): + self.config.cross_compiling(): self.BUILD_TOOLS.append('gtk-doc-lite') if self.config.platform == Platform.WINDOWS: @@ -69,7 +69,7 @@ class BuildTools (BootstrapperBase): DistroVersion.UBUNTU_NATTY]: self.BUILD_TOOLS.append('glib-tools') if self.config.platform != Platform.LINUX and\ - not self.config.prefix_is_executable(): + self.config.cross_compiling(): # For glib-mkenums and glib-genmarshal self.BUILD_TOOLS.append('glib-tools') self.BUILD_TOOLS += self.config.extra_build_tools diff --git a/cerbero/config.py b/cerbero/config.py index 47f0ea8b..31dc87bf 100644 --- a/cerbero/config.py +++ b/cerbero/config.py @@ -176,9 +176,9 @@ class Config (object): # Build variants before copying any config self.variants = Variants(self.variants) - if self.cross_compiling() and self.variants.gi: - m.warning(_("gobject introspection is not supported " - "cross-compiling, 'gi' variant will be removed")) + if not self.prefix_is_executable() and self.variants.gi: + m.warning(_("gobject introspection requires an executable " + "prefix, 'gi' variant will be removed")) self.variants.gi = False for c in self.arch_config.values(): @@ -250,12 +250,12 @@ class Config (object): ldflags += os.environ.get('LDFLAGS', '') path = os.environ.get('PATH', '') - if bindir not in path and self.prefix_is_executable(): + if bindir not in path and not self.cross_compiling(): path = self._join_path(bindir, path) path = self._join_path( os.path.join(self.build_tools_prefix, 'bin'), path) - if self.prefix_is_executable(): + if not self.cross_compiling(): ld_library_path = libdir else: ld_library_path = "" @@ -382,10 +382,14 @@ class Config (object): return {} def cross_compiling(self): + "Are we building for the host platform or not?" return self.target_platform != self.platform or \ - self.target_arch != self.arch + self.target_arch != self.arch or \ + self.target_distro_version != self.distro_version def prefix_is_executable(self): + """Can the binaries from the target platform can be executed in the + build env?""" if self.target_platform != self.platform: return False if self.target_arch != self.arch: diff --git a/recipes/glib-networking.recipe b/recipes/glib-networking.recipe index 5419bfc9..0445868d 100644 --- a/recipes/glib-networking.recipe +++ b/recipes/glib-networking.recipe @@ -27,7 +27,7 @@ class Recipe(recipe.Recipe): if os.path.exists(arch_path): querymodule_path = arch_path - if not self.config.prefix_is_executable(): + if self.config.cross_compiling(): querymodule_path = which('true') if self.config.target_platform in [Platform.ANDROID]: |