diff options
-rw-r--r-- | cerbero/config.py | 10 | ||||
-rw-r--r-- | cerbero/main.py | 2 | ||||
-rw-r--r-- | config/win32-msvc-shell.cbc | 9 | ||||
-rw-r--r-- | config/win64-msvc-shell.cbc | 9 | ||||
-rw-r--r-- | config/windows.config | 20 |
5 files changed, 21 insertions, 29 deletions
diff --git a/cerbero/config.py b/cerbero/config.py index 8a8f1ed8..65634d1d 100644 --- a/cerbero/config.py +++ b/cerbero/config.py @@ -111,7 +111,8 @@ class Config (object): 'ios_min_version', 'toolchain_path', 'mingw_perl_prefix', 'msvc_version', 'msvc_toolchain_env', 'mingw_toolchain_env', 'meson_cross_properties', 'manifest', 'extra_properties', - 'qt5_qmake_path', 'qt5_pkgconfigdir'] + 'qt5_qmake_path', 'qt5_pkgconfigdir', 'for_shell', + 'msvc_export_for_shell'] cookbook = None @@ -140,6 +141,9 @@ class Config (object): # First load the default configuration self.load_defaults() + # Ensure that config files know about these variants + self.variants += variants_override + # Next parse the main configuration file self._load_main_config() @@ -205,8 +209,10 @@ class Config (object): config._validate_properties() config._raw_environ = os.environ.copy() + # Ensure that variants continue to override all other configuration + self.variants += variants_override # Build variants before copying any config - self.variants = Variants(self.variants + variants_override) + self.variants = Variants(self.variants) if not self.prefix_is_executable() and self.variants.gi: m.warning(_("gobject introspection requires an executable " "prefix, 'gi' variant will be removed")) diff --git a/cerbero/main.py b/cerbero/main.py index e62d7bb2..9e8df5d6 100644 --- a/cerbero/main.py +++ b/cerbero/main.py @@ -139,6 +139,8 @@ class Main(object): ''' Load the configuration ''' try: self.config = config.Config() + if self.args.command == 'shell': + self.config.for_shell = True self.config.load(self.args.config, self.args.variants) if self.args.manifest: self.config.manifest = self.args.manifest diff --git a/config/win32-msvc-shell.cbc b/config/win32-msvc-shell.cbc deleted file mode 100644 index 12eceedb..00000000 --- a/config/win32-msvc-shell.cbc +++ /dev/null @@ -1,9 +0,0 @@ -# Please also edit win64-msvc-shell.cbc when updating this file - -from cerbero.config import Architecture - -target_arch = Architecture.X86 - -# When set, we export the msvc toolchain in windows.config instead of when -# building the recipe, and there won't be any MinGW toolchain paths -os.environ['CERBERO_EXPORT_MSVC'] = '1' diff --git a/config/win64-msvc-shell.cbc b/config/win64-msvc-shell.cbc deleted file mode 100644 index f49c8340..00000000 --- a/config/win64-msvc-shell.cbc +++ /dev/null @@ -1,9 +0,0 @@ -# Please also edit win32-msvc-shell.cbc when updating this file - -from cerbero.config import Architecture - -target_arch = Architecture.X86_64 - -# When set, we export the msvc toolchain in windows.config instead of when -# building the recipe, and there won't be any MinGW toolchain paths -os.environ['CERBERO_EXPORT_MSVC'] = '1' diff --git a/config/windows.config b/config/windows.config index c9affbb6..9ff2d170 100644 --- a/config/windows.config +++ b/config/windows.config @@ -8,7 +8,13 @@ from cerbero.config import Architecture, Platform # We don't want anything from mingw or msys detected in configure and # used later. -allow_system_libs=False +allow_system_libs = False + +# We currently don't use Visual Studio by default anywhere +if 'visualstudio' not in variants: + variants.append('novisualstudio') +elif for_shell and msvc_export_for_shell is None: + msvc_export_for_shell = '1' if platform == Platform.WINDOWS: separator = ';' @@ -39,7 +45,7 @@ def cmd(command): return '%s-%s' % (host, command) # Default GCC compiler flags -if 'CERBERO_EXPORT_MSVC' not in os.environ: +if not msvc_export_for_shell: os.environ['CFLAGS'] = '-Wall -g -O2 ' os.environ['CXXFLAGS'] = '-Wall -g -O2 ' os.environ['OBJCFLAGS'] = '-Wall -g -O2 ' @@ -54,7 +60,7 @@ os.environ['CXXFLAGS']=os.environ['CFLAGS'] os.environ['PERL'] = 'perl' os.environ['NM']= cmd('nm') os.environ['DLLTOOL']= cmd('dlltool') -if 'CERBERO_EXPORT_MSVC' not in os.environ: +if not msvc_export_for_shell: os.environ['LIBRARY_PATH'] = "{0}/lib{1}".format(prefix, lib_suffix) os.environ['CC']= '%s%s' % (ccache, cmd('gcc')) os.environ['CXX']= '%s%s' % (ccache, cmd('g++')) @@ -88,10 +94,6 @@ if platform == Platform.WINDOWS: os.environ['ACLOCAL'] = 'aclocal-1.11' - # We currently don't use Visual Studio by default on Windows - if 'visualstudio' not in variants: - variants.append('novisualstudio') - from cerbero.ide.vs.env import get_msvc_env, append_path # Contains only the env vars that MSVC needs, including any existing vars # that were appended/prepended and have new values @@ -116,14 +118,14 @@ if platform == Platform.WINDOWS: # add them to CFLAGS. mingw_toolchain_env = {'CPPFLAGS': ('-I%s/%s/include/directx' % (toolchain_prefix, host), ' ')} # Export the env for a shell - if os.environ.get('CERBERO_EXPORT_MSVC', None) == '1': + if msvc_export_for_shell == '1': for var, (val, sep) in msvc_toolchain_env.items(): if var == 'PATH': os.environ[var] = '{}{}{}'.format(val, sep, os.environ[var]) else: os.environ[var] = val # Don't set this twice - os.environ['CERBERO_EXPORT_MSVC'] = '2' + msvc_export_for_shell = '2' else: # For cross-mingw, we need to set this in the env so it's added to the # cross file before Meson is run. |