aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/SConstruct
diff options
context:
space:
mode:
authorJacek Antonelli2008-09-06 18:24:57 -0500
committerJacek Antonelli2008-09-06 18:25:07 -0500
commit798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch)
tree1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/SConstruct
parentSecond Life viewer sources 1.20.15 (diff)
downloadmeta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/SConstruct')
-rw-r--r--linden/indra/SConstruct895
1 files changed, 0 insertions, 895 deletions
diff --git a/linden/indra/SConstruct b/linden/indra/SConstruct
deleted file mode 100644
index 9353317..0000000
--- a/linden/indra/SConstruct
+++ /dev/null
@@ -1,895 +0,0 @@
1################################################# -*- python -*-
2#
3# SConstruct makefile for Second Life viewer and servers.
4#
5# To build everything:
6#
7# scons ARCH=all BTARGET=all DISTCC=yes
8#
9# To build a standalone viewer, you'll need the following packages
10# installed, with headers. We pick up the correct flags to use for
11# these libraries using the "pkg-config" command.
12#
13# cairo glib-2.0 atk gmobile-2.0 gdk-2.0 gdk-pixbuf-2.0 pango pangoft2 pangox pangoxft gtk+-2.0 sdl vorbis vorbisenc vorbisfile
14#
15# Then build as follows:
16#
17# scons BTARGET=client STANDALONE=yes MOZLIB2=no ELFIO=no DISTCC=no
18#
19# For help on options:
20#
21# scons -h
22#
23# Originally written by Tom Yedwab, 6/2006.
24#
25#################################################
26
27
28import glob
29import os
30import random
31import re
32import sys
33
34platform = sys.platform
35if platform == 'linux2':
36 platform = 'linux'
37
38######################
39# GET VERSION #
40######################
41
42def get_version(type):
43 file = open('llcommon/llversion%s.h' % type,"r")
44 file_str = file.read()
45 file.close()
46
47 m = re.search('const S32 LL_VERSION_MAJOR = (\d+);', file_str)
48 VER_MAJOR = m.group(1)
49 m = re.search('const S32 LL_VERSION_MINOR = (\d+);', file_str)
50 VER_MINOR = m.group(1)
51 m = re.search('const S32 LL_VERSION_PATCH = (\d+);', file_str)
52 VER_PATCH = m.group(1)
53 m = re.search('const S32 LL_VERSION_BUILD = (\d+);', file_str)
54 VER_BUILD = m.group(1)
55 version = "%(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s" % locals()
56
57 return version
58
59version_viewer = get_version('viewer')
60version_server = get_version('server')
61
62
63###############
64# SYSTEM INFO #
65###############
66
67# Debian Sarge has a broken glibc that leads to build failures on
68# *non*-Sarge systems (because of prebuilt static libraries built on
69# Sarge).
70
71try:
72 debian_sarge = open('/etc/debian_version').read().strip() == '3.1'
73except:
74 debian_sarge = False
75
76#########################
77# COMMAND LINE OPTIONS #
78#########################
79
80DEFAULT_CHANNEL='Release' # TODO: Make this the full channel name, i.e. "Second Life Release"
81
82
83opts = Options()
84opts.AddOptions(
85 EnumOption('BUILD', 'Set build type', 'releasefordownload',
86 allowed_values=('debug', 'release', 'releasenoopt', 'releasefordownload')),
87 EnumOption('ARCH', 'Set architecture', 'i686',
88 allowed_values=('i686', 'powerpc', 'x86_64')),
89 EnumOption('BTARGET', 'Set build target', 'server',
90 allowed_values=('client', 'server', 'all')),
91 BoolOption('DISTCC', 'Enabled distcc', True),
92 BoolOption('MOZLIB2', 'Enabled llmozlib2/mozilla support', True),
93 BoolOption('FMOD', 'Enabled FMOD audio support', True),
94 BoolOption('GSTREAMER', 'Enabled GStreamer support', True),
95 BoolOption('COLORGCC', 'Enabled colorgcc', True),
96 EnumOption('GRID', 'Client package\'s default grid', 'default',
97 allowed_values=('default', 'aditi', 'agni', 'durga', 'ganga', 'shakti', 'siva', 'soma', 'uma', 'vaak', 'yami', 'mohini', 'aruna', 'mitra', 'nandi', 'radha', 'ravi')),
98 ('CHANNEL', 'Client package\'s channel', DEFAULT_CHANNEL),
99 ('LOGINCHANNEL', 'Client package\'s channel for login only', False),
100 BoolOption('ELFIO', 'Enabled enhanced backtraces with libELFIO symbol extraction support', True),
101 BoolOption('STANDALONE', 'Build using system packages (implies OPENSOURCE)', False),
102 BoolOption('RUNTESTS', 'Run tests at end of compilation', True),
103 BoolOption('OPENSOURCE', 'Build using only non-proprietary dependencies', True) # OPENSOURCE: do not edit this line
104)
105optenv = Environment(options = opts)
106Help(opts.GenerateHelpText(optenv))
107
108build_param = optenv['BUILD']
109arch = optenv['ARCH']
110target_param = optenv['BTARGET']
111enable_distcc = optenv['DISTCC']
112enable_mozlib = optenv['MOZLIB2']
113enable_gstreamer = optenv['GSTREAMER']
114enable_colorgcc = optenv['COLORGCC']
115grid = optenv['GRID']
116channel = optenv['CHANNEL']
117login_channel = optenv['LOGINCHANNEL']
118standalone = optenv['STANDALONE']
119runtests = optenv['RUNTESTS']
120opensource = standalone or optenv['OPENSOURCE']
121enable_fmod = not opensource and optenv['FMOD']
122elfio = optenv['ELFIO']
123
124targets = [ target_param ]
125
126if target_param == 'all':
127 targets = [ 'client', 'server' ]
128
129# Set this to False if you don't want your source files copied into
130# the object directory in /tmp.
131duplicate = True
132
133if standalone and platform != 'linux':
134 print >> sys.stderr, 'Warning: standalone builds have only been tested on Linux'
135
136standalone_pkgs = [
137 'atk',
138 'cairo',
139 'fontconfig',
140 'freetype2',
141 'gdk-2.0',
142 'gdk-pixbuf-2.0',
143 'glib-2.0',
144 'gmodule-2.0',
145 'gthread-2.0',
146 'gtk+-2.0',
147 'libpng',
148 'pango',
149 'pangoft2',
150 'pangox',
151 'pangoxft',
152 'sdl',
153 'vorbis',
154 'vorbisenc',
155 'vorbisfile',
156 ]
157
158standalone_net_pkgs = [
159 'apr-1',
160 'apr-util-1',
161 'libcrypto',
162 'libcurl',
163 'libssl',
164 ]
165
166def pkgconfig(opt, pkgs=None):
167 if pkgs is None:
168 pkgs = standalone_pkgs + standalone_net_pkgs
169 return os.popen('pkg-config %s %s' %
170 (opt, ' '.join(pkgs))).read().strip()
171
172if standalone:
173 missing = [pkg for pkg in standalone_pkgs + standalone_net_pkgs
174 if os.system('pkg-config --exists ' + pkg)]
175 if missing:
176 print >> sys.stderr, ('Error: pkg-config cannot find these '
177 'packages: %s' % ' '.join(missing))
178 sys.exit(2)
179
180#####################
181# ITERATE TARGETS #
182#####################
183
184for build_target in targets:
185 buildtype = build_param
186 if build_target == 'server' and buildtype == 'releasefordownload':
187 buildtype = 'release'
188
189 system_str = arch + '-' + platform
190
191 print 'Building ' + build_target + ' ' + version_server + ' on ' + system_str + ' (' + buildtype + ')'
192
193 system_lib_dir = '../libraries/' + system_str
194 havok_lib_dir = '../libraries/' + system_str
195 lib_dir = './lib_' + buildtype + '_' + build_target + '/' + system_str
196
197 if build_target == 'client':
198 system_lib_dir += '/lib_release_client'
199 elif buildtype == 'debug':
200 havok_lib_dir += '/lib_debug/havok/hk460'
201 system_lib_dir += '/lib_debug'
202 lib_dir = './lib_debug_' + build_target + '/' + system_str
203 else:
204 havok_lib_dir += '/lib_release/havok/hk460'
205 system_lib_dir += '/lib_release'
206 lib_dir = './lib_release_' + build_target + '/' + system_str
207
208 try:
209 build_dir_prefix = os.environ['TEMP_BUILD_DIR']
210 except:
211 build_dir_prefix = '/tmp/' + os.environ['USER']
212
213 build_dir = build_dir_prefix + os.getcwd() + '/' + system_str + '-' + build_target + '-' + buildtype
214
215 ### Base include directories ###
216
217 include_dirs = Split("""
218 ./ ./llcommon ./llmath ./llwindow ./llaudio ./llcharacter ./llcrashlogger
219 ./lldatabase ./llimage ./llinventory ./llmedia ./llmessage ./llphysics
220 ./llprimitive ./llrender ./llscene ./llui ./llvfs ./llwindow
221 ./llxml ./lscript ./lscript/lscript_compile
222 ../libraries/include
223 """ +
224 '../libraries/' + system_str + '/include' )
225
226 client_external_libs = []
227 system_link_flags = ''
228
229 include_dirs += Split('../libraries/include/havok/hk460/physics ../libraries/include/havok/hk460/common ')
230
231 if platform != 'linux' and build_target == 'client' and enable_mozlib:
232
233 ### Mozilla include directories ###
234
235 mozilla_dir = '../libraries/' + system_str + '/include/mozilla'
236 include_dirs += Split(
237 mozilla_dir + '/include/webbrwsr ' +
238 mozilla_dir + '/include/docshell ' +
239 mozilla_dir + '/include/dom ' +
240 mozilla_dir + '/include/xpcom ' +
241 mozilla_dir + '/include/widget ' +
242 mozilla_dir + '/include/gfx ' +
243 mozilla_dir + '/include/string ' +
244 mozilla_dir + '/include/uriloader ' +
245 mozilla_dir + '/include/view ' +
246 mozilla_dir + '/include/layout ' +
247 mozilla_dir + '/include/content ' +
248 mozilla_dir + '/include/locale ' +
249 mozilla_dir + '/include/profdirserviceprovider ' +
250 mozilla_dir + '/include/xulapp ' +
251 mozilla_dir + '/include/pref ' +
252 mozilla_dir + '/sdk/include')
253
254 ##############
255 # CPP Flags #
256 ##############
257
258 # Generic GCC flags
259 # cflags = '-g -pipe -Wall -Wno-reorder -Wno-trigraphs -Wno-sign-compare -Werror -fexceptions '
260 cflags = '-g -pipe -Wall -Wno-reorder -Wno-trigraphs -Wno-sign-compare -fexceptions '
261 cxxflags = ''
262 #cppflags = '-D_FORTIFY_SOURCE=2 '
263 cppflags = ''
264 if standalone:
265 cppflags += '-DLL_STANDALONE '
266
267 if arch == 'i686':
268 cflags += '-m32 '
269 system_link_flags += '-m32 '
270
271 if build_target == 'server':
272 # Server flags
273 cppflags += '-D_GNU_SOURCE -DLL_MESA_HEADLESS=1 -DLL_MESA=1 '
274 cxxflags += '-ftemplate-depth-60 '
275 if arch == 'i686':
276 cflags += '-march=pentiumpro '
277 if debian_sarge:
278 def_server_cppflags = ''
279 else:
280 def_server_cppflags = '-DCTYPE_WORKAROUND'
281 server_cppflags = os.environ.get('SERVER_CPPFLAGS',
282 def_server_cppflags)
283 cppflags += server_cppflags + ' '
284 else:
285 # Viewer flags
286 cflags += '-pthread -D_REENTRANT -fno-math-errno -fsigned-char -fno-strict-aliasing '
287 cppflags += '-DLL_MESA_HEADLESS=0 -DLL_MESA=0 '
288 try:
289 client_cppflags = os.environ['CLIENT_CPPFLAGS']
290 except:
291 client_cppflags = ''
292 cppflags += client_cppflags + ' '
293
294
295 if platform == 'linux':
296 # Linux-only flags
297 cppflags += '-DLL_LINUX=1 '
298 if build_target == 'client':
299 cppflags += '-DAPPID=secondlife -DLL_SDL=1 '
300 if arch == 'x86_64' or arch == 'x86_64cross' or not enable_fmod:
301 cppflags += '-DLL_FMOD=0 '
302 cppflags += '-DLL_X11=1 -DLL_GTK=1 '
303 if standalone:
304 include_dirs += [d[2:] for d in
305 pkgconfig('--cflags-only-I').split()]
306 client_external_libs += [ 'boost_program_options-gcc34-mt', 'boost_signals-gcc34-mt', 'boost_regex-gcc34-mt']
307 else:
308 client_external_libs += [ 'fontconfig', 'gtk-x11-2.0', 'atk-1.0', 'gmodule-2.0', 'gdk-x11-2.0', 'gdk_pixbuf-2.0', 'pango-1.0', 'pangoft2-1.0', 'pangox-1.0', 'pangoxft-1.0', 'Xinerama', 'boost_program_options-gcc34-mt', 'boost_signals-gcc34-mt', 'boost_regex-gcc34-mt' ]
309 incdirs = [ 'ELFIO', 'atk-1.0', 'glib-2.0', 'gtk-2.0',
310 'llfreetype2', 'pango-1.0' ]
311 include_dirs += ['../libraries/' + system_str + '/include/' + d
312 for d in incdirs]
313
314 if elfio:
315 client_external_libs += [ 'ELFIO' ]
316 else:
317 cppflags += '-DLL_ELFBIN=0 '
318
319 # llmozlib2 stuff
320 if enable_mozlib:
321 cppflags += '-DLL_LLMOZLIB_ENABLED=1 '
322 client_external_libs += [ 'llmozlib2' ]
323 client_external_libs += [ 'mozjs', 'nspr4', 'plc4', 'plds4', 'profdirserviceprovider_s', 'xul' ]
324 else:
325 cppflags += '-DLL_LLMOZLIB_ENABLED=0 '
326
327 # GStreamer stuff
328 if enable_gstreamer:
329 cppflags += '-DLL_GSTREAMER_ENABLED=1 '
330 client_external_libs += [ 'glib-2.0', 'gobject-2.0', 'gthread-2.0' ]
331 include_dirs += [ '../libraries/' + system_str + '/include/gstreamer-0.10' ]
332 include_dirs += [ '../libraries/' + system_str + '/include/glib-2.0', '../libraries/' + system_str + '/include/glib-2.0/include' ]
333 include_dirs += [ '../libraries/' + system_str + '/include/libxml2']
334 else:
335 cppflags += '-DLL_GSTREAMER_ENABLED=0 '
336
337 cppflags += '-DLL_CURRENT_HAVOK_VERSION=460 '
338 else:
339 # Mac-only flags
340 cflags += '-x c++ -arch ppc -pipe -Wno-trigraphs -fpascal-strings -faltivec -fasm-blocks -g -fmessage-length=0 -mtune=G4 -Wno-deprecated-declarations -Wno-invalid-offsetof -mmacosx-version-min=10.3 -Wmost -Wno-sign-compare -Wno-switch -fconstant-cfstrings -ffor-scope -Wno-reorder -fexceptions '
341 cppflags += '-x c++ -DLL_DARWIN=1 -fpch-preprocess -F./newview/build/Deployment -fconstant-cfstrings -isysroot /Developer/SDKs/MacOSX10.3.9.sdk '
342
343 if standalone:
344 gcc_bin = 'g++'
345 elif build_target != 'client':
346 gcc_bin = 'g++-3.3'
347 elif arch == 'x86_64cross':
348 gcc_bin = '/opt/crosstool/gcc-4.0.2-glibc-2.3.6/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-gcc'
349 strip_cmd = '/opt/crosstool/gcc-4.0.2-glibc-2.3.6/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/bin/strip -S -o $TARGET $SOURCE'
350
351 else:
352 gcc_bin = 'g++-4.1'
353
354 # Are we using the Intel compiler?
355 if gcc_bin.find('icpc') >= 0:
356 cflags += '-wr193,654,981,1125 -w1 '
357 elif build_target == 'client':
358 cflags += '-falign-loops=16 -ffast-math '
359
360 cxxflags += cflags
361
362 ### Build type-specific flags ###
363
364 debug_cflags = cflags + '-fno-inline -O0 '
365 debug_cxxflags = cxxflags + '-fno-inline -O0 '
366 debug_cppflags = cppflags + '-D_DEBUG -DLL_DEBUG=1 '
367 release_cflags = cflags + '-O2 '
368 release_cxxflags = cxxflags + '-O2 '
369 release_cppflags = cppflags + '-DNDEBUG -DLL_RELEASE=1 '
370 releasenoopt_cflags = cflags + '-O0 '
371 releasenoopt_cxxflags = cxxflags + '-O0 '
372 releasenoopt_cppflags = cppflags + '-DNDEBUG -DLL_RELEASE=1 '
373 releasefordownload_cflags = cflags + '-O2 -fno-stack-protector '
374 releasefordownload_cxxflags = cxxflags + '-O2 -fno-stack-protector '
375 releasefordownload_cppflags = cppflags + '-DNDEBUG -DLL_RELEASE=1 -DLL_RELEASE_FOR_DOWNLOAD=1 '
376
377 ################
378 # ENVIRONMENT #
379 ################
380
381 # If you strip more aggressively than -S then the quality of crash-
382 # logger backtraces deteriorates.
383 strip_cmd = 'strip -S -o $TARGET $SOURCE'
384
385 # hidesyms_cmd is something which copies an executable while 'hiding'
386 # all of its exposed symbols except a very few desired ones. This is
387 # used mainly to hide the symbols of the many common libraries we
388 # static-link, which otherwise cause hard-to-trace fatal crashes due
389 # to clashes in the run-time symbol namespace.
390 if platform == 'linux':
391 exposed_symbols_file = 'newview/linux_tools/exposed-symbols.txt'
392 hidesyms_cmd = 'objcopy --keep-global-symbols ' + exposed_symbols_file + ' $SOURCE $TARGET'
393 else:
394 hidesyms_cmd = 'cp -f $SOURCE $TARGET'
395
396 compiler = gcc_bin
397 compiler_no_distcc = compiler
398 if enable_distcc:
399 compiler = 'distcc ' + gcc_bin
400
401 lib_path = [lib_dir] + [system_lib_dir]
402
403 mysql_lib_dir = '/usr/lib/mysql4/mysql'
404 if os.path.isdir(mysql_lib_dir):
405 lib_path.append(mysql_lib_dir)
406
407 if standalone:
408 system_link_flags += pkgconfig('--libs-only-L') + ' '
409 system_link_flags += pkgconfig('--libs-only-other') + ' '
410
411 base_env = Environment(CXX = compiler,
412 CPPPATH = include_dirs,
413 LIBPATH = lib_path + [havok_lib_dir],
414 LINKFLAGS = system_link_flags + '--no-keep-memory --reduce-memory-overheads ' )
415
416 ### Environments for various build types ###
417
418 env = base_env.Copy(CFLAGS=releasefordownload_cflags,
419 CPPFLAGS=releasefordownload_cppflags,
420 CXXFLAGS=releasefordownload_cxxflags)
421
422 if buildtype == 'debug':
423 env = base_env.Copy(CFLAGS=debug_cflags,
424 CPPFLAGS=debug_cppflags,
425 CXXFLAGS=debug_cxxflags)
426
427 if buildtype == 'havok1debug':
428 env = base_env.Copy(CFLAGS=debug_cflags,
429 CPPFLAGS=debug_cppflags,
430 CXXFLAGS=debug_cxxflags)
431
432 if buildtype == 'release':
433 env = base_env.Copy(CFLAGS=release_cflags,
434 CPPFLAGS=release_cppflags,
435 CXXFLAGS=release_cxxflags)
436
437 if buildtype == 'releasenoopt':
438 env = base_env.Copy(CFLAGS=releasenoopt_cflags,
439 CPPFLAGS=releasenoopt_cppflags,
440 CXXFLAGS=releasenoopt_cxxflags)
441
442 # ccache needs this to be set
443 try:
444 env['ENV']['CCACHE_DIR'] = os.environ['CCACHE_DIR']
445 except:
446 print "No CCACHE_DIR set."
447
448 env_no_distcc = env.Copy(CXX = compiler_no_distcc)
449
450 vec_match = re.compile("_vec\.")
451 env_vec = env.Copy() # _vec is for default vector optimizations or none
452
453 sse_match = re.compile("_sse\.")
454 env_sse = env.Copy()
455 env_sse.Append(CPPFLAGS = ' -msse -mfpmath=sse')
456
457 sse2_match = re.compile("_sse2\.")
458 env_sse2 = env.Copy()
459 env_sse2.Append(CPPFLAGS = ' -msse2 -mfpmath=sse')
460
461
462 ### Distributed build hosts ###
463
464 if enable_distcc:
465 if 'DISTCC_HOSTS' in os.environ:
466 hosts = os.environ['DISTCC_HOSTS']
467 else:
468 hosts = [ 'localhost/2', ]
469 if arch == 'i686':
470 dead = []
471 stations = [s for s in xrange(36) if s not in dead]
472 random.shuffle(stations)
473 hosts += ['station%d.lindenlab.com/2,lzo' % s for s in stations]
474 hosts = ' '.join(hosts)
475 print "Distributing to hosts: " + hosts
476 env['ENV']['DISTCC_HOSTS'] = hosts
477 env['ENV']['USER'] = os.environ['USER']
478 env['ENV']['HOME'] = os.environ['HOME']
479 #env['ENV']['SSH_AUTH_SOCK'] = os.environ['SSH_AUTH_SOCK']
480
481 if enable_colorgcc:
482 env['ENV']['PATH'] = os.environ['PATH']
483 env['ENV']['TERM'] = os.environ['TERM']
484 env['ENV']['HOME'] = os.environ['HOME']
485
486 ### Configure lex and yacc ###
487 env.Append(YACCFLAGS = ["-v", "-d"])
488 env.CFile(target=build_dir+'/lscript/lscript_compile/indra.l.cpp', source='lscript/lscript_compile/indra.l')
489 env.CFile(target=build_dir+'/lscript/lscript_compile/indra.y.c', source='lscript/lscript_compile/indra.y')
490 env.Command(build_dir+'/lscript/lscript_compile/indra.y.cpp',build_dir+'/lscript/lscript_compile/indra.y.c',
491 [Move('$TARGET','$SOURCE'),Delete(build_dir+'/lscript/lscript_compile/indra.y.output')])
492
493 #####################
494 # HELPER FUNCTIONS #
495 #####################
496
497 ## handle special compiler modes
498
499 def file_obj(file):
500 if file == 'newsim/lltask.cpp':
501 print 'Found lltask!'
502 return env_no_distcc.Object(file)
503 elif vec_match.search(file) != None:
504 return env_vec.Object(file)
505 elif sse_match.search(file) != None:
506 return env_sse.Object(file)
507 elif sse2_match.search(file) != None:
508 return env_sse2.Object(file)
509 else:
510 return file
511
512 ### Load a files.lst and files.PLATFORM.lst for each module ###
513
514 def load_files(module, source_fname):
515 new_list = []
516 try:
517 list_file = open('./' + module + '/' + source_fname, 'r')
518 list = Split(list_file.read())
519 for x in list:
520 if not x.startswith('#'):
521 file = os.path.join(build_dir, x)
522 new_list.append(file_obj(file))
523 list_file.close()
524 except IOError, val:
525 print 'Error: unable to open file list',source_fname,
526 print 'for module', module + ":", val
527 return []
528
529 try:
530 platform_list_file = open('./' + module + '/files.' + platform + '.lst', 'r')
531 list = Split(platform_list_file.read())
532 for x in list:
533 file = os.path.join(build_dir, x)
534 new_list.append(file_obj(file))
535 platform_list_file.close()
536 except IOError:
537 return new_list
538
539 return new_list
540
541 ### Create a static library from the module ###
542
543 def create_static_module_from_dir(
544 input_dir,
545 mod_name,
546 local_flags="",
547 source_files = 'files.lst',
548 extra_depends=None,
549 source_env=env):
550 files_list = load_files(input_dir, source_files)
551 BuildDir(build_dir + '/' + input_dir, input_dir, duplicate=duplicate)
552 local_env = source_env.Copy(CPPFLAGS=env['CPPFLAGS'] + ' ' + local_flags)
553 if extra_depends:
554 for x in files_list:
555 Depends(local_env.Object(x), extra_depends)
556 tgt = local_env.StaticLibrary(lib_dir + '/' + mod_name, files_list)
557 Default(tgt)
558
559 def create_static_module(module, local_flags="", source_env=env,
560 source_files='files.lst', extra_depends=None):
561 create_static_module_from_dir(module, module, local_flags,
562 source_files, extra_depends,
563 source_env=source_env)
564
565 def create_dynamic_module(
566 module,
567 local_flags="",
568 module_libs = [],
569 source_files = 'files.lst'):
570 # -Bsymbolic avoids having the lib pull symbols from the app's
571 # namespace instead of its own by default. This avoids some
572 # rediculous problems with multiple destruction of the wrong
573 # objects, though has some gotchas of its own.
574 dyn_link_flags = '-Wl,-Bsymbolic'
575 files_list = load_files(module, source_files)
576 BuildDir(build_dir + '/' + module, module, duplicate=duplicate)
577 local_env = env.Copy(CPPFLAGS = env['CPPFLAGS'] + ' ' + local_flags,
578 LINKFLAGS = env['LINKFLAGS'] + ' ' + dyn_link_flags)
579 tgt = local_env.SharedLibrary(lib_dir + '/' + module, files_list, LIBS = module_libs)
580 Default(tgt)
581
582 # Some libraries need to be built using PIC so that they can be
583 # linked into libllkdu.so. If we're not building libllkdu.so, we
584 # don't need to add the PIC flag.
585 def create_cond_module(module, module_libs=[]):
586 if build_target == 'client' and not opensource:
587 shared_env = env.Copy(CFLAGS=env['CFLAGS'] + '-fpic ',
588 CXXFLAGS=env['CXXFLAGS'] + '-fpic ')
589 create_static_module(module=module, source_env=shared_env)
590 else:
591 create_static_module(module=module, source_env=env)
592
593 ### Create an executable from the module ###
594
595 def create_executable(
596 exec_file, module, module_libs, source_files = 'files.lst'):
597 files_list = load_files(module, source_files)
598 BuildDir(build_dir + '/' + module, module, duplicate=duplicate)
599 tgt = env.Program(exec_file, files_list, LIBS = module_libs)
600 Default(tgt)
601
602
603 ### Check the message template for compatibility with the base ###
604 tgt = env.Command("template_verifier_output",
605 '../scripts/template_verifier.py',
606 'python $SOURCE --mode="development" --cache_master 2>&1')
607 Default(tgt)
608 AlwaysBuild(tgt)
609
610 ####################
611 # BUILD LIBRARIES #
612 ####################
613
614 create_cond_module('llcommon')
615 create_cond_module('llmath')
616 create_cond_module('llvfs')
617 create_cond_module('llimagej2coj', module_libs=['openjpeg'])
618 create_cond_module('llimage', module_libs=['llimagej2coj', 'jpeg', 'png12'])
619 create_static_module('llcrashlogger')
620 create_static_module('llmessage')
621 create_static_module('llinventory')
622 create_static_module('llcharacter')
623 create_static_module('llprimitive')
624 create_static_module('llrender')
625 create_static_module('llwindow')
626 create_static_module('llxml')
627 create_static_module('lscript', extra_depends=build_dir + '/lscript/lscript_compile/indra.y.h')
628
629 if standalone:
630 net_external_libs = [d[2:] for d in
631 pkgconfig('--libs-only-l',
632 standalone_net_pkgs).split()]
633 else:
634 net_external_libs = [ 'curl', 'ssl', 'crypto', 'aprutil-1', 'apr-1' ]
635 net_external_libs += [ 'cares', 'expat' ]
636
637 common_external_libs = net_external_libs + [ 'xmlrpc-epi', 'z' ]
638
639 if build_target == 'client':
640 if platform == 'linux':
641 #############################
642 # BUILD LINUX_CRASH_LOGGER #
643 #############################
644 output_crashlogger_bin = 'linux_crash_logger/linux-crash-logger-' + arch + '-bin'
645 if standalone:
646 external_libs = net_external_libs
647 external_libs += [d[2:] for d in
648 pkgconfig('--libs-only-l', ['gtk+-2.0']).split()]
649 else:
650 external_libs = net_external_libs + [ 'db-4.2', 'gtk-x11-2.0' ]
651 external_libs += ['boost_signals-gcc34-mt']
652 internal_libs = [ 'llui', 'llxml', 'llmessage', 'llvfs', 'llmath', 'llcommon' ]
653 create_executable(output_crashlogger_bin + '-globalsyms',
654 'linux_crash_logger',
655 internal_libs + external_libs)
656 env.Command(output_crashlogger_bin, output_crashlogger_bin + '-globalsyms', hidesyms_cmd)
657
658 create_static_module('llaudio')
659 create_static_module('llmedia')
660 create_static_module('llui')
661
662 if not opensource:
663 create_dynamic_module('llkdu', '', ['llimage', 'llvfs', 'llmath', 'llcommon', 'apr-1', 'kdu_v42R'])
664
665 ##################
666 # BUILD NEWVIEW #
667 ##################
668 output_bin = 'newview/secondlife-' + arch + '-bin'
669
670 external_libs = client_external_libs + common_external_libs
671
672 if standalone:
673 external_libs += [ d[2:] for d in
674 pkgconfig('--libs-only-l').split() ]
675 else:
676 external_libs += [ 'freetype', 'SDL', 'vorbisenc',
677 'vorbisfile', 'vorbis', 'ogg', 'db-4.2' ]
678
679 external_libs += [ 'jpeg', 'openjpeg', 'png12', 'GL', 'GLU' ]
680
681 if arch != 'x86_64' and arch != 'x86_64cross':
682 if enable_fmod:
683 external_libs += [ 'fmod-3.75' ]
684 if buildtype == 'debug':
685 external_libs += ['tcmalloc', 'stacktrace']
686
687 internal_libs = [ 'lscript', 'llwindow', 'llrender', 'llprimitive',
688 'llmedia', 'llinventory',
689 'llimage', 'llimagej2coj',
690 'llcharacter', 'llaudio', 'llui', 'llxml',
691 'llmessage', 'llvfs', 'llmath', 'llcommon' ]
692
693 create_executable(output_bin + '-globalsyms', 'newview', internal_libs + external_libs)
694 env.Command(output_bin, output_bin + '-globalsyms', hidesyms_cmd)
695 Default(output_bin)
696
697 if buildtype == 'releasefordownload':
698
699 #######################
700 # PACKAGE THE CLIENT #
701 #######################
702
703 if platform == 'linux':
704 env.Command(output_bin + '-stripped', output_bin, strip_cmd)
705 env.Command(output_crashlogger_bin + '-stripped', output_crashlogger_bin, strip_cmd)
706 product_name = 'SecondLife_' + arch + '_' + "_".join(version_viewer.split("."))
707 if grid not in ['default', 'agni']:
708 product_name += "_" + grid.upper()
709 if channel != DEFAULT_CHANNEL:
710 product_name += "_" + "".join((channel.upper()).split())
711 package_name = product_name + '.tar.bz2'
712 complete_channel = 'Second Life ' + channel
713 cmd = 'rm -rf newview/%(pn)s* && newview/viewer_manifest.py --grid=%(grid)s --channel=\'%(ch)s\' --installer_name=%(pn)s --arch=%(arch)s' % {
714 'pn': product_name,
715 'grid':grid,
716 'ch':complete_channel,
717 'arch':arch}
718 if login_channel:
719 cmd += ' --login_channel=\'Second Life %s\'' % (login_channel)
720 env.Command('newview/' + package_name, 'newview/viewer_manifest.py', cmd)
721 Depends('newview/' + package_name, output_bin + '-stripped')
722 Depends('newview/' + package_name, output_crashlogger_bin + '-stripped')
723 Default('newview/' + package_name)
724
725 elif build_target == 'server':
726 create_static_module('lldatabase')
727 create_static_module('llphysics', source_files='files.lst')
728 create_static_module('llscene')
729 create_static_module_from_dir('llkdu', 'llkdustatic')
730
731
732 ##################
733 # BUILD SERVERS #
734 ##################
735 file_suffix = ''
736 if buildtype == 'debug' or buildtype == 'havok1debug':
737 file_suffix = '_debug'
738 boost_signals_lib = 'boost_signals-gcc33-mt-d'
739 boost_libs = [ 'boost_regex-gcc33-mt-d', boost_signals_lib ]
740 else:
741 boost_signals_lib = 'boost_signals-gcc33-mt'
742 boost_libs = [ 'boost_regex-gcc33-mt', boost_signals_lib ]
743
744 common_external_libs += [ 'pthread' ]
745
746 # Chatter test application
747 external_libs = common_external_libs
748 internal_libs = [ 'llmessage', 'llvfs', 'llmath', 'llcommon' ]
749 create_executable('test_apps/chatter/chatter', 'test_apps/chatter',
750 internal_libs + external_libs)
751
752 # Tool to buffer all of standard input to memory.
753 create_executable('tools/simbin2xml/buffer_file/buffer_file',
754 'tools/simbin2xml/buffer_file', "")
755
756 # Simstate binary to XML utility.
757 external_libs = common_external_libs
758 internal_libs = [ 'llxml', 'llcommon', 'llmath' ]
759 create_executable('tools/simbin2xml/simbin2xml', 'tools/simbin2xml',
760 internal_libs + external_libs)
761
762 # Launcher
763 external_libs = common_external_libs
764 internal_libs = [ 'llmessage', 'llvfs', 'llmath', 'llcommon' ]
765 create_executable('launcher/launcher' + file_suffix, 'launcher',
766 internal_libs + external_libs)
767
768 # Dataserver
769 external_libs = common_external_libs + boost_libs + [
770 'mysqlclient', 'tcmalloc', 'stacktrace',
771 ]
772 internal_libs = [ 'llcharacter', 'lldatabase', 'llimage', 'llimagej2coj', 'llinventory',
773 'llscene', 'llmessage', 'llvfs', 'llxml', 'llcommon', 'llmath' ]
774 create_executable('dataserver/dataserver' + file_suffix, 'dataserver',
775 internal_libs + external_libs)
776
777 # Spaceserver
778 external_libs = common_external_libs + ['mysqlclient']
779 internal_libs = ['llscene', 'lldatabase', 'llmessage', 'llvfs',
780 'llmath', 'llcommon']
781 create_executable('newspace/spaceserver' + file_suffix, 'newspace',
782 internal_libs + external_libs)
783
784 # Rpcserver
785 external_libs = common_external_libs + ['xmlrpc-epi', 'mysqlclient']
786 internal_libs = ['llscene', 'llmessage', 'lldatabase', 'llvfs',
787 'llmath', 'llcommon']
788 create_executable('rpcserver/rpcserver' + file_suffix, 'rpcserver',
789 internal_libs + external_libs)
790
791 # Mapserver
792 external_libs = common_external_libs + [ 'OSMesa16', 'kdu' ] + boost_libs + [
793 'iconv', 'jpeg', 'openjpeg', 'GL', 'mysqlclient', 'png12', 'pthread', 'dl' ]
794 internal_libs = ['llrender', 'llwindow', 'llimage', 'llimagej2coj', 'lldatabase', 'llprimitive', 'llmessage', 'llkdustatic',
795 'llxml', 'llvfs', 'llmath', 'llcommon']
796 create_executable('mapserver/mapserver' + file_suffix, 'mapserver',
797 internal_libs + external_libs)
798
799 # Simulator
800 Depends('newsim/simulator' + file_suffix, 'mapserver/mapserver' + file_suffix)
801 external_libs = common_external_libs + boost_libs + [
802 'openjpeg', 'dl', 'kdu', 'mysqlclient', 'iconv', 'tcmalloc', 'stacktrace', 'png12',
803 ]
804
805 # the order of the havok libs matters
806 external_libs += [
807 'libhkcompat.a',
808 'libhkutilities.a',
809 'libhkvisualize.a',
810 'libhkdynamics.a',
811 'libhkvehicle.a',
812 'libhkcollide.a',
813 'libhkinternal.a',
814 'libhkconstraintsolver.a',
815 'libhkmath.a',
816 'libhkscenedata.a',
817 'libhkserialize.a',
818 'libhkgraphicsogl.a',
819 'libhkgraphicsbridge.a',
820 'libhkgraphics.a',
821 'libhkdemoframework.a',
822 'libhkbase.a'
823 ]
824 internal_libs = [ 'lscript', 'llprimitive',
825 'llscene', 'llphysics', 'llinventory', 'llimage', 'llimagej2coj',
826 'llcharacter', 'llxml', 'lldatabase', 'llkdustatic',
827 'llmessage', 'llvfs', 'llmath', 'llcommon' ]
828 create_executable('newsim/simulator' + file_suffix, 'newsim',
829 internal_libs + external_libs)
830
831 # texture upload verifier
832 external_libs = common_external_libs + [boost_signals_lib, 'kdu', 'openjpeg', 'png12', 'z', 'dl']
833 internal_libs = [
834 'llimage',
835 'llimagej2coj',
836 'llkdustatic',
837 'llinventory',
838 'llmessage',
839 'llvfs',
840 'llxml',
841 'llcommon',
842 'llmath' ]
843 create_executable(
844 'web/doc/asset-upload/plugins/verify-texture',
845 'web/doc/asset-upload/plugins',
846 internal_libs + external_libs,
847 'verify-texture.lst')
848
849 # notecard upload verifier
850 create_executable(
851 'web/doc/asset-upload/plugins/verify-notecard',
852 'web/doc/asset-upload/plugins',
853 internal_libs + external_libs,
854 'verify-notecard.lst')
855
856 # LSL compiler plugin for asset upload CGI.
857 external_libs = common_external_libs
858 internal_libs = ['lscript', 'llmath', 'llcommon']
859 create_executable('web/doc/asset-upload/plugins/lsl_compiler/lslc' + file_suffix, 'web/doc/asset-upload/plugins/lsl_compiler/', internal_libs + external_libs);
860
861 # Test
862 Depends('test/test', 'newsim/simulator' + file_suffix)
863 external_libs = common_external_libs + ['mysqlclient']
864 if platform == 'linux':
865 external_libs += [boost_signals_lib]
866 internal_libs = [ 'lldatabase', 'llinventory', 'llmessage', 'llxml',
867 'llvfs', 'llcharacter', 'llphysics', 'llprimitive', 'llmath', 'llcommon' ]
868 test_executable = 'test/test' + file_suffix
869 create_executable(test_executable, 'test',
870 internal_libs + external_libs)
871
872 # Run tests
873 if runtests:
874 test_results_file = 'test/test_results' + file_suffix + '.txt'
875 env.Command(test_results_file,
876 test_executable,
877 "$SOURCE 2>&1") # tee masks segfaults
878 Depends(test_results_file, test_executable)
879 Default(test_results_file)
880
881 test_script = 'test/test.py'
882 script_test_results = 'test/script_test_result' + file_suffix + '.txt'
883 env.Command(script_test_results,
884 test_script,
885 "$SOURCE 2>&1") # tee masks segfaults
886
887 Depends(script_test_results, test_results_file)
888 Default(script_test_results)
889 else:
890 print '============= SKIPPING TESTS ============='
891
892#########
893# DONE #
894#########
895