aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/SConstruct
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/SConstruct')
-rw-r--r--linden/indra/SConstruct129
1 files changed, 97 insertions, 32 deletions
diff --git a/linden/indra/SConstruct b/linden/indra/SConstruct
index f988b1b..e90a7e6 100644
--- a/linden/indra/SConstruct
+++ b/linden/indra/SConstruct
@@ -10,7 +10,7 @@
10# installed, with headers. We pick up the correct flags to use for 10# installed, with headers. We pick up the correct flags to use for
11# these libraries using the "pkg-config" command. 11# these libraries using the "pkg-config" command.
12# 12#
13# cairo glib-2.0 gtk+-2.0 sdl vorbis vorbisenc vorbisfile 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# 14#
15# Then build as follows: 15# Then build as follows:
16# 16#
@@ -99,6 +99,7 @@ opts.AddOptions(
99 BoolOption('DISTCC', 'Enabled distcc', True), 99 BoolOption('DISTCC', 'Enabled distcc', True),
100 BoolOption('MOZLIB', 'Enabled llmozlib/mozilla support', True), 100 BoolOption('MOZLIB', 'Enabled llmozlib/mozilla support', True),
101 BoolOption('FMOD', 'Enabled FMOD audio support', True), 101 BoolOption('FMOD', 'Enabled FMOD audio support', True),
102 BoolOption('GSTREAMER', 'Enabled GStreamer support', True),
102 BoolOption('COLORGCC', 'Enabled colorgcc', True), 103 BoolOption('COLORGCC', 'Enabled colorgcc', True),
103 EnumOption('GRID', 'Client package\'s default grid', 'default', 104 EnumOption('GRID', 'Client package\'s default grid', 'default',
104 allowed_values=('default', 'aditi', 'agni', 'dmz', 'durga', 'firstlook', 'ganga', 'shakti', 'siva', 'soma', 'uma', 'vaak')), 105 allowed_values=('default', 'aditi', 'agni', 'dmz', 'durga', 'firstlook', 'ganga', 'shakti', 'siva', 'soma', 'uma', 'vaak')),
@@ -114,6 +115,7 @@ arch = optenv['ARCH']
114target_param = optenv['BTARGET'] 115target_param = optenv['BTARGET']
115enable_distcc = optenv['DISTCC'] 116enable_distcc = optenv['DISTCC']
116enable_mozlib = optenv['MOZLIB'] 117enable_mozlib = optenv['MOZLIB']
118enable_gstreamer = optenv['GSTREAMER']
117enable_colorgcc = optenv['COLORGCC'] 119enable_colorgcc = optenv['COLORGCC']
118grid = optenv['GRID'] 120grid = optenv['GRID']
119standalone = optenv['STANDALONE'] 121standalone = optenv['STANDALONE']
@@ -133,14 +135,35 @@ duplicate = True
133if standalone and platform != 'linux': 135if standalone and platform != 'linux':
134 print >> sys.stderr, 'Warning: standalone builds have only been tested on Linux' 136 print >> sys.stderr, 'Warning: standalone builds have only been tested on Linux'
135 137
136standalone_pkgs = 'cairo glib-2.0 gtk+-2.0 sdl vorbis vorbisenc vorbisfile' 138standalone_pkgs = [
139 'apr-1',
140 'apr-util-1',
141 'atk',
142 'cairo',
143 'freetype2',
144 'gdk-2.0',
145 'gdk-pixbuf-2.0',
146 'glib-2.0',
147 'gmodule-2.0',
148 'gtk+-2.0',
149 'libcurl',
150 'libpng',
151 'pango',
152 'pangoft2',
153 'pangox',
154 'pangoxft',
155 'sdl',
156 'vorbis',
157 'vorbisenc',
158 'vorbisfile',
159 ]
137 160
138def pkgconfig(opt, pkgs=None): 161def pkgconfig(opt, pkgs=None):
139 return os.popen('pkg-config %s %s' % 162 return os.popen('pkg-config %s %s' %
140 (opt, pkgs or standalone_pkgs)).read().strip() 163 (opt, pkgs or ' '.join(standalone_pkgs))).read().strip()
141 164
142if standalone: 165if standalone:
143 missing = [pkg for pkg in standalone_pkgs.split() 166 missing = [pkg for pkg in standalone_pkgs
144 if os.system('pkg-config --exists ' + pkg)] 167 if os.system('pkg-config --exists ' + pkg)]
145 if missing: 168 if missing:
146 print >> sys.stderr, ('Error: pkg-config cannot find these ' 169 print >> sys.stderr, ('Error: pkg-config cannot find these '
@@ -194,7 +217,10 @@ for build_target in targets:
194 if arch == 'x86_64' and os.path.exists('/usr/lib64'): 217 if arch == 'x86_64' and os.path.exists('/usr/lib64'):
195 client_external_libs = [File('/usr/lib64/libresolv.a')] 218 client_external_libs = [File('/usr/lib64/libresolv.a')]
196 else: 219 else:
197 client_external_libs = ['llresolv6'] 220 # Custom libresolv build which avoids a billion flavors of
221 # brokenness prevalent in common libresolvs out there.
222 client_external_libs = ['resolv']
223 include_dirs += ['../libraries/' + system_str + '/include/llresolv8']
198 else: 224 else:
199 client_external_libs = ['resolv'] 225 client_external_libs = ['resolv']
200 226
@@ -230,7 +256,9 @@ for build_target in targets:
230 # Generic GCC flags 256 # Generic GCC flags
231 cflags = '-g -pipe -Wall -Wno-trigraphs -Wno-sign-compare -Werror ' 257 cflags = '-g -pipe -Wall -Wno-trigraphs -Wno-sign-compare -Werror '
232 cxxflags = '' 258 cxxflags = ''
233 cppflags = '' 259 cppflags = '-D_FORTIFY_SOURCE=2 '
260 if standalone:
261 cppflags += '-DLL_STANDALONE '
234 262
235 if build_target == 'server': 263 if build_target == 'server':
236 # Server flags 264 # Server flags
@@ -255,6 +283,7 @@ for build_target in targets:
255 client_cppflags = '' 283 client_cppflags = ''
256 cppflags += client_cppflags + ' ' 284 cppflags += client_cppflags + ' '
257 285
286
258 if platform == 'linux': 287 if platform == 'linux':
259 # Linux-only flags 288 # Linux-only flags
260 cppflags += '-DLL_LINUX=1 ' 289 cppflags += '-DLL_LINUX=1 '
@@ -267,14 +296,14 @@ for build_target in targets:
267 include_dirs += [d[2:] for d in 296 include_dirs += [d[2:] for d in
268 pkgconfig('--cflags-only-I').split()] 297 pkgconfig('--cflags-only-I').split()]
269 else: 298 else:
270 client_external_libs += [ 'gtk-x11-2.0' ] 299 client_external_libs += [ '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' ]
271 incdirs = [ 'ELFIO', 'atk-1.0', 'glib-2.0', 'gtk-2.0', 300 incdirs = [ 'ELFIO', 'atk-1.0', 'glib-2.0', 'gtk-2.0',
272 'llfreetype2', 'pango-1.0' ] 301 'llfreetype2', 'pango-1.0' ]
273 include_dirs += ['../libraries/' + system_str + '/include/' + d 302 include_dirs += ['../libraries/' + system_str + '/include/' + d
274 for d in incdirs] 303 for d in incdirs]
275 304
276 if elfio: 305 if elfio:
277 client_external_libs += [ 'elfio' ] 306 client_external_libs += [ 'ELFIO' ]
278 else: 307 else:
279 cppflags += '-DLL_ELFBIN=0 ' 308 cppflags += '-DLL_ELFBIN=0 '
280 309
@@ -285,6 +314,17 @@ for build_target in targets:
285 client_external_libs += [ 'mozjs', 'nspr4', 'plc4', 'plds4', 'profdirserviceprovider_s', 'xpcom', 'xul' ] 314 client_external_libs += [ 'mozjs', 'nspr4', 'plc4', 'plds4', 'profdirserviceprovider_s', 'xpcom', 'xul' ]
286 else: 315 else:
287 cppflags += '-DLL_LIBXUL_ENABLED=0 ' 316 cppflags += '-DLL_LIBXUL_ENABLED=0 '
317
318 # GStreamer stuff
319 if enable_gstreamer:
320 cppflags += '-DLL_GSTREAMER_ENABLED=1 '
321 client_external_libs += [ 'glib-2.0', 'gobject-2.0' ]
322 #client_external_libs += [ 'gstreamer-0.10', 'gstvideo-0.10', 'gstaudio-0.10' ]
323 include_dirs += [ '../libraries/' + system_str + '/include/gstreamer-0.10' ]
324 include_dirs += [ '../libraries/' + system_str + '/include/glib-2.0', '../libraries/' + system_str + '/include/glib-2.0/include' ]
325 include_dirs += [ '../libraries/' + system_str + '/include/libxml2']
326 else:
327 cppflags += '-DLL_GSTREAMER_ENABLED=0 '
288 else: 328 else:
289 # Mac-only flags 329 # Mac-only flags
290 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 ' 330 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 '
@@ -392,6 +432,18 @@ for build_target in targets:
392 432
393 env_no_distcc = env.Copy(CXX = compiler_no_distcc) 433 env_no_distcc = env.Copy(CXX = compiler_no_distcc)
394 434
435 vec_match = re.compile("_vec\.")
436 env_vec = env.Copy() # _vec is for default vector optimizations or none
437
438 sse_match = re.compile("_sse\.")
439 env_sse = env.Copy()
440 env_sse.Append(CPPFLAGS = ' -msse -mfpmath=sse')
441
442 sse2_match = re.compile("_sse2\.")
443 env_sse2 = env.Copy()
444 env_sse2.Append(CPPFLAGS = ' -msse2 -mfpmath=sse')
445
446
395 ### Distributed build hosts ### 447 ### Distributed build hosts ###
396 448
397 if enable_distcc: 449 if enable_distcc:
@@ -419,6 +471,21 @@ for build_target in targets:
419 # HELPER FUNCTIONS # 471 # HELPER FUNCTIONS #
420 ##################### 472 #####################
421 473
474 ## handle special compiler modes
475
476 def file_obj(file):
477 if file == 'newsim/lltask.cpp':
478 print 'Found lltask!'
479 return env_no_distcc.Object(file)
480 elif vec_match.search(file) != None:
481 return env_vec.Object(file)
482 elif sse_match.search(file) != None:
483 return env_sse.Object(file)
484 elif sse2_match.search(file) != None:
485 return env_sse2.Object(file)
486 else:
487 return file
488
422 ### Load a files.lst and files.PLATFORM.lst for each module ### 489 ### Load a files.lst and files.PLATFORM.lst for each module ###
423 490
424 def load_files(module, source_fname): 491 def load_files(module, source_fname):
@@ -429,12 +496,7 @@ for build_target in targets:
429 for x in list: 496 for x in list:
430 if not x.startswith('#'): 497 if not x.startswith('#'):
431 file = os.path.join(build_dir, x) 498 file = os.path.join(build_dir, x)
432 if x == 'newsim/lltask.cpp': 499 new_list.append(file_obj(file))
433 print 'Found lltask!'
434 obj = env_no_distcc.Object(file)
435 new_list.append(obj)
436 else:
437 new_list.append(file)
438 list_file.close() 500 list_file.close()
439 except IOError, val: 501 except IOError, val:
440 print 'Error: unable to open file list',source_fname, 502 print 'Error: unable to open file list',source_fname,
@@ -446,7 +508,7 @@ for build_target in targets:
446 list = Split(platform_list_file.read()) 508 list = Split(platform_list_file.read())
447 for x in list: 509 for x in list:
448 file = os.path.join(build_dir, x) 510 file = os.path.join(build_dir, x)
449 new_list.append(file) 511 new_list.append(file_obj(file))
450 platform_list_file.close() 512 platform_list_file.close()
451 except IOError: 513 except IOError:
452 return new_list 514 return new_list
@@ -460,18 +522,22 @@ for build_target in targets:
460 mod_name, 522 mod_name,
461 local_flags="", 523 local_flags="",
462 source_files = 'files.lst', 524 source_files = 'files.lst',
463 extra_depends=None): 525 extra_depends=None,
526 source_env=env):
464 files_list = load_files(input_dir, source_files) 527 files_list = load_files(input_dir, source_files)
465 BuildDir(build_dir + '/' + input_dir, input_dir, duplicate=duplicate) 528 BuildDir(build_dir + '/' + input_dir, input_dir, duplicate=duplicate)
466 local_env = env.Copy(CPPFLAGS = env['CPPFLAGS'] + ' ' + local_flags) 529 local_env = source_env.Copy(CPPFLAGS=env['CPPFLAGS'] + ' ' + local_flags)
467 if extra_depends: 530 if extra_depends:
468 for x in files_list: 531 for x in files_list:
469 Depends(local_env.Object(x), extra_depends) 532 Depends(local_env.Object(x), extra_depends)
470 tgt = local_env.StaticLibrary(lib_dir + '/' + mod_name, files_list) 533 tgt = local_env.StaticLibrary(lib_dir + '/' + mod_name, files_list)
471 Default(tgt) 534 Default(tgt)
472 535
473 def create_static_module(module, local_flags="", source_files = 'files.lst', extra_depends=None): 536 def create_static_module(module, local_flags="", source_env=env,
474 create_static_module_from_dir(module, module, local_flags, source_files, extra_depends) 537 source_files='files.lst', extra_depends=None):
538 create_static_module_from_dir(module, module, local_flags,
539 source_files, extra_depends,
540 source_env=source_env)
475 541
476 def create_dynamic_module( 542 def create_dynamic_module(
477 module, 543 module,
@@ -484,11 +550,16 @@ for build_target in targets:
484 tgt = local_env.SharedLibrary(lib_dir + '/' + module, files_list, LIBS = module_libs) 550 tgt = local_env.SharedLibrary(lib_dir + '/' + module, files_list, LIBS = module_libs)
485 Default(tgt) 551 Default(tgt)
486 552
553 # Some libraries need to be built using PIC so that they can be
554 # linked into libllkdu.so. If we're not building libllkdu.so, we
555 # don't need to add the PIC flag.
487 def create_cond_module(module, module_libs=[]): 556 def create_cond_module(module, module_libs=[]):
488 if build_target != 'client' or not opensource: 557 if build_target == 'client' and not opensource:
489 create_static_module(module=module) 558 shared_env = env.Copy(CFLAGS=env['CFLAGS'] + '-fpic ',
559 CXXFLAGS=env['CXXFLAGS'] + '-fpic ')
560 create_static_module(module=module, source_env=shared_env)
490 else: 561 else:
491 create_dynamic_module(module=module, module_libs=module_libs) 562 create_static_module(module=module, source_env=env)
492 563
493 ### Create an executable from the module ### 564 ### Create an executable from the module ###
494 565
@@ -503,7 +574,7 @@ for build_target in targets:
503 ### Check the message template for compatibility with the base ### 574 ### Check the message template for compatibility with the base ###
504 tgt = env.Command("template_verifier_output", 575 tgt = env.Command("template_verifier_output",
505 '../scripts/template_verifier.py', 576 '../scripts/template_verifier.py',
506 'python $SOURCE --mode="development" 2>&1') 577 'python $SOURCE --mode="development" --cache_master 2>&1')
507 Default(tgt) 578 Default(tgt)
508 AlwaysBuild(tgt) 579 AlwaysBuild(tgt)
509 580
@@ -539,7 +610,7 @@ for build_target in targets:
539 ############################# 610 #############################
540 output_crashlogger_bin = 'linux_crash_logger/linux-crash-logger-' + arch + '-bin' 611 output_crashlogger_bin = 'linux_crash_logger/linux-crash-logger-' + arch + '-bin'
541 if standalone: 612 if standalone:
542 external_libs = net_external_libs + [ 'db' ] 613 external_libs = net_external_libs
543 external_libs += [d[2:] for d in 614 external_libs += [d[2:] for d in
544 pkgconfig('--libs-only-l', 'gtk+-2.0').split()] 615 pkgconfig('--libs-only-l', 'gtk+-2.0').split()]
545 else: 616 else:
@@ -566,7 +637,6 @@ for build_target in targets:
566 external_libs = client_external_libs + common_external_libs 637 external_libs = client_external_libs + common_external_libs
567 638
568 if standalone: 639 if standalone:
569 external_libs += [ 'db' ]
570 external_libs += [ d[2:] for d in 640 external_libs += [ d[2:] for d in
571 pkgconfig('--libs-only-l').split() ] 641 pkgconfig('--libs-only-l').split() ]
572 else: 642 else:
@@ -654,15 +724,13 @@ for build_target in targets:
654 internal_libs + external_libs) 724 internal_libs + external_libs)
655 725
656 # Dataserver 726 # Dataserver
657 Depends('dataserver/dataserver', 'launcher/launcher' + file_suffix) 727 external_libs = common_external_libs + ['boost_regex-gcc-mt', 'mysqlclient']
658 external_libs = common_external_libs + ['boost_regex-gcc-mt', 'mysqlclient', 'tcmalloc', 'stacktrace']
659 internal_libs = [ 'llcharacter', 'lldatabase', 'llimage', 'llimagej2coj', 'llinventory', 728 internal_libs = [ 'llcharacter', 'lldatabase', 'llimage', 'llimagej2coj', 'llinventory',
660 'llscene', 'llmessage', 'llvfs', 'llxml', 'llcommon', 'llmath' ] 729 'llscene', 'llmessage', 'llvfs', 'llxml', 'llcommon', 'llmath' ]
661 create_executable('dataserver/dataserver' + file_suffix, 'dataserver', 730 create_executable('dataserver/dataserver' + file_suffix, 'dataserver',
662 internal_libs + external_libs) 731 internal_libs + external_libs)
663 732
664 # Spaceserver 733 # Spaceserver
665 Depends('newspace/spaceserver', 'dataserver/dataserver' + file_suffix)
666 external_libs = common_external_libs + ['mysqlclient'] 734 external_libs = common_external_libs + ['mysqlclient']
667 internal_libs = ['llscene', 'lldatabase', 'llmessage', 'llvfs', 735 internal_libs = ['llscene', 'lldatabase', 'llmessage', 'llvfs',
668 'llmath', 'llcommon'] 736 'llmath', 'llcommon']
@@ -670,7 +738,6 @@ for build_target in targets:
670 internal_libs + external_libs) 738 internal_libs + external_libs)
671 739
672 # Rpcserver 740 # Rpcserver
673 Depends('rpcserver/rpcserver', 'newspace/spaceserver' + file_suffix)
674 external_libs = common_external_libs + ['xmlrpc', 'mysqlclient'] 741 external_libs = common_external_libs + ['xmlrpc', 'mysqlclient']
675 internal_libs = ['llscene', 'llmessage', 'lldatabase', 'llvfs', 742 internal_libs = ['llscene', 'llmessage', 'lldatabase', 'llvfs',
676 'llmath', 'llcommon'] 743 'llmath', 'llcommon']
@@ -678,7 +745,6 @@ for build_target in targets:
678 internal_libs + external_libs) 745 internal_libs + external_libs)
679 746
680 # Mapserver 747 # Mapserver
681 Depends('mapserver/mapserver', 'rpcserver/rpcserver' + file_suffix)
682 external_libs = common_external_libs + ['OSMesa16', 'kdu', 748 external_libs = common_external_libs + ['OSMesa16', 'kdu',
683 'boost_regex-gcc-mt', 'iconv', 'jpeg', 'openjpeg', 'GL', 749 'boost_regex-gcc-mt', 'iconv', 'jpeg', 'openjpeg', 'GL',
684 'mysqlclient', 'pthread', 'dl'] 750 'mysqlclient', 'pthread', 'dl']
@@ -688,8 +754,7 @@ for build_target in targets:
688 internal_libs + external_libs) 754 internal_libs + external_libs)
689 755
690 # Simulator 756 # Simulator
691 Depends('newsim/simulator' + file_suffix, 'mapserver/mapserver' + file_suffix) 757 external_libs = common_external_libs + ['hkdynamics', 'hkgeometry', 'hkmath', 'hkbase', 'hkcollide', 'hkactions', 'boost_regex-gcc-mt', 'openjpeg', 'dl', 'kdu', 'mysqlclient', 'iconv']
692 external_libs = common_external_libs + ['hkdynamics', 'hkgeometry', 'hkmath', 'hkbase', 'hkcollide', 'hkactions', 'boost_regex-gcc-mt', 'openjpeg', 'dl', 'kdu', 'mysqlclient', 'iconv', 'tcmalloc', 'stacktrace']
693 internal_libs = [ 'lscript', 'llprimitive', 758 internal_libs = [ 'lscript', 'llprimitive',
694 'llscene', 'llhavok', 'llinventory', 'llimage', 'llimagej2coj', 759 'llscene', 'llhavok', 'llinventory', 'llimage', 'llimagej2coj',
695 'llcharacter', 'llxml', 'lldatabase', 'llkdustatic', 760 'llcharacter', 'llxml', 'lldatabase', 'llkdustatic',