-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSConstruct
275 lines (208 loc) · 10.3 KB
/
SConstruct
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# SConstruct for Nonpareil
# Copyright 2004, 2005, 2006, 2008, 2022 Eric Smith <[email protected]>
# Nonpareil is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation. Note that I am not
# granting permission to redistribute or modify Nonpareil under the
# terms of any later version of the General Public License.
# Nonpareil is distributed in the hope that they will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program (in the file "COPYING"); if not, write to
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111, USA.
#-----------------------------------------------------------------------------
# Release number
#-----------------------------------------------------------------------------
release_major = '0'
release_minor = '79'
#-----------------------------------------------------------------------------
# Options
#-----------------------------------------------------------------------------
conf_file = 'nonpareil.conf'
vars = Variables (conf_file)
vars.AddVariables (EnumVariable ('target',
help = 'execution target platform',
allowed_values = ('posix', 'win32'),
default = 'posix',
ignorecase = 1),
PathVariable ('prefix',
'installation path prefix',
'/usr/local'),
PathVariable ('bindir',
'path for executable files (default is $prefix/bin)',
'',
PathVariable.PathAccept),
PathVariable ('libdir',
'path for library files (default is $prefix/lib/nonpareil)',
'',
PathVariable.PathAccept),
PathVariable ('destdir',
'installation virtual root directory (for packaging)',
'',
PathVariable.PathAccept),
BoolVariable ('debug',
help = 'compile for debugging',
default = 1),
# Feature switches:
BoolVariable ('has_debugger_gui',
help = 'enable debugger GUI interface',
default = 0),
BoolVariable ('has_debugger_cli',
help = 'enable debugger command-line interface',
default = 0),
BoolVariable ('use_tcl',
help = 'use Tcl as debug command interpreter (only when debugger CLI is enabled)',
default = 1), # only if has_debugger_cli
BoolVariable ('use_readline',
help = 'use Readline library for command editing and history (only when debugger CLI is enabled)',
default = 1)) # only if has_debugger_cli
#-----------------------------------------------------------------------------
# Cache options
#-----------------------------------------------------------------------------
env = Environment (variables = vars)
vars.Update (env)
vars.Save (conf_file, env)
#-----------------------------------------------------------------------------
# Generate help text from options
#-----------------------------------------------------------------------------
Help (vars.GenerateHelpText (env))
#-----------------------------------------------------------------------------
# More defaults and variable settings
#-----------------------------------------------------------------------------
# Don't scatter .sconsign files everywhere, and especially don't put them
# into install directories.
SConsignFile ()
release = release_major + '.' + release_minor
env ['RELEASE'] = release
Export ('env')
#-----------------------------------------------------------------------------
# Add some builders to the environment:
#-----------------------------------------------------------------------------
SConscript ('scons/zipdist.py')
#-----------------------------------------------------------------------------
# package a Windows binary distribution ZIP file
#-----------------------------------------------------------------------------
if env ['target'] == 'win32':
dist_zip_file = env.ZipDist ('nonpareil-' + release + '.zip',
bin_dist_files)
env ['dist_zip_file'] = dist_zip_file
env.Alias ('dist', dist_zip_file)
#-----------------------------------------------------------------------------
# Installation paths
#-----------------------------------------------------------------------------
if not env ['bindir']:
env ['bindir'] = env ['prefix'] + '/bin'
if not env ['libdir']:
env ['libdir'] = env ['prefix'] + '/lib/nonpareil'
#-----------------------------------------------------------------------------
# Prepare for SConscription
#-----------------------------------------------------------------------------
host_build_dir = 'build/' + env ['PLATFORM']
target_build_dir = 'build/' + env ['target']
if env ['debug']:
host_build_dir += '-debug'
target_build_dir += '-debug'
env ['target_build_dir'] = target_build_dir
#-----------------------------------------------------------------------------
# package a Windows installer
#-----------------------------------------------------------------------------
if env ['target'] == 'win32':
SConscript ('win32/nsis.py')
win32_nsis_installer_fn = target_build_dir + '/Nonpareil-' + release + '-setup.exe'
win32_nsis_installer = env.NSIS (win32_nsis_installer_fn,
bin_dist_files)
env ['win32_nsis_installer'] = win32_nsis_installer
env.Alias ('wininst', win32_nsis_installer)
#-----------------------------------------------------------------------------
# sound files
#-----------------------------------------------------------------------------
SConscript ('sound/SConscript')
#-----------------------------------------------------------------------------
# license files
#-----------------------------------------------------------------------------
env.Append (GPLv2 = File ('LICENSES/GPL-2.txt'))
#-----------------------------------------------------------------------------
# host platform code
#-----------------------------------------------------------------------------
env.Append (KML_41CV = File ('nui/nut/41c/41cv.kml'))
native_env = env.Clone ()
native_env ['build_target_only'] = 0
SConscript ('src/SConscript',
build_dir = host_build_dir,
duplicate = 0,
exports = {'build_env' : native_env,
'native_env' : env})
#-----------------------------------------------------------------------------
# .ncd calculator definitions
#-----------------------------------------------------------------------------
SConscript('scons/uasm.py')
SConscript('scons/ncd.py')
ncd_build_dir = Dir('build/ncd')
Export('ncd_build_dir')
ncd_files = SConscript('ncd/SConscript')
Default(ncd_files)
#-----------------------------------------------------------------------------
# .nui calculator user interfaces
#-----------------------------------------------------------------------------
SConscript ('scons/nui.py')
all_calcs = {'classic': ['35', '35-early', '45', '45-early',
'55', '70', '80', '67'],
'woodstock': ['21', '22', '25', '27', '29c'],
'sting': ['19c'],
'topcat': ['91', '92', '97'],
'spice': ['31e', '32e', '33e', '37e', '38e', '33c', '34c', '38c'],
'nut': ['41c', '41cv', '41cx'],
'voyager': ['10c', '11c', '12c', '15c', '15c-192', '16c']
}
nui_dir_sub = {'35-early': '35',
'33e': '33',
'33c': '33',
'38e': '38',
'38c': '38',
'41cv': '41c',
'41cx': '41c',
'45-early': '45'}
nui_files = []
for family in all_calcs:
for model in all_calcs [family]:
nui_dir = 'nui/' + family + '/'
if model in nui_dir_sub:
if nui_dir_sub [model] == None:
continue
nui_dir += nui_dir_sub [model]
else:
nui_dir += model;
kml = FindFile (model + '.kml', nui_dir)
nui_files += env.NUI (target = 'build/nui/' + model + '.nui',
source = nui_dir + '/' + model + '.kml')
Default(nui_files)
#-----------------------------------------------------------------------------
# install/installer targets
#-----------------------------------------------------------------------------
env.Alias (target = 'install',
source = env.Install (dir = env ['destdir'] + env ['libdir'],
source = ncd_files + nui_files))
if env ['target'] == 'win32':
env.NSIS (win32_nsis_installer, ncd_files + nui_files)
#-----------------------------------------------------------------------------
# target platform code if cross-compiling
#-----------------------------------------------------------------------------
if (env ['PLATFORM'] != env ['target']):
cross_build_env = env.Clone ()
cross_build_env ['build_target_only'] = 1
SConscript ('src/SConscript',
build_dir = target_build_dir,
duplicate = 0,
exports = {'build_env': cross_build_env,
'native_env' : env})
#-----------------------------------------------------------------------------
# Windows
#-----------------------------------------------------------------------------
if env ['target'] == 'win32':
SConscript ('win32/dll/SConscript',
build_dir = target_build_dir + '/win32/dll',
duplicate = 0)
SConscript ('win32/SConscript')