summaryrefslogtreecommitdiff
path: root/Source/SConscript
blob: 613278322027335279465905568ce4acde97f029 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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

##### Version define

version_env = env.Copy()
version_env.Append(CPPDEFINES = ['NSIS_VERSION=v$VERSION'])

# only pass -DNSIS_VERSION to files that use it to minimize rebuilds

new_makensis_files = []

for file in makensis_files:
	f = File(file).srcnode().abspath
	if open(f).read().find('NSIS_VERSION') >= 0:
		new_makensis_files.append(version_env.Object(file))
	else:
		new_makensis_files.append(file)

makensis_files = new_makensis_files

##### LZMA specific defines

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')