new build system using SCons

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3969 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2005-04-16 18:48:50 +00:00
parent 21d72bba17
commit b604cdfe3f
29 changed files with 1461 additions and 0 deletions

32
SCons/Config/default Normal file
View file

@ -0,0 +1,32 @@
print "Using default tools configuration"
Import('defenv')
### flags
defenv['ENTRY_FLAG'] = lambda x: ''
defenv['MAP_FLAG'] = lambda x: ''
defenv['EXCEPTION_FLAG'] = ''
defenv['NODEFLIBS_FLAG'] = ''
defenv['C_FLAG'] = ''
defenv['CPP_FLAG'] = ''
### stub environment
stub_env = defenv.Copy()
### makensis environment
makensis_env = defenv.Copy()
### plugin environment
plugin_env = defenv.Copy(no_import_lib = 1)
### util environment
util_env = defenv.Copy()
# return
Return('stub_env makensis_env plugin_env util_env')

94
SCons/Config/gnu Normal file
View file

@ -0,0 +1,94 @@
print "Using GNU tools configuration"
Import('defenv')
### workarounds
# patch #1184316 for SCons
# http://sourceforge.net/tracker/?func=detail&aid=1184316&group_id=30337&atid=398973
defenv['RCCOM'] = '$RC $RCINCFLAGS $RCINCPREFIX $SOURCE.dir $RCFLAGS -i $SOURCE -o $TARGET'
### cross compiling
import SCons.Util
res_action = Action('$RCCOM', '$RCCOMSTR')
res_builder = Builder(action=res_action, suffix='.o')
def cross_env(env):
if env['MINGWPREFIX']:
prefix = env['MINGWPREFIX']
env['CC'] = prefix + '-gcc'
env['CXX'] = prefix + '-g++'
env['LINK'] = prefix + '-ld'
env['RC'] = prefix + '-windres'
env['RCFLAGS'] = SCons.Util.CLVar('')
env['RCINCFLAGS'] = '$( ${_concat(RCINCPREFIX, CPPPATH, RCINCSUFFIX, __env__, RDirs, TARGET)} $)'
env['RCINCPREFIX'] = '--include-dir '
env['RCINCSUFFIX'] = ''
env['RCCOM'] = '$RC $RCINCFLAGS $RCINCPREFIX $SOURCE.dir $RCFLAGS -i $SOURCE -o $TARGET'
env['BUILDERS']['RES'] = res_builder
### flags
defenv['ENTRY_FLAG'] = lambda x: '-Wl,-e,_' + x + '@16'
defenv['MAP_FLAG'] = lambda x: '-Wl,-Map,' + x + '.map'
defenv['EXCEPTION_FLAG'] = ''
defenv['NODEFLIBS_FLAG'] = '-nostdlib -Wl,--exclude-libs,msvcrt.a'
defenv['C_FLAG'] = '-x c'
defenv['CPP_FLAG'] = '-x c++'
defenv['ALIGN_FLAG'] = '-Wl,--file-alignment,512'
### stub environment
stub_env = defenv.Copy()
cross_env(stub_env)
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(LINKFLAGS = '-s') # strip
stub_env.Append(LINKFLAGS = '-mwindows') # build windows executables
stub_env.Append(LINKFLAGS = '$NODEFLIBS_FLAG') # no standard libraries
stub_env.Append(LINKFLAGS = '$ALIGN_FLAG') # 512 bytes align
stub_env.Append(LINKFLAGS = '-Wl,-e,_WinMain@16') # entry point
### makensis environment
makensis_env = defenv.Copy()
makensis_env.Append(CCFLAGS = '-O2') # optimize
makensis_env.Append(CCFLAGS = '-Wall') # all warnings
makensis_env.Append(LINKFLAGS = '-s') # strip
makensis_env.Append(LINKFLAGS = '$ALIGN_FLAG') # 512 bytes align
### plugin environment
plugin_env = defenv.Copy()
cross_env(plugin_env)
plugin_env.Append(CCFLAGS = '-Os') # optimize for size
plugin_env.Append(CCFLAGS = '-Wall') # level 3 warnings
plugin_env.Append(LINKFLAGS = '-s') # strip
plugin_env.Append(LINKFLAGS = '$ALIGN_FLAG') # 512 bytes align
### util environment
util_env = defenv.Copy()
cross_env(util_env)
util_env.Append(CCFLAGS = '-O2') # optimize
util_env.Append(CCFLAGS = '-Wall') # all warnings
util_env.Append(LINKFLAGS = '-s') # strip
util_env.Append(LINKFLAGS = '-mwindows') # build windows executables
util_env.Append(LINKFLAGS = '$ALIGN_FLAG') # 512 bytes align
# return
Return('stub_env makensis_env plugin_env util_env')

55
SCons/Config/ms Normal file
View file

@ -0,0 +1,55 @@
print "Using Microsoft tools configuration"
Import('defenv')
### flags
defenv['ENTRY_FLAG'] = lambda x: '/entry:' + x
defenv['MAP_FLAG'] = lambda x: '/map'
defenv['EXCEPTION_FLAG'] = '/GX'
defenv['NODEFLIBS_FLAG'] = '/NODEFAULTLIB'
defenv['C_FLAG'] = '/TC'
defenv['CPP_FLAG'] = '/TP'
### stub environment
stub_env = defenv.Copy()
stub_env.Append(CCFLAGS = '/O1') # optimize for size
stub_env.Append(CCFLAGS = '/W3') # level 3 warnings
stub_env.Append(LINKFLAGS = '/opt:nowin98') # 512 bytes align
stub_env.Append(LINKFLAGS = '/entry:WinMain') # entry point
stub_env.Append(LINKFLAGS = '/NODEFAULTLIB') # no default libraries
### makensis environment
makensis_env = defenv.Copy()
makensis_env.Append(CCFLAGS = '/O2') # optimize for speed
makensis_env.Append(CCFLAGS = '/GX') # enable exceptions
makensis_env.Append(CCFLAGS = '/W3') # level 3 warnings
makensis_env.Append(LINKFLAGS = '/opt:nowin98') # 512 bytes align
### plugin environment
plugin_env = defenv.Copy(no_import_lib = 1)
plugin_env.Append(CCFLAGS = '/O1') # optimize for size
plugin_env.Append(CCFLAGS = '/W3') # level 3 warnings
plugin_env.Append(LINKFLAGS = '/opt:nowin98') # 512 bytes align
### util environment
util_env = defenv.Copy()
util_env.Append(CCFLAGS = '/O1') # optimize for speed
util_env.Append(CCFLAGS = '/W3') # level 3 warnings
util_env.Append(LINKFLAGS = '/opt:nowin98') # 512 bytes align
# return
Return('stub_env makensis_env plugin_env util_env')