fixed bug #1635841 - gcc strict-aliasing and build system

- added STRIP, APPEND_CCFLAGS and APPEND_LINKFLAGS command line options
 - added -fno-strict-aliasing to stubs and plug-ins


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4863 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2007-01-23 17:01:54 +00:00
parent ce18bd8cb8
commit bd86ee1bfc
2 changed files with 12 additions and 4 deletions

View file

@ -64,8 +64,9 @@ if not defenv['DEBUG']:
stub_env.Append(CCFLAGS = '-Os') # optimize for size stub_env.Append(CCFLAGS = '-Os') # optimize for size
stub_env.Append(CCFLAGS = '-Wall') # all warnings stub_env.Append(CCFLAGS = '-Wall') # all warnings
stub_env.Append(CCFLAGS = '-x c') # force compile as c stub_env.Append(CCFLAGS = '-x c') # force compile as c
stub_env.Append(CCFLAGS = '-fno-strict-aliasing') # not safe for strict aliasing
if not defenv['DEBUG']: if not defenv['DEBUG'] and defenv['STRIP']:
stub_env.Append(LINKFLAGS = '-s') # strip stub_env.Append(LINKFLAGS = '-s') # strip
stub_env.Append(LINKFLAGS = '-mwindows') # build windows executables stub_env.Append(LINKFLAGS = '-mwindows') # build windows executables
stub_env.Append(LINKFLAGS = '$NODEFLIBS_FLAG') # no standard libraries stub_env.Append(LINKFLAGS = '$NODEFLIBS_FLAG') # no standard libraries
@ -83,7 +84,7 @@ makensis_env.Append(CCFLAGS = '-Wall') # all warnings
conf = FlagsConfigure(makensis_env) conf = FlagsConfigure(makensis_env)
conf.CheckLinkFlag('$MAP_FLAG') # generate map file conf.CheckLinkFlag('$MAP_FLAG') # generate map file
if not defenv['DEBUG']: if not defenv['DEBUG'] and defenv['STRIP']:
TestStrip(conf) # strip TestStrip(conf) # strip
conf.Finish() conf.Finish()
@ -95,8 +96,9 @@ cross_env(plugin_env)
if not defenv['DEBUG']: if not defenv['DEBUG']:
plugin_env.Append(CCFLAGS = '-Os') # optimize for size plugin_env.Append(CCFLAGS = '-Os') # optimize for size
plugin_env.Append(CCFLAGS = '-Wall') # level 3 warnings plugin_env.Append(CCFLAGS = '-Wall') # level 3 warnings
plugin_env.Append(CCFLAGS = '-fno-strict-aliasing') # not safe for strict aliasing
if not defenv['DEBUG']: if not defenv['DEBUG'] and defenv['STRIP']:
plugin_env.Append(LINKFLAGS = '-s') # strip plugin_env.Append(LINKFLAGS = '-s') # strip
plugin_env.Append(LINKFLAGS = '-mwindows') # build windows executables plugin_env.Append(LINKFLAGS = '-mwindows') # build windows executables
plugin_env.Append(LINKFLAGS = '$ALIGN_FLAG') # 512 bytes align plugin_env.Append(LINKFLAGS = '$ALIGN_FLAG') # 512 bytes align
@ -112,7 +114,7 @@ cp_util_env.Append(CCFLAGS = '-Wall') # all warnings
conf = FlagsConfigure(cp_util_env) conf = FlagsConfigure(cp_util_env)
conf.CheckLinkFlag('$MAP_FLAG') # generate map file conf.CheckLinkFlag('$MAP_FLAG') # generate map file
if not defenv['DEBUG']: if not defenv['DEBUG'] and defenv['STRIP']:
TestStrip(conf) # strip TestStrip(conf) # strip
conf.Finish() conf.Finish()

View file

@ -133,9 +133,12 @@ opts.Add(BoolOption('MSTOOLKIT', 'Use Microsoft Visual C++ Toolkit', 'no'))
opts.Add(BoolOption('CHMDOCS', 'Build CHM documentation, requires hhc.exe', hhc)) opts.Add(BoolOption('CHMDOCS', 'Build CHM documentation, requires hhc.exe', hhc))
opts.Add(PathOption('CPPPATH', 'Path to search for include files', None)) opts.Add(PathOption('CPPPATH', 'Path to search for include files', None))
opts.Add(PathOption('LIBPATH', 'Path to search for libraries', None)) opts.Add(PathOption('LIBPATH', 'Path to search for libraries', None))
opts.Add(('APPEND_CCFLAGS', 'Additional C/C++ compiler flags'))
opts.Add(('APPEND_LINKFLAGS', 'Additional linker flags'))
# build options # build options
opts.Add(BoolOption('DEBUG', 'Build executables with debugging information', 'no')) opts.Add(BoolOption('DEBUG', 'Build executables with debugging information', 'no'))
opts.Add(PathOption('CODESIGNER', 'A program used to sign executables', None)) opts.Add(PathOption('CODESIGNER', 'A program used to sign executables', None))
opts.Add(BoolOption('STRIP', 'Strips executables of any unrequired data such as symbols', 'yes'))
# path related build options # path related build options
opts.Add(('PREFIX_DEST', 'Intermediate installation prefix (extra install time prefix)', dirs['dest'])) opts.Add(('PREFIX_DEST', 'Intermediate installation prefix (extra install time prefix)', dirs['dest']))
opts.Add(('PREFIX_CONF', 'Path to install nsisconf.nsh to', dirs['conf'])) opts.Add(('PREFIX_CONF', 'Path to install nsisconf.nsh to', dirs['conf']))
@ -303,6 +306,9 @@ else:
if defenv['MSTOOLKIT']: if defenv['MSTOOLKIT']:
defenv.Tool('mstoolkit', toolpath = ['SCons/Tools']) defenv.Tool('mstoolkit', toolpath = ['SCons/Tools'])
defenv.Append(CCFLAGS = Split('$APPEND_CCFLAGS'))
defenv.Append(LINKFLAGS = Split('$APPEND_LINKFLAGS'))
defenv.Default('$BUILD_PREFIX') defenv.Default('$BUILD_PREFIX')
tools = defenv['TOOLS'] tools = defenv['TOOLS']