summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-10-11 19:47:30 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-10-11 19:49:38 +0530
commit4c6724e7ac04c6866c226bf9ff0d5c1e8e0a1ee4 (patch)
tree88a5328575870f6cec4c2b2ddfa56d626920237a
parent57ee182e00d1cbf147c1d85c55122dc71cba5859 (diff)
cerbero: Don't export MinGW toolchain paths in MSVC shells
This file is sourced twice, so by deleting CERBERO_EXPORT_MSVC after exporting the MSVC environment, we were then exporting the MinGW toolchain env vars the second time around.
-rw-r--r--config/windows.config15
1 files changed, 7 insertions, 8 deletions
diff --git a/config/windows.config b/config/windows.config
index a3b15b06..276a1697 100644
--- a/config/windows.config
+++ b/config/windows.config
@@ -38,10 +38,8 @@ if not mingw_perl_prefix:
def cmd(command):
return '%s-%s' % (host, command)
-export_msvc = ('CERBERO_EXPORT_MSVC' in os.environ) and (platform == Platform.WINDOWS)
-
# Default GCC compiler flags
-if not export_msvc:
+if 'CERBERO_EXPORT_MSVC' not in os.environ:
os.environ['CFLAGS'] = '-Wall -g -O2 '
os.environ['CXXFLAGS'] = '-Wall -g -O2 '
os.environ['OBJCFLAGS'] = '-Wall -g -O2 '
@@ -56,7 +54,7 @@ os.environ['CXXFLAGS']=os.environ['CFLAGS']
os.environ['PERL'] = 'perl'
os.environ['NM']= cmd('nm')
os.environ['DLLTOOL']= cmd('dlltool')
-if not export_msvc:
+if 'CERBERO_EXPORT_MSVC' not in os.environ:
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++'))
@@ -68,9 +66,9 @@ if not export_msvc:
os.environ['STRIP']= cmd('strip')
os.environ['WINDRES']= cmd('windres')
os.environ['RC']= cmd('windres')
- # PATH
+ # MinGW toolchain PATH
toolchainbin = os.path.join(toolchain_prefix, 'bin')
- if os.path.isdir(toolchainbin) and not toolchainbin in os.environ['PATH']:
+ if os.path.isdir(toolchainbin) and toolchainbin not in os.environ['PATH']:
os.environ['PATH'] = '%s%s%s' % (toolchainbin, separator, os.environ['PATH'])
os.environ['ne_cv_libsfor_socket'] = '-lws2_32'
@@ -108,14 +106,15 @@ if platform == Platform.WINDOWS:
# accidentally use these when building with MSVC, so we don't unconditionally
# add them to CFLAGS.
mingw_toolchain_env = {'CPPFLAGS': ('-I%s/%s/include/directx' % (toolchain_prefix, host), ' ')}
- if export_msvc:
+ # Export the env for a shell
+ if os.environ.get('CERBERO_EXPORT_MSVC', None) == '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
- del os.environ['CERBERO_EXPORT_MSVC']
+ os.environ['CERBERO_EXPORT_MSVC'] = '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.