Commit f38df32d authored by Nirbheek Chauhan's avatar Nirbheek Chauhan 🐜
Browse files

windows.config: Avoid leading spaces in LDFLAGS

Same fix as 78f06dd4, this time for
32-bit builds. In the process, also reworked `cmd()` to support
arguments and wrappers to avoid having to add extra spaces at the
start and end of arguments and command wrappers.
parent 12f59e36
......@@ -27,9 +27,9 @@ else:
if target_arch == Architecture.X86:
buildname='windows_x86'
arch_flags = ' -m32 '
arch_rcflags = ' -F pe-i386 '
dlltool_flags = '--as-flags=--32 -m i386'
arch_flags = '-m32 '
arch_rcflags = '-F pe-i386 '
dlltool_flags = '--as-flags=--32 -m i386 '
host = 'i386-w64-mingw32'
_path = 'multilib'
else:
......@@ -50,8 +50,14 @@ if not mingw_perl_prefix:
if not tools_prefix:
tools_prefix = 'x86_64-w64-mingw32-'
def cmd(command):
return '%s%s' % (tools_prefix, command)
def cmd(command, args='', wrapper=''):
ret = '%s%s' % (tools_prefix, command)
# Ensure that there's a space between the cmd and the args
if args:
ret += ' ' + args
if wrapper:
ret = wrapper + ' ' + ret
return ret
# Default GCC compiler flags
if not for_shell or 'novisualstudio' in variants:
......@@ -64,26 +70,26 @@ if not for_shell or 'novisualstudio' in variants:
else:
env['CFLAGS'] = ''
ccache = use_ccache and 'ccache ' or ''
ccache = use_ccache and 'ccache' or ''
# Toolchain environment
env['CFLAGS'] += " -DWINVER=0x0600 -D_WIN32_WINNT=0x0600 "
env['CXXFLAGS']=env['CFLAGS']
env['PERL'] = 'perl'
env['NM']= cmd('nm')
env['DLLTOOL']= cmd('dlltool') + ' ' + dlltool_flags
env['DLLTOOL']= cmd('dlltool', dlltool_flags)
if not for_shell or 'novisualstudio' in variants:
env['LIBRARY_PATH'] = "{0}/lib{1}".format(prefix, lib_suffix)
env['CC']= '%s%s' % (ccache, cmd('gcc' + arch_flags))
env['CXX']= '%s%s' % (ccache, cmd('g++'+ arch_flags))
env['CC']= cmd('gcc', arch_flags, ccache)
env['CXX']= cmd('g++', arch_flags, ccache)
env['LD']= cmd('ld')
env['CPP']= cmd('cpp')
env['RANLIB']= cmd('ranlib')
env['AR']= cmd('ar')
env['AS']= cmd('as')
env['STRIP']= cmd('strip')
env['WINDRES']= cmd('windres') + ' ' + arch_rcflags
env['RC']= cmd('windres') + ' ' + arch_rcflags
env['WINDRES']= cmd('windres', arch_rcflags)
env['RC']= cmd('windres', arch_rcflags)
# MinGW toolchain PATH
toolchainbin = os.path.join(toolchain_prefix, 'bin')
if toolchainbin not in env['PATH']:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment