aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/develop.py
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/develop.py
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/develop.py')
-rwxr-xr-xlinden/indra/develop.py125
1 files changed, 81 insertions, 44 deletions
diff --git a/linden/indra/develop.py b/linden/indra/develop.py
index 29fe0e8..d1875c9 100755
--- a/linden/indra/develop.py
+++ b/linden/indra/develop.py
@@ -19,7 +19,8 @@
19# There are special exceptions to the terms and conditions of the GPL as 19# There are special exceptions to the terms and conditions of the GPL as
20# it is applied to this Source Code. View the full text of the exception 20# it is applied to this Source Code. View the full text of the exception
21# in the file doc/FLOSS-exception.txt in this software distribution, or 21# in the file doc/FLOSS-exception.txt in this software distribution, or
22# online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22# online at
23# http://secondlifegrid.net/programs/open_source/licensing/flossexception
23# 24#
24# By copying, modifying or distributing this software, you acknowledge 25# By copying, modifying or distributing this software, you acknowledge
25# that you have read and understood your obligations described above, 26# that you have read and understood your obligations described above,
@@ -75,6 +76,7 @@ class PlatformSetup(object):
75 build_type = build_types['relwithdebinfo'] 76 build_type = build_types['relwithdebinfo']
76 standalone = 'OFF' 77 standalone = 'OFF'
77 unattended = 'OFF' 78 unattended = 'OFF'
79 project_name = 'SecondLife'
78 distcc = True 80 distcc = True
79 cmake_opts = [] 81 cmake_opts = []
80 82
@@ -127,24 +129,6 @@ class PlatformSetup(object):
127 '-DUNATTENDED:BOOL=%(unattended)s ' 129 '-DUNATTENDED:BOOL=%(unattended)s '
128 '-G %(generator)r %(opts)s %(dir)r' % args) 130 '-G %(generator)r %(opts)s %(dir)r' % args)
129 131
130 def run(self, command, name=None):
131 '''Run a program. If the program fails, raise an exception.'''
132 ret = os.system(command)
133 if ret:
134 if name is None:
135 name = command.split(None, 1)[0]
136 if os.WIFEXITED(ret):
137 event = 'exited'
138 status = 'status %d' % os.WEXITSTATUS(ret)
139 elif os.WIFSIGNALED(ret):
140 event = 'was killed'
141 status = 'signal %d' % os.WTERMSIG(ret)
142 else:
143 event = 'died unexpectedly (!?)'
144 status = '16-bit status %d' % ret
145 raise CommandError('the command %r %s with %s' %
146 (name, event, status))
147
148 def run_cmake(self, args=[]): 132 def run_cmake(self, args=[]):
149 '''Run cmake.''' 133 '''Run cmake.'''
150 134
@@ -206,10 +190,28 @@ class PlatformSetup(object):
206 190
207 return os.path.isdir(os.path.join(self.script_dir, 'newsim')) 191 return os.path.isdir(os.path.join(self.script_dir, 'newsim'))
208 192
193 def find_in_path(self, name, defval=None, basename=False):
194 for ext in self.exe_suffixes:
195 name_ext = name + ext
196 if os.sep in name_ext:
197 path = os.path.abspath(name_ext)
198 if os.access(path, os.X_OK):
199 return [basename and os.path.basename(path) or path]
200 for p in os.getenv('PATH', self.search_path).split(os.pathsep):
201 path = os.path.join(p, name_ext)
202 if os.access(path, os.X_OK):
203 return [basename and os.path.basename(path) or path]
204 if defval:
205 return [defval]
206 return []
207
209 208
210class UnixSetup(PlatformSetup): 209class UnixSetup(PlatformSetup):
211 '''Generic Unixy build instructions.''' 210 '''Generic Unixy build instructions.'''
212 211
212 search_path = '/usr/bin:/usr/local/bin'
213 exe_suffixes = ('',)
214
213 def __init__(self): 215 def __init__(self):
214 super(UnixSetup, self).__init__() 216 super(UnixSetup, self).__init__()
215 self.generator = 'Unix Makefiles' 217 self.generator = 'Unix Makefiles'
@@ -229,6 +231,25 @@ class UnixSetup(PlatformSetup):
229 cpu = 'ppc' 231 cpu = 'ppc'
230 return cpu 232 return cpu
231 233
234 def run(self, command, name=None):
235 '''Run a program. If the program fails, raise an exception.'''
236 ret = os.system(command)
237 if ret:
238 if name is None:
239 name = command.split(None, 1)[0]
240 if os.WIFEXITED(ret):
241 st = os.WEXITSTATUS(ret)
242 if st == 127:
243 event = 'was not found'
244 else:
245 event = 'exited with status %d' % st
246 elif os.WIFSIGNALED(ret):
247 event = 'was killed by signal %d' % os.WTERMSIG(ret)
248 else:
249 event = 'died unexpectedly (!?) with 16-bit status %d' % ret
250 raise CommandError('the command %r %s' %
251 (name, event))
252
232 253
233class LinuxSetup(UnixSetup): 254class LinuxSetup(UnixSetup):
234 def __init__(self): 255 def __init__(self):
@@ -256,15 +277,6 @@ class LinuxSetup(UnixSetup):
256 else: 277 else:
257 return ['viewer-' + platform_build] 278 return ['viewer-' + platform_build]
258 279
259 def find_in_path(self, name, defval=None, basename=False):
260 for p in os.getenv('PATH', '/usr/bin').split(':'):
261 path = os.path.join(p, name)
262 if os.access(path, os.X_OK):
263 return [basename and os.path.basename(path) or path]
264 if defval:
265 return [defval]
266 return []
267
268 def cmake_commandline(self, src_dir, build_dir, opts, simple): 280 def cmake_commandline(self, src_dir, build_dir, opts, simple):
269 args = dict( 281 args = dict(
270 dir=src_dir, 282 dir=src_dir,
@@ -272,7 +284,8 @@ class LinuxSetup(UnixSetup):
272 opts=quote(opts), 284 opts=quote(opts),
273 standalone=self.standalone, 285 standalone=self.standalone,
274 unattended=self.unattended, 286 unattended=self.unattended,
275 type=self.build_type.upper() 287 type=self.build_type.upper(),
288 project_name=self.project_name
276 ) 289 )
277 if not self.is_internal_tree(): 290 if not self.is_internal_tree():
278 args.update({'cxx':'g++', 'server':'OFF', 'viewer':'ON'}) 291 args.update({'cxx':'g++', 'server':'OFF', 'viewer':'ON'})
@@ -298,6 +311,7 @@ class LinuxSetup(UnixSetup):
298 '-G %(generator)r -DSERVER:BOOL=%(server)s ' 311 '-G %(generator)r -DSERVER:BOOL=%(server)s '
299 '-DVIEWER:BOOL=%(viewer)s -DSTANDALONE:BOOL=%(standalone)s ' 312 '-DVIEWER:BOOL=%(viewer)s -DSTANDALONE:BOOL=%(standalone)s '
300 '-DUNATTENDED:BOOL=%(unattended)s ' 313 '-DUNATTENDED:BOOL=%(unattended)s '
314 '-DROOT_PROJECT_NAME:STRING=%(project_name)s '
301 '%(opts)s %(dir)r') 315 '%(opts)s %(dir)r')
302 % args) 316 % args)
303 if 'CXX' not in os.environ: 317 if 'CXX' not in os.environ:
@@ -400,6 +414,7 @@ class DarwinSetup(UnixSetup):
400 opts=quote(opts), 414 opts=quote(opts),
401 standalone=self.standalone, 415 standalone=self.standalone,
402 unattended=self.unattended, 416 unattended=self.unattended,
417 project_name=self.project_name,
403 universal='', 418 universal='',
404 type=self.build_type.upper() 419 type=self.build_type.upper()
405 ) 420 )
@@ -411,6 +426,7 @@ class DarwinSetup(UnixSetup):
411 '-DCMAKE_BUILD_TYPE:STRING=%(type)s ' 426 '-DCMAKE_BUILD_TYPE:STRING=%(type)s '
412 '-DSTANDALONE:BOOL=%(standalone)s ' 427 '-DSTANDALONE:BOOL=%(standalone)s '
413 '-DUNATTENDED:BOOL=%(unattended)s ' 428 '-DUNATTENDED:BOOL=%(unattended)s '
429 '-DROOT_PROJECT_NAME:STRING=%(project_name)s '
414 '%(universal)s ' 430 '%(universal)s '
415 '%(opts)s %(dir)r' % args) 431 '%(opts)s %(dir)r' % args)
416 432
@@ -451,6 +467,9 @@ class WindowsSetup(PlatformSetup):
451 gens['vs2005'] = gens['vc80'] 467 gens['vs2005'] = gens['vc80']
452 gens['vs2008'] = gens['vc90'] 468 gens['vs2008'] = gens['vc90']
453 469
470 search_path = r'C:\windows'
471 exe_suffixes = ('.exe', '.bat', '.com')
472
454 def __init__(self): 473 def __init__(self):
455 super(WindowsSetup, self).__init__() 474 super(WindowsSetup, self).__init__()
456 self._generator = None 475 self._generator = None
@@ -486,12 +505,14 @@ class WindowsSetup(PlatformSetup):
486 opts=quote(opts), 505 opts=quote(opts),
487 standalone=self.standalone, 506 standalone=self.standalone,
488 unattended=self.unattended, 507 unattended=self.unattended,
508 project_name=self.project_name
489 ) 509 )
490 #if simple: 510 #if simple:
491 # return 'cmake %(opts)s "%(dir)s"' % args 511 # return 'cmake %(opts)s "%(dir)s"' % args
492 return ('cmake -G "%(generator)s" ' 512 return ('cmake -G "%(generator)s" '
493 '-DSTANDALONE:BOOL=%(standalone)s ' 513 '-DSTANDALONE:BOOL=%(standalone)s '
494 '-DUNATTENDED:BOOL=%(unattended)s ' 514 '-DUNATTENDED:BOOL=%(unattended)s '
515 '-DROOT_PROJECT_NAME:STRING=%(project_name)s '
495 '%(opts)s "%(dir)s"' % args) 516 '%(opts)s "%(dir)s"' % args)
496 517
497 def find_visual_studio(self, gen=None): 518 def find_visual_studio(self, gen=None):
@@ -522,21 +543,24 @@ class WindowsSetup(PlatformSetup):
522 if self.gens[self.generator]['ver'] in [ r'8.0', r'9.0' ]: 543 if self.gens[self.generator]['ver'] in [ r'8.0', r'9.0' ]:
523 config = '\"%s|Win32\"' % config 544 config = '\"%s|Win32\"' % config
524 545
525 return "buildconsole Secondlife.sln /build %s" % config 546 return "buildconsole %s.sln /build %s" % (self.project_name, config)
526 547
527 # devenv.com is CLI friendly, devenv.exe... not so much. 548 # devenv.com is CLI friendly, devenv.exe... not so much.
528 return ('"%sdevenv.com" Secondlife.sln /build %s' % 549 return ('"%sdevenv.com" %s.sln /build %s' %
529 (self.find_visual_studio(), self.build_type)) 550 (self.find_visual_studio(), self.project_name, self.build_type))
530 551
531 # this override of run exists because the PlatformSetup version
532 # uses Unix/Mac only calls. Freakin' os module!
533 def run(self, command, name=None): 552 def run(self, command, name=None):
534 '''Run a program. If the program fails, raise an exception.''' 553 '''Run a program. If the program fails, raise an exception.'''
535 ret = os.system(command) 554 ret = os.system(command)
536 if ret: 555 if ret:
537 if name is None: 556 if name is None:
538 name = command.split(None, 1)[0] 557 name = command.split(None, 1)[0]
539 raise CommandError('the command %r exited with %s' % 558 path = self.find_in_path(name)
559 if not path:
560 ret = 'was not found'
561 else:
562 ret = 'exited with status %d' % ret
563 raise CommandError('the command %r %s' %
540 (name, ret)) 564 (name, ret))
541 565
542 def run_cmake(self, args=[]): 566 def run_cmake(self, args=[]):
@@ -596,12 +620,14 @@ class CygwinSetup(WindowsSetup):
596 opts=quote(opts), 620 opts=quote(opts),
597 standalone=self.standalone, 621 standalone=self.standalone,
598 unattended=self.unattended, 622 unattended=self.unattended,
623 project_name=self.project_name
599 ) 624 )
600 #if simple: 625 #if simple:
601 # return 'cmake %(opts)s "%(dir)s"' % args 626 # return 'cmake %(opts)s "%(dir)s"' % args
602 return ('cmake -G "%(generator)s" ' 627 return ('cmake -G "%(generator)s" '
603 '-DUNATTENDED:BOOl=%(unattended)s ' 628 '-DUNATTENDED:BOOl=%(unattended)s '
604 '-DSTANDALONE:BOOL=%(standalone)s ' 629 '-DSTANDALONE:BOOL=%(standalone)s '
630 '-DROOT_PROJECT_NAME:STRING=%(project_name)s '
605 '%(opts)s "%(dir)s"' % args) 631 '%(opts)s "%(dir)s"' % args)
606 632
607setup_platform = { 633setup_platform = {
@@ -613,7 +639,7 @@ setup_platform = {
613 639
614 640
615usage_msg = ''' 641usage_msg = '''
616Usage: develop.py [options] command [command-options] 642Usage: develop.py [options] [command [command-options]]
617 643
618Options: 644Options:
619 -h | --help print this help message 645 -h | --help print this help message
@@ -623,21 +649,29 @@ Options:
623 -t | --type=NAME build type ("Debug", "Release", or "RelWithDebInfo") 649 -t | --type=NAME build type ("Debug", "Release", or "RelWithDebInfo")
624 -N | --no-distcc disable use of distcc 650 -N | --no-distcc disable use of distcc
625 -G | --generator=NAME generator name 651 -G | --generator=NAME generator name
626 Windows: VC71 or VS2003 (default), VC80 (VS2005) or VC90 (VS2008) 652 Windows: VC71 or VS2003 (default), VC80 (VS2005) or
653 VC90 (VS2008)
627 Mac OS X: Xcode (default), Unix Makefiles 654 Mac OS X: Xcode (default), Unix Makefiles
628 Linux: Unix Makefiles (default), KDevelop3 655 Linux: Unix Makefiles (default), KDevelop3
656 -p | --project=NAME set the root project name. (Doesn't effect makefiles)
657
629Commands: 658Commands:
630 build configure and build default target 659 build configure and build default target
631 clean delete all build directories (does not affect sources) 660 clean delete all build directories, does not affect sources
632 configure configure project by running cmake 661 configure configure project by running cmake (default command if none given)
633 662
634If you do not specify a command, the default is "configure". 663Command-options for "configure":
664 We use cmake variables to change the build configuration.
665 -DSERVER:BOOL=OFF Don't configure simulator/dataserver/etc
666 -DVIEWER:BOOL=OFF Don't configure the viewer
667 -DPACKAGE:BOOL=ON Create "package" target to make installers
668 -DLOCALIZESETUP:BOOL=ON Create one win_setup target per supported language
635 669
636Examples: 670Examples:
637 Set up a viewer-only project for your system: 671 Set up a viewer-only project for your system:
638 develop.py configure -DSERVER:BOOL=OFF 672 develop.py configure -DSERVER:BOOL=OFF
639 673
640 Set up a Visual Studio 2005 project with package target (to build installer): 674 Set up a Visual Studio 2005 project with "package" target:
641 develop.py -G vc80 configure -DPACKAGE:BOOL=ON 675 develop.py -G vc80 configure -DPACKAGE:BOOL=ON
642''' 676'''
643 677
@@ -646,13 +680,14 @@ def main(arguments):
646 try: 680 try:
647 opts, args = getopt.getopt( 681 opts, args = getopt.getopt(
648 arguments, 682 arguments,
649 '?hNt:G:', 683 '?hNt:p:G:',
650 ['help', 'standalone', 'no-distcc', 'unattended', 'type=', 'incredibuild', 'generator=']) 684 ['help', 'standalone', 'no-distcc', 'unattended', 'type=', 'incredibuild', 'generator=', 'project='])
651 except getopt.GetoptError, err: 685 except getopt.GetoptError, err:
652 print >> sys.stderr, 'Error:', err 686 print >> sys.stderr, 'Error:', err
653 print >> sys.stderr, """ 687 print >> sys.stderr, """
654Note: You must pass -D options to cmake after the "configure" command 688Note: You must pass -D options to cmake after the "configure" command
655For example: develop.py configure -DSERVER:BOOL=OFF""" 689For example: develop.py configure -DSERVER:BOOL=OFF"""
690 print >> sys.stderr, usage_msg.strip()
656 sys.exit(1) 691 sys.exit(1)
657 692
658 for o, a in opts: 693 for o, a in opts:
@@ -678,6 +713,8 @@ For example: develop.py configure -DSERVER:BOOL=OFF"""
678 setup.generator = a 713 setup.generator = a
679 elif o in ('-N', '--no-distcc'): 714 elif o in ('-N', '--no-distcc'):
680 setup.distcc = False 715 setup.distcc = False
716 elif o in ('-p', '--project'):
717 setup.project_name = a
681 elif o in ('--incredibuild'): 718 elif o in ('--incredibuild'):
682 setup.incredibuild = True 719 setup.incredibuild = True
683 else: 720 else: