From bd86ee1bfc2918a59cc8a38e84d9f314e363155e Mon Sep 17 00:00:00 2001 From: kichik Date: Tue, 23 Jan 2007 17:01:54 +0000 Subject: [PATCH] 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 --- SCons/Config/gnu | 10 ++++++---- SConstruct | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/SCons/Config/gnu b/SCons/Config/gnu index fb52f5c8..ff5947f5 100644 --- a/SCons/Config/gnu +++ b/SCons/Config/gnu @@ -64,8 +64,9 @@ if not defenv['DEBUG']: stub_env.Append(CCFLAGS = '-Os') # optimize for size stub_env.Append(CCFLAGS = '-Wall') # all warnings 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 = '-mwindows') # build windows executables 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.CheckLinkFlag('$MAP_FLAG') # generate map file -if not defenv['DEBUG']: +if not defenv['DEBUG'] and defenv['STRIP']: TestStrip(conf) # strip conf.Finish() @@ -95,8 +96,9 @@ cross_env(plugin_env) if not defenv['DEBUG']: plugin_env.Append(CCFLAGS = '-Os') # optimize for size 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 = '-mwindows') # build windows executables 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.CheckLinkFlag('$MAP_FLAG') # generate map file -if not defenv['DEBUG']: +if not defenv['DEBUG'] and defenv['STRIP']: TestStrip(conf) # strip conf.Finish() diff --git a/SConstruct b/SConstruct index 125f8bf9..6f70f770 100644 --- a/SConstruct +++ b/SConstruct @@ -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(PathOption('CPPPATH', 'Path to search for include files', 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 opts.Add(BoolOption('DEBUG', 'Build executables with debugging information', 'no')) 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 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'])) @@ -303,6 +306,9 @@ else: if defenv['MSTOOLKIT']: defenv.Tool('mstoolkit', toolpath = ['SCons/Tools']) +defenv.Append(CCFLAGS = Split('$APPEND_CCFLAGS')) +defenv.Append(LINKFLAGS = Split('$APPEND_LINKFLAGS')) + defenv.Default('$BUILD_PREFIX') tools = defenv['TOOLS']