| 1 |
files = Split(""" |
| 2 |
bgbg.c |
| 3 |
components.c |
| 4 |
exec.c |
| 5 |
fileform.c |
| 6 |
Main.c |
| 7 |
plugin.c |
| 8 |
Ui.c |
| 9 |
util.c |
| 10 |
#Source/crc32.c |
| 11 |
""") |
| 12 |
|
| 13 |
resources = Split(""" |
| 14 |
resource.rc |
| 15 |
""") |
| 16 |
|
| 17 |
resource_files = Split(""" |
| 18 |
nsis.ico |
| 19 |
uninst.ico |
| 20 |
bitmap1.bmp |
| 21 |
""") |
| 22 |
|
| 23 |
bzip2_files = Split(""" |
| 24 |
#Source/bzip2/bzlib.c |
| 25 |
#Source/bzip2/decompress.c |
| 26 |
#Source/bzip2/huffman.c |
| 27 |
""") |
| 28 |
|
| 29 |
lzma_files = Split(""" |
| 30 |
#Source/7zip/LZMADecode.c |
| 31 |
""") |
| 32 |
|
| 33 |
zlib_files = Split(""" |
| 34 |
#Source/zlib/INFBLOCK.C |
| 35 |
""") |
| 36 |
|
| 37 |
libs = Split(""" |
| 38 |
advapi32 |
| 39 |
shell32 |
| 40 |
ole32 |
| 41 |
comdlg32 |
| 42 |
comctl32 |
| 43 |
user32 |
| 44 |
gdi32 |
| 45 |
kernel32 |
| 46 |
uuid |
| 47 |
""") |
| 48 |
|
| 49 |
Import('env compression solid_compression') |
| 50 |
|
| 51 |
### Defines |
| 52 |
|
| 53 |
env.Append(CPPDEFINES = ['EXEHEAD']) |
| 54 |
env.Append(CPPDEFINES = ['WIN32_LEAN_AND_MEAN']) |
| 55 |
env.Append(CPPDEFINES = ['_WIN32_IE=0x0500']) |
| 56 |
|
| 57 |
### Some other settings |
| 58 |
|
| 59 |
if 'NSIS_CONFIG_LOG_STDOUT' in env['NSIS_CPPDEFINES']: |
| 60 |
env.Append(LINKFLAGS = env['SUBSYS_CON']) |
| 61 |
else: |
| 62 |
env.Append(LINKFLAGS = env['SUBSYS_WIN']) |
| 63 |
|
| 64 |
### Compression specific configuration |
| 65 |
|
| 66 |
if compression == 'bzip2': |
| 67 |
env.Append(CPPDEFINES = ['NSIS_COMPRESS_USE_BZIP2']) |
| 68 |
files += bzip2_files |
| 69 |
elif compression == 'lzma': |
| 70 |
env.Append(CPPDEFINES = ['NSIS_COMPRESS_USE_LZMA']) |
| 71 |
env.Append(CPPDEFINES = ['LZMACALL=__fastcall']) |
| 72 |
files += lzma_files |
| 73 |
elif compression == 'zlib': |
| 74 |
env.Append(CPPDEFINES = ['NSIS_COMPRESS_USE_ZLIB']) |
| 75 |
env.Append(CPPDEFINES = ['ZEXPORT=__stdcall']) |
| 76 |
files += zlib_files |
| 77 |
|
| 78 |
if solid_compression: |
| 79 |
env.Append(CPPDEFINES = ['NSIS_COMPRESS_WHOLE']) |
| 80 |
|
| 81 |
### Build with no sub-build-directories |
| 82 |
|
| 83 |
objs = [] |
| 84 |
|
| 85 |
def basename(file): |
| 86 |
return file.split('/')[-1].split('.')[0] |
| 87 |
|
| 88 |
for file in files: |
| 89 |
objs.append(env.Object(target = basename(file), source = file)) |
| 90 |
|
| 91 |
### Resources |
| 92 |
|
| 93 |
res = env.RES(resources) |
| 94 |
env.Depends(res, resource_files) |
| 95 |
objs = objs + res |
| 96 |
|
| 97 |
### Build stub |
| 98 |
|
| 99 |
stub = env.Program(target = 'stub_' + compression, source = objs, LIBS = libs) |
| 100 |
|
| 101 |
### Return stub |
| 102 |
|
| 103 |
Return('stub') |