forked from OpenVnmrJ/OpenVnmrJ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSConstruct
307 lines (267 loc) · 9.6 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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
#
import os
import sys
import string
import subprocess
ovjtools=os.getenv('OVJ_TOOLS')
if not ovjtools:
print "OVJ_TOOLS env not found."
print "For bash and variants, use export OVJ_TOOLS=<path>"
print "For csh and variants, use setenv OVJ_TOOLS <path>"
sys.exit(1)
if not os.path.exists(ovjtools):
print "OVJ_TOOLS path "+ovjtools+" not found."
sys.exit(1)
# os.environ['OPENVNMRJ']="true"
# os.environ['OPENVNMRJ_GSL']="false"
# os.environ['OPENVNMRJ_GSL']="true"
platform = sys.platform # sys.platform -> 'linux2' linux, 'interix6' win7 SUA
print "Platform: ", platform
#
# top level build file
#
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# WHEN ADDING NEW FILES TO THIS BUILD, BE SURE YOU TEST
# THE BUILD BY INVOKING:
#
# scons -c && scons -j3
#
# All builds MUST be thread-safe so that parallel builds
# function properly. Parallel building is a simple way
# to cut down on compilation time.
#
# "-j3" tells scons to run 3 build threads. A good rule
# of thumb for choosing the -j option is to count the
# the number of CPU cores and add 1. Remember you must
# be running and SMP kernel to take advantage of multi-
# core CPUs.
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SetOption('warn', ['no-duplicate-environment'] + GetOption('warn'))
# we need to specify an absolute path so this SConstruct file
# can be called from any other SConstruct file
cwd = os.getcwd()
# non-java builds
buildList = string.split("""
app-defaults
acq
adm
Diffusion
fidlib
fiddle
fonts
Gmap
IMAGE_patent
Pbox
pipe
PFG
misc
protune
shims
shimmethods
studylib
sudo.lnx
xml
xmllayout
""");
# Done in common
# BIR
# execpars
# Gxyz_i
# nuctables
# maclib
# manual
# menujlib
# modules
# mollib
# msg
# personalib
# probes
# proshimmethods
# satellites
# shapelib
# tablib
# templates
# upar
# user_templates
# vnmrbg_iconlib
# nvpsg done by psglib
# psg done by psglib
# ncomm done by psglib
# kpsg done by kpsglib
buildList = string.split("""
3D
autotest
backproj
bin
biopack
biosolidspack
common
dicom_store
DOSY
ddr
Gilson
gxyzshim
IMAGE
languages
layouts
license
LCNMR
p11
passwd
psglib
roboproc
scripts
shuffler
solidspack
stars
tcl
veripulse
vnmrbg
""");
acqBuildList = string.split("""
768AS
craft
Cryo2
CSI2
dicom
fdm
FDM2
kermit
nvacq
nvacqkernel
nvdsp
servicetools
""");
acqBuildList = string.split("""
ampfit
atproc
bootpd.rh51
cgl
ddl
dicom_fdf
expproc
ib
infoproc
inova
kpsglib
lcpeaks
mercury
nautoproc
nvexpproc
nvinfoproc
nvrecvproc
nvsendproc
procproc
masproc
recvproc
sendproc
stat
web
""");
gslBuildList = string.split("""
aslmirtime
bin_image
xrecon
""");
# N.B. probeid was being built by apt, and vjclient by probeid.
# SCons shortcomings have forced the use of hardlinks.
#
javaBuildList = string.split("""
admin
dialog
jaccount
jplot
managedb
vjmol
vnmrj
""");
javaAcqBuildList = string.split("""
apt
cryo
cryomon
probeid
""");
thirdPartyList = string.split("""
JavaPackages
""");
# print "Update versions file's keyword __GITDESCRIBE__ if present"
# copy Version to the versions file so if it has the __GITDESCRBE__ key it
# will be replaced. For releases, the File <git-repo>/scripts/ReleaseVersion
# is copied to <git-repo>/Version and it does not have the __GITDESCRIBE__
# in it. This next step then copies Version to versions.
# command = 'cp ../Version ../versions; cd ../scripts; ./updateVersions.sh'
# idproc = subprocess.Popen( command, shell=True)
# status = os.waitpid(idproc.pid, 0)
javaLink = os.path.join(ovjtools, 'java')
# this must come last, since it creates sha1sum for all files
for i in buildList:
SConscript(os.path.join('src',i, 'SConstruct'))
# Check for link to java home on Linux only (darwin uses the System java)
if os.path.exists(javaLink) or 'linux' not in platform:
for i in javaBuildList:
SConscript(os.path.join('src',i, 'SConstruct'))
else:
print "java link in "+ovjtools+" not found. Skipping java compiles"
if ( os.path.exists(os.path.join('/usr','include','gsl')) ):
for i in gslBuildList:
SConscript(os.path.join('src',i, 'SConstruct'))
else:
print "gsl includes not found. Skipping compiles requiring gsl"
vnmrPath = os.path.join(cwd, os.pardir,'vnmr')
if ( 'darwin' not in platform):
for i in acqBuildList:
SConscript(os.path.join('src',i, 'SConstruct'))
if os.path.exists(javaLink):
for i in javaAcqBuildList:
SConscript(os.path.join('src',i, 'SConstruct'))
wkLink = os.path.join(ovjtools, 'wkhtmltopdf')
if os.path.exists(wkLink):
binPath = os.path.join(vnmrPath, 'bin')
if not os.path.exists(binPath):
os.makedirs(binPath)
cmd = 'cp '+wkLink+'/wkhtmltopdf '+binPath+';chmod 755 '+binPath+'/wkhtmltopdf'
# print "cmd: ",cmd
os.system(cmd)
cmd = 'cp '+wkLink+'/wkhtmltopdf-i386 '+binPath+';chmod 755 '+binPath+'/wkhtmltopdf-i386'
# print "cmd: ",cmd
os.system(cmd)
# end of if platform group
# for i in thirdPartyList:
# SConscript(os.path.join('3rdParty', i, 'SConstruct'))
# this one is separate
# if ( 'darwin' not in platform):
# SConscript(os.path.join(cwd, os.pardir, '3rdParty', 'SConstruct'))
# define absolute path for acqqueue and tmp directory
# vnmracqueuPath = os.path.join(cwd, os.pardir, 'vnmr','acqqueue')
# vnmrtmpPath = os.path.join(cwd, os.pardir, 'vnmr','tmp')
# make sure the path(s) exist
# if not os.path.exists(vnmracqueuPath):
# os.makedirs(vnmracqueuPath)
# if not os.path.exists(vnmrtmpPath):
# os.makedirs(vnmrtmpPath)
# os.chmod(vnmracqueuPath,0777)
# os.chmod(vnmrtmpPath,0777)
vnmrSha1Path = os.path.join(vnmrPath,'adm','sha1')
if not os.path.exists(vnmrSha1Path):
os.makedirs(vnmrSha1Path)
def runSconsPostAction(dir):
dirList = os.listdir(dir)
for i in dirList:
sconsFile = os.path.join(dir,i,'sconsPostAction')
if os.path.exists(sconsFile):
cmd='cd '+os.path.join(dir,i)+';chmod +x sconsPostAction; ./sconsPostAction; rm sconsPostAction'
print "cmd: ",cmd
os.system(cmd)
# this must come last, since it creates sha1sum for all files
def afterScons():
runSconsPostAction(vnmrPath)
print "Build ID file"
command = 'cd scripts; ./genBuildId.pl'
idproc = subprocess.Popen( command, shell=True)
status = os.waitpid(idproc.pid, 0)
print "Build Sha1 SnapShot of files"
command = 'cd scripts; ./createSha1ChkList.sh'
idproc = subprocess.Popen( command, shell=True)
status = os.waitpid(idproc.pid, 0)
import atexit
atexit.register(afterScons)