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:
parent
21d72bba17
commit
b604cdfe3f
29 changed files with 1461 additions and 0 deletions
20
Contrib/AdvSplash/SConscript
Normal file
20
Contrib/AdvSplash/SConscript
Normal file
|
@ -0,0 +1,20 @@
|
|||
target = 'AdvSplash'
|
||||
|
||||
files = Split("""
|
||||
AdvSplash.c
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
user32
|
||||
gdi32
|
||||
winmm
|
||||
""")
|
||||
|
||||
Import('PluginEnv')
|
||||
|
||||
env = PluginEnv(target)
|
||||
|
||||
plugin = env.SharedLibrary(target, files, LIBS = libs)
|
||||
|
||||
Return('plugin')
|
18
Contrib/Banner/SConscript
Normal file
18
Contrib/Banner/SConscript
Normal file
|
@ -0,0 +1,18 @@
|
|||
target = 'Banner'
|
||||
|
||||
files = Split("""
|
||||
Banner.c
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
user32
|
||||
""")
|
||||
|
||||
Import('PluginEnv')
|
||||
|
||||
env = PluginEnv(target)
|
||||
|
||||
plugin = env.SharedLibrary(target, files, LIBS = libs)
|
||||
|
||||
Return('plugin')
|
20
Contrib/BgImage/SConscript
Normal file
20
Contrib/BgImage/SConscript
Normal file
|
@ -0,0 +1,20 @@
|
|||
target = 'BgImage'
|
||||
|
||||
files = Split("""
|
||||
BgImage.cpp
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
user32
|
||||
gdi32
|
||||
winmm
|
||||
""")
|
||||
|
||||
Import('PluginEnv')
|
||||
|
||||
env = PluginEnv(target)
|
||||
|
||||
plugin = env.SharedLibrary(target, files, LIBS = libs)
|
||||
|
||||
Return('plugin')
|
19
Contrib/Dialer/SConscript
Normal file
19
Contrib/Dialer/SConscript
Normal file
|
@ -0,0 +1,19 @@
|
|||
target = 'Dialer'
|
||||
|
||||
files = Split("""
|
||||
dialer.c
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
wininet
|
||||
delayimp
|
||||
""")
|
||||
|
||||
Import('PluginEnv')
|
||||
|
||||
env = PluginEnv(target)
|
||||
|
||||
plugin = env.SharedLibrary(target, files, LIBS = libs)
|
||||
|
||||
Return('plugin')
|
27
Contrib/InstallOptions/SConscript
Normal file
27
Contrib/InstallOptions/SConscript
Normal file
|
@ -0,0 +1,27 @@
|
|||
target = 'InstallOptions'
|
||||
|
||||
files = Split("""
|
||||
InstallerOptions.cpp
|
||||
""")
|
||||
|
||||
resources = Split("""
|
||||
ioptdll.rc
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
user32
|
||||
gdi32
|
||||
shell32
|
||||
comdlg32
|
||||
""")
|
||||
|
||||
Import('PluginEnv')
|
||||
|
||||
env = PluginEnv(target)
|
||||
|
||||
files += env.RES(resources)
|
||||
|
||||
plugin = env.SharedLibrary(target, files, LIBS = libs)
|
||||
|
||||
Return('plugin')
|
25
Contrib/LangDLL/SConscript
Normal file
25
Contrib/LangDLL/SConscript
Normal file
|
@ -0,0 +1,25 @@
|
|||
target = 'LangDLL'
|
||||
|
||||
files = Split("""
|
||||
LangDLL.c
|
||||
""")
|
||||
|
||||
resources = Split("""
|
||||
resource.rc
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
user32
|
||||
gdi32
|
||||
""")
|
||||
|
||||
Import('PluginEnv')
|
||||
|
||||
env = PluginEnv(target)
|
||||
|
||||
files += env.RES(resources)
|
||||
|
||||
plugin = env.SharedLibrary(target, files, LIBS = libs)
|
||||
|
||||
Return('plugin')
|
15
Contrib/Library/LibraryLocal/SConscript
Normal file
15
Contrib/Library/LibraryLocal/SConscript
Normal file
|
@ -0,0 +1,15 @@
|
|||
target = 'LibraryLocal'
|
||||
|
||||
files = Split("""
|
||||
LibraryLocal.cpp
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
oleaut32
|
||||
version
|
||||
""")
|
||||
|
||||
Import('BuildUtil')
|
||||
|
||||
BuildUtil(target, files, libs, flags = ['$EXCEPTION_FLAG'], install = 'Bin')
|
19
Contrib/Library/TypeLib/SConscript
Normal file
19
Contrib/Library/TypeLib/SConscript
Normal file
|
@ -0,0 +1,19 @@
|
|||
target = 'TypeLib'
|
||||
|
||||
files = Split("""
|
||||
TypeLib.cpp
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
user32
|
||||
oleaut32
|
||||
""")
|
||||
|
||||
Import('PluginEnv')
|
||||
|
||||
env = PluginEnv(target, entry = 'DllMain')
|
||||
|
||||
plugin = env.SharedLibrary(target, files, LIBS = libs)
|
||||
|
||||
Return('plugin')
|
19
Contrib/MakeLangId/SConscript
Normal file
19
Contrib/MakeLangId/SConscript
Normal file
|
@ -0,0 +1,19 @@
|
|||
target = "MakeLangId"
|
||||
|
||||
files = Split("""
|
||||
MakeLangId.cpp
|
||||
""")
|
||||
|
||||
resources = Split("""
|
||||
resource.rc
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
user32
|
||||
""")
|
||||
|
||||
Import('BuildUtil')
|
||||
|
||||
BuildUtil(target, files, libs, res = resources, entry = 'WinMain', install = 'Bin')
|
||||
|
47
Contrib/Makensisw/SConscript
Normal file
47
Contrib/Makensisw/SConscript
Normal file
|
@ -0,0 +1,47 @@
|
|||
target = 'makensisw'
|
||||
|
||||
files = Split("""
|
||||
makensisw.cpp
|
||||
noclib.cpp
|
||||
toolbar.cpp
|
||||
utils.cpp
|
||||
version.cpp
|
||||
""")
|
||||
|
||||
res = Split("""
|
||||
resource.rc
|
||||
""")
|
||||
|
||||
resources = Split("""
|
||||
shell.ico
|
||||
makensisw.xml
|
||||
logo.bmp
|
||||
toolbar.bmp
|
||||
toolbar24.bmp
|
||||
toolbar24d.bmp
|
||||
toolbar24h.bmp
|
||||
#Contrib/Graphics/Icons/modern-install-blue-full.ico
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
advapi32
|
||||
user32
|
||||
gdi32
|
||||
shell32
|
||||
comdlg32
|
||||
comctl32
|
||||
""")
|
||||
|
||||
Import('BuildUtil')
|
||||
|
||||
BuildUtil(
|
||||
target,
|
||||
files,
|
||||
libs,
|
||||
res = res,
|
||||
resources = resources,
|
||||
entry = 'WinMain',
|
||||
install = '',
|
||||
defines = ['WIN32_MEAN_AND_LEAN', 'RELEASE=2.0']
|
||||
)
|
23
Contrib/Math/SConscript
Normal file
23
Contrib/Math/SConscript
Normal file
|
@ -0,0 +1,23 @@
|
|||
target = 'Math'
|
||||
|
||||
files = Split("""
|
||||
Source/Math.cpp
|
||||
Source/MyMath.cpp
|
||||
Source/plugin.cpp
|
||||
Source/floatp10.c
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
""")
|
||||
|
||||
Import('PluginEnv')
|
||||
|
||||
env = PluginEnv(target, entry = 'DllMain', nodeflib = 0)
|
||||
#env = PluginEnv(target, entry = '_DllMainCRTStartup', vc7 = 1)
|
||||
|
||||
#libs = libs + [File('Source/mathcrt.lib')]
|
||||
|
||||
plugin = env.SharedLibrary(target, files, LIBS = libs)
|
||||
|
||||
Return('plugin')
|
2
Contrib/NSIS Update/SConscript
Normal file
2
Contrib/NSIS Update/SConscript
Normal file
|
@ -0,0 +1,2 @@
|
|||
cmd = Command('#bin/NSISUpdate.exe', 'NSISUpdate.nsi', 'makensis $SOURCE')
|
||||
Depends(cmd, ['makensis', 'stubs', 'System', 'NSISdl', 'Dialer', 'nsExec', 'InstallOptions'])
|
24
Contrib/NSISdl/SConscript
Normal file
24
Contrib/NSISdl/SConscript
Normal file
|
@ -0,0 +1,24 @@
|
|||
target = 'NSISdl'
|
||||
|
||||
files = Split("""
|
||||
asyncdns.cpp
|
||||
connection.cpp
|
||||
httpget.cpp
|
||||
nsisdl.cpp
|
||||
util.cpp
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
user32
|
||||
advapi32
|
||||
ws2_32
|
||||
""")
|
||||
|
||||
Import('PluginEnv')
|
||||
|
||||
env = PluginEnv(target)
|
||||
|
||||
plugin = env.SharedLibrary(target, files, LIBS = libs)
|
||||
|
||||
Return('plugin')
|
20
Contrib/Splash/SConscript
Normal file
20
Contrib/Splash/SConscript
Normal file
|
@ -0,0 +1,20 @@
|
|||
target = 'Splash'
|
||||
|
||||
files = Split("""
|
||||
splash.c
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
user32
|
||||
gdi32
|
||||
winmm
|
||||
""")
|
||||
|
||||
Import('PluginEnv')
|
||||
|
||||
env = PluginEnv(target)
|
||||
|
||||
plugin = env.SharedLibrary(target, files, LIBS = libs)
|
||||
|
||||
Return('plugin')
|
26
Contrib/StartMenu/SConscript
Normal file
26
Contrib/StartMenu/SConscript
Normal file
|
@ -0,0 +1,26 @@
|
|||
target = 'StartMenu'
|
||||
|
||||
files = Split("""
|
||||
StartMenu.c
|
||||
""")
|
||||
|
||||
resources = Split("""
|
||||
StartMenu.rc
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
user32
|
||||
gdi32
|
||||
shell32
|
||||
""")
|
||||
|
||||
Import('PluginEnv')
|
||||
|
||||
env = PluginEnv(target)
|
||||
|
||||
files += env.RES('StartMenuRC', resources)
|
||||
|
||||
plugin = env.SharedLibrary(target, files, LIBS = libs)
|
||||
|
||||
Return('plugin')
|
33
Contrib/System/SConscript
Normal file
33
Contrib/System/SConscript
Normal file
|
@ -0,0 +1,33 @@
|
|||
target = 'System'
|
||||
|
||||
files = Split("""
|
||||
Source/Buffers.c
|
||||
Source/Plugin.c
|
||||
Source/System.c
|
||||
""")
|
||||
|
||||
objs = Split("""
|
||||
Source/chkstk.obj
|
||||
Source/vc7ldvrm.obj
|
||||
Source/vc7lmul.obj
|
||||
Source/vc7lshl.obj
|
||||
Source/vc7lshr.obj
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
user32
|
||||
ole32
|
||||
""")
|
||||
|
||||
Import('PluginEnv')
|
||||
|
||||
env = PluginEnv(target, entry = '_DllMainCRTStartup', nodeflib = 0)
|
||||
|
||||
env.Append(CPPDEFINES = ['SYSTEM_EXPORTS'])
|
||||
|
||||
#files += [File(obj) for obj in objs]
|
||||
|
||||
plugin = env.SharedLibrary(target, files, LIBS = libs)
|
||||
|
||||
Return('plugin')
|
18
Contrib/UserInfo/SConscript
Normal file
18
Contrib/UserInfo/SConscript
Normal file
|
@ -0,0 +1,18 @@
|
|||
target = 'UserInfo'
|
||||
|
||||
files = Split("""
|
||||
UserInfo.c
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
advapi32
|
||||
""")
|
||||
|
||||
Import('PluginEnv')
|
||||
|
||||
env = PluginEnv(target)
|
||||
|
||||
plugin = env.SharedLibrary(target, files, LIBS = libs)
|
||||
|
||||
Return('plugin')
|
17
Contrib/VPatch/Source/Plugin/SConscript
Normal file
17
Contrib/VPatch/Source/Plugin/SConscript
Normal file
|
@ -0,0 +1,17 @@
|
|||
target = 'VPatch'
|
||||
|
||||
files = Split("""
|
||||
vpatchdll.c
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
""")
|
||||
|
||||
Import('PluginEnv')
|
||||
|
||||
env = PluginEnv(target, entry = 'DllMain')
|
||||
|
||||
plugin = env.SharedLibrary(target, files, LIBS = libs)
|
||||
|
||||
Return('plugin')
|
19
Contrib/nsExec/SConscript
Normal file
19
Contrib/nsExec/SConscript
Normal file
|
@ -0,0 +1,19 @@
|
|||
target = 'nsExec'
|
||||
|
||||
files = Split("""
|
||||
nsexec.c
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
user32
|
||||
advapi32
|
||||
""")
|
||||
|
||||
Import('PluginEnv')
|
||||
|
||||
env = PluginEnv(target)
|
||||
|
||||
plugin = env.SharedLibrary(target, files, LIBS = libs)
|
||||
|
||||
Return('plugin')
|
41
Contrib/zip2exe/SConscript
Normal file
41
Contrib/zip2exe/SConscript
Normal file
|
@ -0,0 +1,41 @@
|
|||
target = "zip2exe"
|
||||
|
||||
cpp_files = Split("""
|
||||
main.cpp
|
||||
""")
|
||||
|
||||
c_files = Split("""
|
||||
zlib/ADLER32.C
|
||||
zlib/CRC32.C
|
||||
zlib/INFBLOCK.C
|
||||
zlib/INFCODES.C
|
||||
zlib/INFFAST.C
|
||||
zlib/INFLATE.C
|
||||
zlib/INFTREES.C
|
||||
zlib/INFUTIL.C
|
||||
zlib/Unzip.c
|
||||
zlib/Zutil.c
|
||||
""")
|
||||
|
||||
resources = Split("""
|
||||
zip2exe.xml
|
||||
icon.ico
|
||||
""")
|
||||
|
||||
rc = 'res.rc'
|
||||
|
||||
libs = Split("""
|
||||
user32
|
||||
gdi32
|
||||
comctl32
|
||||
comdlg32
|
||||
advapi32
|
||||
shell32
|
||||
""")
|
||||
|
||||
Import('BuildUtil env')
|
||||
|
||||
env.Append(CPPFLAGS = '$C_FLAG')
|
||||
files = env.Object(c_files) + cpp_files
|
||||
|
||||
BuildUtil(target, files, libs, res = rc, resources = resources, install = 'Bin')
|
78
Docs/src/SConscript
Normal file
78
Docs/src/SConscript
Normal file
|
@ -0,0 +1,78 @@
|
|||
config_but = 'config.but'
|
||||
|
||||
chm_config_but = 'chm_config.but'
|
||||
|
||||
buts = Split("""
|
||||
intro.but
|
||||
tutorial.but
|
||||
usage.but
|
||||
script.but
|
||||
var.but
|
||||
labels.but
|
||||
jumps.but
|
||||
pages.but
|
||||
sections.but
|
||||
usection.but
|
||||
functions.but
|
||||
callback.but
|
||||
attributes.but
|
||||
compilerflags.but
|
||||
basic.but
|
||||
registry.but
|
||||
generalpurpose.but
|
||||
flowcontrol.but
|
||||
file.but
|
||||
uninstall.but
|
||||
misc.but
|
||||
string.but
|
||||
stack.but
|
||||
int.but
|
||||
reboot.but
|
||||
log.but
|
||||
sec.but
|
||||
ui.but
|
||||
langs.but
|
||||
plugin.but
|
||||
silent.but
|
||||
compiler.but
|
||||
defines.but
|
||||
modernui.but
|
||||
library.but
|
||||
usefulfunc.but
|
||||
usefulinfos.but
|
||||
history.but
|
||||
credits.but
|
||||
license.but
|
||||
""")
|
||||
|
||||
import os
|
||||
|
||||
Import('halibut prefix')
|
||||
|
||||
env = Environment(ENV = {'PATH' : os.environ['PATH']})
|
||||
|
||||
build_dir = Dir(GetBuildPath('.')).abspath
|
||||
|
||||
hhc_action = Action('cd "%s" && hhc nsis.hhp' % (build_dir))
|
||||
execute = hhc_action.execute
|
||||
def rexecute(*args):
|
||||
return execute(*args) != 1 # hhc returns 1 on success
|
||||
hhc_action.execute = rexecute
|
||||
|
||||
builder = Builder(
|
||||
action = [
|
||||
Copy(build_dir, '${SOURCE.dir}/../style.css'),
|
||||
Copy(build_dir, '${SOURCE.dir}/chmlink.js'),
|
||||
Copy(build_dir, '${SOURCE.dir}/nsis.hhp'),
|
||||
Action('cd "%s" && "%s" ${SOURCES.abspath}' % (build_dir, halibut[0].abspath)),
|
||||
hhc_action
|
||||
]
|
||||
)
|
||||
|
||||
env.Append(BUILDERS = {'HalibutCHM' : builder})
|
||||
|
||||
#env.Halibut([config_but] + buts)
|
||||
chm = env.HalibutCHM('NSIS.chm', [chm_config_but] + buts)
|
||||
env.Depends(chm, halibut)
|
||||
|
||||
env.Install(prefix, chm)
|
28
Docs/src/bin/halibut/SConscript
Normal file
28
Docs/src/bin/halibut/SConscript
Normal file
|
@ -0,0 +1,28 @@
|
|||
target = 'halibut'
|
||||
|
||||
files = Split("""
|
||||
biblio.c
|
||||
bk_xhtml.c
|
||||
contents.c
|
||||
error.c
|
||||
help.c
|
||||
index.c
|
||||
input.c
|
||||
keywords.c
|
||||
licence.c
|
||||
main.c
|
||||
malloc.c
|
||||
misc.c
|
||||
style.c
|
||||
tree234.c
|
||||
ustring.c
|
||||
version.c
|
||||
""")
|
||||
|
||||
env = Environment()
|
||||
|
||||
env.Append(CPPDEFINES = ['VERSION=\\"1.0 (NSIS Custom Build)\\"'])
|
||||
|
||||
halibut = env.Program(target, files)
|
||||
|
||||
Return('halibut')
|
32
SCons/Config/default
Normal file
32
SCons/Config/default
Normal 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
94
SCons/Config/gnu
Normal 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
55
SCons/Config/ms
Normal 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')
|
338
SCons/Tools/mstoolkit.py
Normal file
338
SCons/Tools/mstoolkit.py
Normal file
|
@ -0,0 +1,338 @@
|
|||
"""engine.SCons.Tool.mstoolkit.py
|
||||
|
||||
Tool-specific initialization for Microsoft Visual C/C++ Toolkit Commandline
|
||||
|
||||
There normally shouldn't be any need to import this module directly.
|
||||
It will usually be imported through the generic SCons.Tool.Tool()
|
||||
selection method.
|
||||
|
||||
"""
|
||||
|
||||
# Based on http://www.scons.org/cgi-bin/wiki/MicrosoftPlatform
|
||||
|
||||
#
|
||||
# Copyright (c) 2004 John Connors
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
|
||||
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
|
||||
|
||||
import os.path
|
||||
import re
|
||||
import string
|
||||
import types
|
||||
|
||||
import SCons.Action
|
||||
import SCons.Builder
|
||||
import SCons.Errors
|
||||
import SCons.Platform.win32
|
||||
import SCons.Tool
|
||||
import SCons.Util
|
||||
import SCons.Warnings
|
||||
|
||||
CSuffixes = ['.c', '.C']
|
||||
CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++']
|
||||
|
||||
def get_msvctoolkit_paths():
|
||||
"""Return a 4-tuple of (INCLUDE, LIB, PATH, TOOLKIT) as the values of those
|
||||
three environment variables that should be set in order to execute
|
||||
the MSVC .NET tools properly, if the information wasn't available
|
||||
from the registry."""
|
||||
|
||||
MSToolkitDir = None
|
||||
paths = {}
|
||||
exe_path = ''
|
||||
lib_path = ''
|
||||
include_path = ''
|
||||
|
||||
# First, we get the shell folder for this user:
|
||||
if not SCons.Util.can_read_reg:
|
||||
raise SCons.Errors.InternalError, "No Windows registry module was found"
|
||||
|
||||
# look for toolkit
|
||||
if os.environ.has_key('VCToolkitInstallDir'):
|
||||
MSToolkitDir = os.path.normpath(os.environ['VCToolkitInstallDir'])
|
||||
else:
|
||||
# last resort -- default install location
|
||||
MSToolkitDir = r'C:\Program Files\Microsoft Visual C++ Toolkit 2003'
|
||||
|
||||
# look for platform sdk
|
||||
PlatformSDKDir = ""
|
||||
try:
|
||||
PlatformSDKDir = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\MicrosoftSDK\Directories\Install Dir')[0]
|
||||
PlatformSDKDir = str(PlatformSDKDir)
|
||||
except SCons.Util.RegError:
|
||||
raise SCons.Errors.InternalError, "The Platform SDK directory was not found in the registry."
|
||||
|
||||
include_path = r'%s\include;%s\include' % (MSToolkitDir, PlatformSDKDir)
|
||||
lib_path = r'%s\lib;%s\lib' % (MSToolkitDir, PlatformSDKDir)
|
||||
exe_path = r'%s\bin;%s\bin\win95;%s\bin' % (MSToolkitDir, PlatformSDKDir, PlatformSDKDir)
|
||||
return (include_path, lib_path, exe_path, PlatformSDKDir)
|
||||
|
||||
def validate_vars(env):
|
||||
"""Validate the PDB, PCH, and PCHSTOP construction variables."""
|
||||
if env.has_key('PCH') and env['PCH']:
|
||||
if not env.has_key('PCHSTOP'):
|
||||
raise SCons.Errors.UserError, "The PCHSTOP construction must be defined if PCH is defined."
|
||||
if not SCons.Util.is_String(env['PCHSTOP']):
|
||||
raise SCons.Errors.UserError, "The PCHSTOP construction variable must be a string: %r"%env['PCHSTOP']
|
||||
|
||||
def pch_emitter(target, source, env):
|
||||
"""Sets up the PDB dependencies for a pch file, and adds the object
|
||||
file target."""
|
||||
|
||||
validate_vars(env)
|
||||
|
||||
pch = None
|
||||
obj = None
|
||||
|
||||
for t in target:
|
||||
if SCons.Util.splitext(str(t))[1] == '.pch':
|
||||
pch = t
|
||||
if SCons.Util.splitext(str(t))[1] == '.obj':
|
||||
obj = t
|
||||
|
||||
if not obj:
|
||||
obj = SCons.Util.splitext(str(pch))[0]+'.obj'
|
||||
|
||||
target = [pch, obj] # pch must be first, and obj second for the PCHCOM to work
|
||||
|
||||
if env.has_key('PDB') and env['PDB']:
|
||||
env.SideEffect(env['PDB'], target)
|
||||
env.Precious(env['PDB'])
|
||||
|
||||
return (target, source)
|
||||
|
||||
def object_emitter(target, source, env, parent_emitter):
|
||||
"""Sets up the PDB and PCH dependencies for an object file."""
|
||||
|
||||
validate_vars(env)
|
||||
|
||||
parent_emitter(target, source, env)
|
||||
|
||||
if env.has_key('PDB') and env['PDB']:
|
||||
env.SideEffect(env['PDB'], target)
|
||||
env.Precious(env['PDB'])
|
||||
|
||||
if env.has_key('PCH') and env['PCH']:
|
||||
env.Depends(target, env['PCH'])
|
||||
|
||||
return (target, source)
|
||||
|
||||
def static_object_emitter(target, source, env):
|
||||
return object_emitter(target, source, env,
|
||||
SCons.Defaults.StaticObjectEmitter)
|
||||
|
||||
def shared_object_emitter(target, source, env):
|
||||
return object_emitter(target, source, env,
|
||||
SCons.Defaults.SharedObjectEmitter)
|
||||
|
||||
pch_builder = SCons.Builder.Builder(action='$PCHCOM', suffix='.pch', emitter=pch_emitter)
|
||||
res_builder = SCons.Builder.Builder(action='$RCCOM', suffix='.res')
|
||||
|
||||
def pdbGenerator(env, target, source, for_signature):
|
||||
if target and env.has_key('PDB') and env['PDB']:
|
||||
return ['/PDB:%s'%target[0].File(env['PDB']).get_string(for_signature),
|
||||
'/DEBUG']
|
||||
|
||||
def win32ShlinkTargets(target, source, env, for_signature):
|
||||
listCmd = []
|
||||
dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX')
|
||||
if dll: listCmd.append("/out:%s"%dll.get_string(for_signature))
|
||||
|
||||
implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX')
|
||||
if implib: listCmd.append("/implib:%s"%implib.get_string(for_signature))
|
||||
|
||||
return listCmd
|
||||
|
||||
def win32ShlinkSources(target, source, env, for_signature):
|
||||
listCmd = []
|
||||
|
||||
deffile = env.FindIxes(source, "WIN32DEFPREFIX", "WIN32DEFSUFFIX")
|
||||
for src in source:
|
||||
if src == deffile:
|
||||
# Treat this source as a .def file.
|
||||
listCmd.append("/def:%s" % src.get_string(for_signature))
|
||||
else:
|
||||
# Just treat it as a generic source file.
|
||||
listCmd.append(src)
|
||||
return listCmd
|
||||
|
||||
def win32LibEmitter(target, source, env):
|
||||
# SCons.Tool.msvc.validate_vars(env)
|
||||
|
||||
dll = env.FindIxes(target, "SHLIBPREFIX", "SHLIBSUFFIX")
|
||||
no_import_lib = env.get('no_import_lib', 0)
|
||||
|
||||
if not dll:
|
||||
raise SCons.Errors.UserError, "A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX")
|
||||
|
||||
if env.get("WIN32_INSERT_DEF", 0) and \
|
||||
not env.FindIxes(source, "WIN32DEFPREFIX", "WIN32DEFSUFFIX"):
|
||||
|
||||
# append a def file to the list of sources
|
||||
source.append(env.ReplaceIxes(dll,
|
||||
"SHLIBPREFIX", "SHLIBSUFFIX",
|
||||
"WIN32DEFPREFIX", "WIN32DEFSUFFIX"))
|
||||
|
||||
if env.has_key('PDB') and env['PDB']:
|
||||
env.SideEffect(env['PDB'], target)
|
||||
env.Precious(env['PDB'])
|
||||
|
||||
if not no_import_lib and \
|
||||
not env.FindIxes(target, "LIBPREFIX", "LIBSUFFIX"):
|
||||
# Append an import library to the list of targets.
|
||||
target.append(env.ReplaceIxes(dll,
|
||||
"SHLIBPREFIX", "SHLIBSUFFIX",
|
||||
"LIBPREFIX", "LIBSUFFIX"))
|
||||
# and .exp file is created if there are exports from a DLL
|
||||
target.append(env.ReplaceIxes(dll,
|
||||
"SHLIBPREFIX", "SHLIBSUFFIX",
|
||||
"WIN32EXPPREFIX", "WIN32EXPSUFFIX"))
|
||||
|
||||
return (target, source)
|
||||
|
||||
def prog_emitter(target, source, env):
|
||||
#SCons.Tool.msvc.validate_vars(env)
|
||||
|
||||
if env.has_key('PDB') and env['PDB']:
|
||||
env.SideEffect(env['PDB'], target)
|
||||
env.Precious(env['PDB'])
|
||||
|
||||
return (target,source)
|
||||
|
||||
def RegServerFunc(target, source, env):
|
||||
if env.has_key('register') and env['register']:
|
||||
ret = regServerAction([target[0]], [source[0]], env)
|
||||
if ret:
|
||||
raise SCons.Errors.UserError, "Unable to register %s" % target[0]
|
||||
else:
|
||||
print "Registered %s sucessfully" % target[0]
|
||||
return ret
|
||||
return 0
|
||||
|
||||
regServerAction = SCons.Action.Action("$REGSVRCOM")
|
||||
regServerCheck = SCons.Action.Action(RegServerFunc, None)
|
||||
shlibLinkAction = SCons.Action.Action('${TEMPFILE("$SHLINK $SHLINKFLAGS $_SHLINK_TARGETS $( $_LIBDIRFLAGS $) $_LIBFLAGS $_PDB $_SHLINK_SOURCES")}')
|
||||
compositeLinkAction = shlibLinkAction + regServerCheck
|
||||
|
||||
def generate(env):
|
||||
"""Add Builders and construction variables for MSVC++ to an Environment."""
|
||||
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
|
||||
|
||||
for suffix in CSuffixes:
|
||||
static_obj.add_action(suffix, SCons.Defaults.CAction)
|
||||
shared_obj.add_action(suffix, SCons.Defaults.ShCAction)
|
||||
|
||||
for suffix in CXXSuffixes:
|
||||
static_obj.add_action(suffix, SCons.Defaults.CXXAction)
|
||||
shared_obj.add_action(suffix, SCons.Defaults.ShCXXAction)
|
||||
|
||||
SCons.Tool.createStaticLibBuilder(env)
|
||||
SCons.Tool.createSharedLibBuilder(env)
|
||||
SCons.Tool.createProgBuilder(env)
|
||||
|
||||
env['CCPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Zi /Fd%s"%File(PDB)) or ""}'])
|
||||
env['CCPCHFLAGS'] = SCons.Util.CLVar(['${(PCH and "/Yu%s /Fp%s"%(PCHSTOP or "",File(PCH))) or ""}'])
|
||||
env['CCCOMFLAGS'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET $CCPCHFLAGS $CCPDBFLAGS'
|
||||
env['CC'] = 'cl'
|
||||
env['CCFLAGS'] = SCons.Util.CLVar('/nologo')
|
||||
env['CCCOM'] = '$CC $CCFLAGS $CCCOMFLAGS'
|
||||
env['SHCC'] = '$CC'
|
||||
env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS')
|
||||
env['SHCCCOM'] = '$SHCC $SHCCFLAGS $CCCOMFLAGS'
|
||||
env['CXX'] = '$CC'
|
||||
env['CXXFLAGS'] = SCons.Util.CLVar('$CCFLAGS $( /TP $)')
|
||||
env['CXXCOM'] = '$CXX $CXXFLAGS $CCCOMFLAGS'
|
||||
env['SHCXX'] = '$CXX'
|
||||
env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS')
|
||||
env['SHCXXCOM'] = '$SHCXX $SHCXXFLAGS $CCCOMFLAGS'
|
||||
env['CPPDEFPREFIX'] = '/D'
|
||||
env['CPPDEFSUFFIX'] = ''
|
||||
env['INCPREFIX'] = '/I'
|
||||
env['INCSUFFIX'] = ''
|
||||
env['OBJEMITTER'] = static_object_emitter
|
||||
env['SHOBJEMITTER'] = shared_object_emitter
|
||||
env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1
|
||||
|
||||
env['RC'] = 'rc'
|
||||
env['RCFLAGS'] = SCons.Util.CLVar('')
|
||||
env['RCCOM'] = '$RC $_CPPDEFFLAGS $_CPPINCFLAGS $RCFLAGS /fo$TARGET $SOURCES'
|
||||
CScan = env.get_scanner('.c')
|
||||
if CScan:
|
||||
CScan.add_skey('.rc')
|
||||
env['BUILDERS']['RES'] = res_builder
|
||||
|
||||
include_path, lib_path, exe_path, sdk_path = get_msvctoolkit_paths()
|
||||
env.PrependENVPath('INCLUDE', include_path)
|
||||
env.PrependENVPath('LIB', lib_path)
|
||||
env.PrependENVPath('PATH', exe_path)
|
||||
|
||||
env['ENV']['CPU'] = 'i386'
|
||||
env['ENV']['MSSDK'] = sdk_path
|
||||
env['ENV']['BkOffice'] = sdk_path
|
||||
env['ENV']['Basemake'] = sdk_path + "\\Include\\BKOffice.Mak"
|
||||
env['ENV']['INETSDK'] = sdk_path
|
||||
env['ENV']['MSSDK'] = sdk_path
|
||||
env['ENV']['MSTOOLS'] = sdk_path
|
||||
env['ENV']['TARGETOS'] = 'WINNT'
|
||||
env['ENV']['APPVER'] = '5.0'
|
||||
|
||||
env['CFILESUFFIX'] = '.c'
|
||||
env['CXXFILESUFFIX'] = '.cc'
|
||||
|
||||
env['PCHCOM'] = '$CXX $CXXFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo${TARGETS[1]} /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS'
|
||||
env['BUILDERS']['PCH'] = pch_builder
|
||||
|
||||
env['AR'] = '"' +sdk_path + '\\bin\\Win64\\lib.exe"'
|
||||
env['ARFLAGS'] = SCons.Util.CLVar('/nologo')
|
||||
env['ARCOM'] = "${TEMPFILE('$AR $ARFLAGS /OUT:$TARGET $SOURCES')}"
|
||||
|
||||
env['SHLINK'] = '$LINK'
|
||||
env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS /dll')
|
||||
env['_SHLINK_TARGETS'] = win32ShlinkTargets
|
||||
env['_SHLINK_SOURCES'] = win32ShlinkSources
|
||||
env['SHLINKCOM'] = compositeLinkAction
|
||||
env['SHLIBEMITTER']= win32LibEmitter
|
||||
env['LINK'] = '"' +sdk_path + '\\bin\\Win64\\' + 'link.exe"'
|
||||
env['LINKFLAGS'] = SCons.Util.CLVar('/nologo')
|
||||
env['_PDB'] = pdbGenerator
|
||||
env['LINKCOM'] = '${TEMPFILE("$LINK $LINKFLAGS /OUT:$TARGET $( $_LIBDIRFLAGS $) $_LIBFLAGS $_PDB $SOURCES")}'
|
||||
env['PROGEMITTER'] = prog_emitter
|
||||
env['LIBDIRPREFIX']='/LIBPATH:'
|
||||
env['LIBDIRSUFFIX']=''
|
||||
env['LIBLINKPREFIX']=''
|
||||
env['LIBLINKSUFFIX']='$LIBSUFFIX'
|
||||
|
||||
env['WIN32DEFPREFIX'] = ''
|
||||
env['WIN32DEFSUFFIX'] = '.def'
|
||||
env['WIN32_INSERT_DEF'] = 0
|
||||
|
||||
env['WIN32EXPPREFIX'] = ''
|
||||
env['WIN32EXPSUFFIX'] = '.exp'
|
||||
|
||||
env['REGSVRACTION'] = regServerCheck
|
||||
env['REGSVR'] = os.path.join(SCons.Platform.win32.get_system_root(),'System32','regsvr32')
|
||||
env['REGSVRFLAGS'] = '/s '
|
||||
env['REGSVRCOM'] = '$REGSVR $REGSVRFLAGS $TARGET'
|
||||
|
||||
|
||||
def exists(env):
|
||||
return env.Detect('cl')
|
214
SConstruct
Normal file
214
SConstruct
Normal file
|
@ -0,0 +1,214 @@
|
|||
## TODO
|
||||
#
|
||||
# * VPatch GenPat (wait for v3 written in C)
|
||||
# * Get Math to Compile
|
||||
# * Write SConscript for NSIS Menu
|
||||
# - Use inheritance instead of current wxWidgets patches
|
||||
# - Compile for POSIX too? wxWidgets is cross platform after all...
|
||||
# * Write SConscript for Library RegTool (needs to compile makensis with smaller configuration)
|
||||
#
|
||||
##
|
||||
|
||||
stubs = [
|
||||
'bzip2',
|
||||
'lzma',
|
||||
'zlib'
|
||||
]
|
||||
|
||||
plugins = [
|
||||
'AdvSplash',
|
||||
'Banner',
|
||||
'BgImage',
|
||||
'Dialer',
|
||||
'InstallOptions',
|
||||
'LangDLL',
|
||||
'Library/TypeLib',
|
||||
# compile errors 'Math',
|
||||
'nsExec',
|
||||
'NSISdl',
|
||||
'Splash',
|
||||
'StartMenu',
|
||||
'System',
|
||||
'UserInfo',
|
||||
'VPatch/Source/Plugin'
|
||||
]
|
||||
|
||||
utils = [
|
||||
# special makensis 'Library',
|
||||
'Library/LibraryLocal',
|
||||
'MakeLangId',
|
||||
'Makensisw',
|
||||
# wxWidgets 'NSIS Menu',
|
||||
'NSIS Update',
|
||||
'zip2exe'
|
||||
]
|
||||
|
||||
import os
|
||||
|
||||
prefix = GetLaunchDir() + os.sep
|
||||
build_prefix = 'build' + os.sep
|
||||
|
||||
######################################################################
|
||||
####### environments ###
|
||||
######################################################################
|
||||
|
||||
defenv = Environment()
|
||||
Export('defenv')
|
||||
|
||||
opts = Options()
|
||||
opts.Add(('MINGWPREFIX', 'MinGW toolset prefix'))
|
||||
opts.Add(BoolOption('MSTOOLKIT', 'Use Microsoft Visual C++ Toolkit', 'no'))
|
||||
opts.Add(BoolOption('DEBUG', 'Build executables with debugging information', 'no'))
|
||||
opts.Update(defenv)
|
||||
|
||||
Help(opts.GenerateHelpText(defenv))
|
||||
|
||||
if defenv['MSTOOLKIT']:
|
||||
defenv.Tool('mstoolkit', toolpath = ['SCons/Tools'])
|
||||
|
||||
tools = defenv['TOOLS']
|
||||
|
||||
envs = []
|
||||
|
||||
if 'msvc' in tools or 'mstoolkit' in tools:
|
||||
envs = SConscript('SCons/Config/ms')
|
||||
elif 'gcc' in tools:
|
||||
envs = SConscript('SCons/Config/gnu')
|
||||
else:
|
||||
envs = SConscript('SCons/Config/default')
|
||||
|
||||
stub_env = envs[0]
|
||||
makensis_env = envs[1]
|
||||
plugin_env = envs[2]
|
||||
util_env = envs[3]
|
||||
|
||||
######################################################################
|
||||
####### stubs ###
|
||||
######################################################################
|
||||
|
||||
for stub in stubs:
|
||||
build_dir = build_prefix + 'stub_' + stub
|
||||
env = stub_env.Copy()
|
||||
env.Append(LINKFLAGS = '${MAP_FLAG("%s")}' % ('stub_' + stub))
|
||||
exports = { 'env' : env, 'compression' : stub, 'solid_compression' : 0 }
|
||||
|
||||
target = SConscript(dirs = 'Source/exehead', build_dir = build_dir, duplicate = 0, exports = exports)
|
||||
env.SideEffect(File(build_dir + os.sep + 'stub_' + stub + '.map'), target)
|
||||
|
||||
ins_target = InstallAs(prefix + '/Stubs/' + stub, target)
|
||||
|
||||
build_dir = build_prefix + 'stub_' + stub + '_solid'
|
||||
env = stub_env.Copy()
|
||||
env.Append(LINKFLAGS = '${MAP_FLAG("%s")}' % ('stub_' + stub))
|
||||
exports = { 'env' : env, 'compression' : stub, 'solid_compression' : 1 }
|
||||
|
||||
solid_target = SConscript(dirs = 'Source/exehead', build_dir = build_dir, duplicate = 0, exports = exports)
|
||||
env.SideEffect(File(build_dir + os.sep + 'stub_' + stub + '.map'), target)
|
||||
|
||||
ins_solid_target = InstallAs(prefix + '/Stubs/' + stub + '_solid', solid_target)
|
||||
|
||||
env.Alias(stub, ins_target + ins_solid_target)
|
||||
|
||||
uninst_icon = InstallAs(prefix + '/Stubs/' + 'uninst', 'Source/exehead/uninst.ico')
|
||||
|
||||
Alias('stubs', [stubs, uninst_icon])
|
||||
|
||||
######################################################################
|
||||
####### makensis ###
|
||||
######################################################################
|
||||
|
||||
build_dir = build_prefix + 'makensis'
|
||||
exports = { 'env' : makensis_env }
|
||||
|
||||
makensis_env.Append(LINKFLAGS = '${MAP_FLAG("makensis")}')
|
||||
|
||||
makensis = SConscript(dirs = 'Source', build_dir = build_dir, duplicate = 0, exports = exports)
|
||||
|
||||
makensis_env.Clean(makensis, 'makensis.map')
|
||||
|
||||
Alias('makensis', Install(prefix, makensis))
|
||||
|
||||
######################################################################
|
||||
####### Plug-ins ###
|
||||
######################################################################
|
||||
|
||||
def PluginEnv(target, entry = 'DllMain', nodeflib = 1):
|
||||
env = plugin_env.Copy()
|
||||
|
||||
if nodeflib:
|
||||
env.Append(LINKFLAGS = '$NODEFLIBS_FLAG') # no default libraries
|
||||
|
||||
env.Append(LINKFLAGS = '${ENTRY_FLAG("%s")}' % entry) # entry function
|
||||
env.Append(LINKFLAGS = '${MAP_FLAG("%s")}' % target) # generate map file
|
||||
|
||||
env.SideEffect(File(target + '.map'), target)
|
||||
|
||||
return env
|
||||
|
||||
for plugin in plugins:
|
||||
path = 'Contrib' + os.sep + plugin
|
||||
build_dir = build_prefix + plugin
|
||||
exports = 'PluginEnv'
|
||||
|
||||
plugin_dll = SConscript(dirs = path, build_dir = build_dir, duplicate = 0, exports = exports)
|
||||
|
||||
Alias(plugin, Install(prefix + 'Plugins', plugin_dll))
|
||||
|
||||
######################################################################
|
||||
####### Utilities ###
|
||||
######################################################################
|
||||
|
||||
def BuildUtil(target, source, libs, entry = None, res = None,
|
||||
resources = None, defines = None, flags = None,
|
||||
install = None):
|
||||
env = util_env.Copy()
|
||||
|
||||
if defines:
|
||||
env.Append(CPPDEFINES = defines)
|
||||
if flags:
|
||||
env.Append(CPPFLAGS = flags)
|
||||
|
||||
if entry:
|
||||
env.Append(LINKFLAGS = '${ENTRY_FLAG("%s")}' % entry)
|
||||
|
||||
env.Append(LINKFLAGS = '${MAP_FLAG("%s")}' % target)
|
||||
|
||||
if res:
|
||||
target_res = env.RES(res)
|
||||
if resources:
|
||||
env.Depends(target_res, resources)
|
||||
source = source + target_res
|
||||
|
||||
util = env.Program(target, source, LIBS = libs)
|
||||
|
||||
env.Clean(util, File(target + '.map'))
|
||||
|
||||
if install is not None:
|
||||
ins = Install(prefix + install, util)
|
||||
Alias(target, ins)
|
||||
else:
|
||||
Alias(target, util)
|
||||
|
||||
for util in utils:
|
||||
path = 'Contrib' + os.sep + util
|
||||
build_dir = build_prefix + util
|
||||
exports = {'BuildUtil' : BuildUtil, 'env' : util_env.Copy()}
|
||||
|
||||
SConscript(dirs = path, build_dir = build_dir, duplicate = 0, exports = exports)
|
||||
|
||||
######################################################################
|
||||
####### Documentation ###
|
||||
######################################################################
|
||||
|
||||
halibut = SConscript(
|
||||
dirs = 'Docs/src/bin/halibut',
|
||||
build_dir = build_prefix + 'halibut',
|
||||
duplicate = 0
|
||||
)
|
||||
|
||||
SConscript(
|
||||
dirs = 'Docs/src',
|
||||
build_dir = build_prefix + 'Docs',
|
||||
duplicate = 0,
|
||||
exports = {'halibut' : halibut, 'prefix' : prefix}
|
||||
)
|
87
Source/SConscript
Normal file
87
Source/SConscript
Normal file
|
@ -0,0 +1,87 @@
|
|||
target = 'makensis'
|
||||
|
||||
pch = 'Platform.h'
|
||||
|
||||
makensis_files = Split("""
|
||||
build.cpp
|
||||
clzma.cpp
|
||||
crc32.c
|
||||
DialogTemplate.cpp
|
||||
dirreader.cpp
|
||||
growbuf.cpp
|
||||
lang.cpp
|
||||
lineparse.cpp
|
||||
makenssi.cpp
|
||||
mmap.cpp
|
||||
Plugins.cpp
|
||||
ResourceEditor.cpp
|
||||
ResourceVersionInfo.cpp
|
||||
script.cpp
|
||||
ShConstants.cpp
|
||||
strlist.cpp
|
||||
tokens.cpp
|
||||
util.cpp
|
||||
""")
|
||||
|
||||
bzip2_files = Split("""
|
||||
bzip2/blocksort.c
|
||||
bzip2/bzlib.c
|
||||
bzip2/compress.c
|
||||
bzip2/huffman.c
|
||||
""")
|
||||
|
||||
lzma_files = Split("""
|
||||
7zip/7zGuids.cpp
|
||||
7zip/Common/CRC.cpp
|
||||
7zip/7zip/Compress/LZ/LZInWindow.cpp
|
||||
7zip/7zip/Compress/LZMA/LZMAEncoder.cpp
|
||||
7zip/7zip/Common/OutBuffer.cpp
|
||||
7zip/7zip/Compress/RangeCoder/RangeCoderBit.cpp
|
||||
7zip/Common/Alloc.cpp
|
||||
""")
|
||||
|
||||
zlib_files = Split("""
|
||||
zlib/deflate.c
|
||||
zlib/trees.c
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
gdi32
|
||||
user32
|
||||
version
|
||||
pthread
|
||||
stdc++
|
||||
iconv
|
||||
libiconv
|
||||
""")
|
||||
|
||||
Import('env')
|
||||
|
||||
##### Configure
|
||||
|
||||
conf = env.Configure()
|
||||
|
||||
for lib in libs:
|
||||
conf.CheckLib(lib)
|
||||
|
||||
conf.Finish()
|
||||
|
||||
##### Set PCH
|
||||
|
||||
# XXX doesn't work
|
||||
#env['PCH'] = env.PCH(pch)[0]
|
||||
#env['PCHSTOP'] = pch
|
||||
|
||||
##### Compile LZMA
|
||||
|
||||
lzma_env = env.Copy()
|
||||
lzma_env.Append(CPPDEFINES = ['COMPRESS_MF_BT'])
|
||||
lzma_files = lzma_env.Object(lzma_files)
|
||||
|
||||
##### Compile makensis
|
||||
|
||||
files = makensis_files + bzip2_files + lzma_files + zlib_files
|
||||
|
||||
makensis = env.Program(target, files)
|
||||
|
||||
Return('makensis')
|
83
Source/exehead/SConscript
Normal file
83
Source/exehead/SConscript
Normal file
|
@ -0,0 +1,83 @@
|
|||
files = Split("""
|
||||
bgbg.c
|
||||
components.c
|
||||
exec.c
|
||||
fileform.c
|
||||
Main.c
|
||||
Ui.c
|
||||
util.c
|
||||
#Source/crc32.c
|
||||
""")
|
||||
|
||||
resources = Split("""
|
||||
resource.rc
|
||||
""")
|
||||
|
||||
resource_files = Split("""
|
||||
nsis.ico
|
||||
uninst.ico
|
||||
bitmap1.bmp
|
||||
""")
|
||||
|
||||
bzip2_files = Split("""
|
||||
#Source/bzip2/bzlib.c
|
||||
#Source/bzip2/decompress.c
|
||||
#Source/bzip2/huffman.c
|
||||
""")
|
||||
|
||||
lzma_files = Split("""
|
||||
#Source/7zip/LZMADecode.c
|
||||
""")
|
||||
|
||||
zlib_files = Split("""
|
||||
#Source/zlib/INFBLOCK.C
|
||||
""")
|
||||
|
||||
libs = Split("""
|
||||
kernel32
|
||||
user32
|
||||
gdi32
|
||||
shell32
|
||||
advapi32
|
||||
comdlg32
|
||||
comctl32
|
||||
ole32
|
||||
version
|
||||
uuid
|
||||
""")
|
||||
|
||||
Import('env compression solid_compression')
|
||||
|
||||
env.Append(CPPDEFINES = ['EXEHEAD'])
|
||||
env.Append(CPPDEFINES = ['WIN32_LEAN_AND_MEAN'])
|
||||
|
||||
if compression == 'bzip2':
|
||||
env.Append(CPPDEFINES = ['NSIS_COMPRESS_USE_BZIP2'])
|
||||
files += bzip2_files
|
||||
elif compression == 'lzma':
|
||||
env.Append(CPPDEFINES = ['NSIS_COMPRESS_USE_LZMA'])
|
||||
env.Append(CPPDEFINES = ['LZMACALL=__fastcall'])
|
||||
files += lzma_files
|
||||
elif compression == 'zlib':
|
||||
env.Append(CPPDEFINES = ['NSIS_COMPRESS_USE_ZLIB'])
|
||||
env.Append(CPPDEFINES = ['ZEXPORT=__stdcall'])
|
||||
files += zlib_files
|
||||
|
||||
if solid_compression:
|
||||
env.Append(CPPDEFINES = ['NSIS_COMPRESS_WHOLE'])
|
||||
|
||||
objs = []
|
||||
|
||||
def basename(file):
|
||||
return file.split('/')[-1].split('.')[0]
|
||||
|
||||
for file in files:
|
||||
objs.append(env.Object(target = basename(file), source = file))
|
||||
|
||||
res = env.RES(resources)
|
||||
env.Depends(res, resource_files)
|
||||
objs = objs + res
|
||||
|
||||
stub = env.Program(target = 'stub_' + compression, source = objs, LIBS = libs)
|
||||
|
||||
Return('stub')
|
Loading…
Add table
Add a link
Reference in a new issue