diff options
Diffstat (limited to 'make/configure.py')
-rw-r--r-- | make/configure.py | 123 |
1 files changed, 82 insertions, 41 deletions
diff --git a/make/configure.py b/make/configure.py index 5e61b6e5a..3e6fb81b5 100644 --- a/make/configure.py +++ b/make/configure.py @@ -8,6 +8,7 @@ ############################################################################### import fnmatch +import glob import optparse import os import platform @@ -99,12 +100,6 @@ class Configure( object ): cfg.infof( 'compute: makevar BUILD/ = %s\n', self.build_final ) cfg.infof( 'compute: makevar PREFIX/ = %s\n', self.prefix_final ) - ## xcode does a chdir so we need appropriate values - macosx = os.path.join( self.src_dir, 'macosx' ) - self.xcode_x_src = self._final_dir( macosx, self.src_dir ) - self.xcode_x_build = self._final_dir( macosx, self.build_dir ) - self.xcode_x_prefix = self._final_dir( macosx, self.prefix_dir ) - ## perform chdir and enable log recording def chdir( self ): if os.path.abspath( self.build_dir ) == os.path.abspath( self.src_dir ): @@ -402,8 +397,10 @@ class LDProbe( Action ): ## ## example results from various platforms: ## -## i386-apple-darwin9.6.0 (Mac OS X 10.5.6 Intel) ## powerpc-apple-darwin9.6.0 (Mac OS X 10.5.6 PPC) +## i386-apple-darwin9.6.0 (Mac OS X 10.5.6 Intel) +## x86_64-apple-darwin10.8.0 (Mac OS X 10.6.8 Intel) +## x86_64-apple-darwin11.2.0 (Mac OS X 10.7.2 Intel) ## i686-pc-cygwin (Cygwin, Microsoft Vista) ## x86_64-unknown-linux-gnu (Linux, Fedora 10 x86_64) ## @@ -553,6 +550,9 @@ class ArchAction( Action ): ## some match on system should be made here; otherwise we signal a warning. if host.match( '*-*-cygwin*' ): pass + elif host.match( '*-*-darwin11.*' ): + self.mode['i386'] = 'i386-apple-darwin%s' % (host.release) + self.mode['x86_64'] = 'x86_64-apple-darwin%s' % (host.release) elif host.match( '*-*-darwin*' ): self.mode['i386'] = 'i386-apple-darwin%s' % (host.release) self.mode['x86_64'] = 'x86_64-apple-darwin%s' % (host.release) @@ -628,20 +628,24 @@ class CoreProbe( Action ): class SelectMode( dict ): def __init__( self, descr, *modes, **kwargs ): super( SelectMode, self ).__init__( modes ) - self.descr = descr - self.modes = modes - self.default = kwargs.get('default',modes[0][0]) - self.mode = self.default + self.descr = descr + self.modes = modes + self.what = kwargs.get('what',' mode') + if modes: + self.default = kwargs.get('default',modes[0][0]) + else: + self.default = None + self.mode = self.default def cli_add_option( self, parser, option ): parser.add_option( option, default=self.mode, metavar='MODE', - help='select %s mode: %s' % (self.descr,self.toString()), + help='select %s%s: %s' % (self.descr,self.what,self.toString()), action='callback', callback=self.cli_callback, type='str' ) def cli_callback( self, option, opt_str, value, parser, *args, **kwargs ): if value not in self: - raise optparse.OptionValueError( 'invalid %s mode: %s (choose from %s)' - % (self.descr,value,self.toString( True )) ) + raise optparse.OptionValueError( 'invalid %s%s: %s (choose from: %s)' + % (self.descr,self.what,value,self.toString( True )) ) self.mode = value def toString( self, nodefault=False ): @@ -671,7 +675,23 @@ class SelectMode( dict ): ## class RepoProbe( ShellProbe ): def __init__( self ): - super( RepoProbe, self ).__init__( 'svn info', 'svn info %s' % (cfg.src_dir) ) + svn = 'svn' + + ## Possible the repo was created using an incompatible version than what is + ## available in PATH when probe runs. Workaround by checking for file + ## .svn/HANDBRAKE_REPO_PROBE which points to a preferred svn executable. + try: + hrp = os.path.join( cfg.src_dir, '.svn', 'HANDBRAKE_REPO_PROBE' ) + if os.path.isfile( hrp ) and os.path.getsize( hrp ) > 0: + file = cfg.open( hrp, 'r' ) + line = file.readline().strip() + file.close() + if line: + svn = line + except: + pass + + super( RepoProbe, self ).__init__( 'svn info', '%s info %s' % (svn,cfg.src_dir) ) self.url = 'svn://nowhere.com/project/unknown' self.root = 'svn://nowhere.com/project' @@ -865,7 +885,7 @@ class SelectTool( Action ): self.run() break if not found: - raise optparse.OptionValueError( 'invalid %s mode: %s (choose from %s)' + raise optparse.OptionValueError( 'invalid %s mode: %s (choose from: %s)' % (self.name,value,self.toString( True )) ) def doc_add( self, doc ): @@ -1003,8 +1023,8 @@ class Option( optparse.Option ): conf_args = [] def _conf_record( self, opt, value ): - ## skip conf,force,launch - if re.match( '^--(conf|force|launch).*$', opt ): + ## filter out non-applicable options + if re.match( '^--(force|launch).*$', opt ): return ## remove duplicates (last duplicate wins) @@ -1030,13 +1050,13 @@ def createCLI(): cli.description += 'Configure %s build system.' % (project.name) ## add hidden options - cli.add_option( '--conf-method', default='terminal', action='store', help=optparse.SUPPRESS_HELP ) + cli.add_option( '--xcode-driver', default='bootstrap', action='store', help=optparse.SUPPRESS_HELP ) cli.add_option( '--force', default=False, action='store_true', help='overwrite existing build config' ) cli.add_option( '--verbose', default=False, action='store_true', help='increase verbosity' ) ## add install options grp = OptionGroup( cli, 'Directory Locations' ) - h = IfHost( 'specify sysroot (e.g. for Leopard builds from Snow Leapard)', '*-*-darwin*', none=optparse.SUPPRESS_HELP ).value + h = IfHost( 'specify sysroot of SDK for Xcode builds', '*-*-darwin*', none=optparse.SUPPRESS_HELP ).value grp.add_option( '--sysroot', default=None, action='store', metavar='DIR', help=h ) grp.add_option( '--src', default=cfg.src_dir, action='store', metavar='DIR', @@ -1064,9 +1084,6 @@ def createCLI(): h = IfHost( 'enable use of ffmpeg mpeg2 decoding', '*-*-*', none=optparse.SUPPRESS_HELP ).value grp.add_option( '--enable-ff-mpeg2', default=False, action='store_true', help=h ) - h = IfHost( 'disable Xcode', '*-*-darwin*', none=optparse.SUPPRESS_HELP ).value - grp.add_option( '--disable-xcode', default=False, action='store_true', help=h ) - cli.add_option_group( grp ) ## add launch options @@ -1088,7 +1105,7 @@ def createCLI(): arch.mode.cli_add_option( grp, '--arch' ) grp.add_option( '--cross', default=None, action='store', metavar='SPEC', help='specify GCC cross-compilation spec' ) - h = IfHost( 'Min OS X Version', '*-*-darwin*', none=optparse.SUPPRESS_HELP ).value + h = IfHost( 'specify Mac OS X deployment target for Xcode builds', '*-*-darwin*', none=optparse.SUPPRESS_HELP ).value grp.add_option( '--minver', default=None, action='store', metavar='VER', help=h ) @@ -1097,6 +1114,16 @@ def createCLI(): cli.add_option_group( grp ) + ## add Xcode options + if host.match( '*-*-darwin*' ): + grp = OptionGroup( cli, 'Xcode Options' ) + grp.add_option( '--disable-xcode', default=False, action='store_true', + help='disable Xcode' ) + grp.add_option( '--xcode-symroot', default='xroot', action='store', metavar='DIR', + help='specify root of the directory hierarchy that contains product files and intermediate build files' ) + xcconfigMode.cli_add_option( grp, '--xcode-config' ) + cli.add_option_group( grp ) + ## add tool locations grp = OptionGroup( cli, 'Tool Basenames and Locations' ) for tool in ToolProbe.tools: @@ -1266,6 +1293,19 @@ try: debugMode = SelectMode( 'debug', ('none','none'), ('min','min'), ('std','std'), ('max','max') ) optimizeMode = SelectMode( 'optimize', ('none','none'), ('speed','speed'), ('size','size'), default='speed' ) + ## find xcconfig values + xcconfigMode = SelectMode( 'xcconfig', ('none',None), what='' ) + if host.match( '*-*-darwin*' ): + for xc in glob.glob( os.path.join(cfg.dir, '../macosx/xcconfig/*.xcconfig') ): + bname = os.path.basename( xc ) + xname = os.path.splitext( bname ) + if xname and xname[0]: + xcconfigMode[xname[0]] = bname + if not 'native' in xcconfigMode: + raise Exception( 'native xcconfig not found' ) + xcconfigMode.default = 'native' + xcconfigMode.mode = xcconfigMode.default + ## create CLI and parse cli = createCLI() (options,args) = cli.parse_args() @@ -1294,6 +1334,10 @@ try: for action in Action.actions: action.run() + ## enable local yasm when yasm probe fails + if Tools.yasm.fail and not options.enable_local_yasm: + options.enable_local_yasm = True + if build.system == 'mingw': dlfcn_test = """ #include <dlfcn.h> @@ -1437,20 +1481,16 @@ int main () doc.add( 'BUILD.ncpu', core.count ) doc.add( 'BUILD.jobs', core.jobs ) - doc.add( 'BUILD.cross', int(options.cross != None or arch.mode.mode != arch.mode.default) ) + doc.add( 'BUILD.cross', int(options.cross != None or arch.mode.mode != arch.mode.default) ) if options.cross: doc.add( 'BUILD.cross.prefix', '%s-' % (options.cross) ) else: doc.add( 'BUILD.cross.prefix', '' ) - doc.add( 'BUILD.method', 'terminal' ) doc.add( 'BUILD.date', time.strftime('%c') ) doc.add( 'BUILD.arch', arch.mode.mode ) doc.addBlank() - doc.add( 'CONF.method', options.conf_method ) - - doc.addBlank() doc.add( 'SRC', cfg.src_final ) doc.add( 'SRC/', cfg.src_final + os.sep ) doc.add( 'BUILD', cfg.build_final ) @@ -1460,22 +1500,25 @@ int main () doc.addBlank() doc.add( 'FEATURE.local_yasm', int( options.enable_local_yasm ) ) - doc.add( 'FEATURE.asm', 'disabled' ) - doc.add( 'FEATURE.gtk', int( not options.disable_gtk )) - doc.add( 'FEATURE.gtk.update.checks', int( not options.disable_gtk_update_checks )) - doc.add( 'FEATURE.gtk.mingw', int( options.enable_gtk_mingw )) - doc.add( 'FEATURE.gst', int( not options.disable_gst )) + doc.add( 'FEATURE.asm', 'disabled' ) + doc.add( 'FEATURE.gtk', int( not options.disable_gtk )) + doc.add( 'FEATURE.gtk.update.checks', int( not options.disable_gtk_update_checks )) + doc.add( 'FEATURE.gtk.mingw', int( options.enable_gtk_mingw )) + doc.add( 'FEATURE.gst', int( not options.disable_gst )) doc.add( 'FEATURE.ff.mpeg2', int( options.enable_ff_mpeg2 )) - doc.add( 'FEATURE.xcode', int( not (Tools.xcodebuild.fail or options.disable_xcode or options.cross) )) + doc.add( 'FEATURE.xcode', int( not (Tools.xcodebuild.fail or options.disable_xcode or options.cross) )) if not Tools.xcodebuild.fail and not options.disable_xcode: doc.addBlank() - doc.add( 'XCODE.external.src', cfg.xcode_x_src ) - doc.add( 'XCODE.external.build', cfg.xcode_x_build ) - doc.add( 'XCODE.external.prefix', cfg.xcode_x_prefix ) + doc.add( 'XCODE.driver', options.xcode_driver ) + if os.path.isabs(options.xcode_symroot): + doc.add( 'XCODE.symroot', options.xcode_symroot ) + else: + doc.add( 'XCODE.symroot', os.path.abspath(os.path.join(cfg.build_dir,options.xcode_symroot)) ) + doc.add( 'XCODE.xcconfig', xcconfigMode[xcconfigMode.mode] ) - doc.addBlank() if build.system == 'mingw': + doc.addBlank() if not dlfcn.fail: doc.add( 'HAS.dlfcn', 1 ) if not pthread.fail: @@ -1513,8 +1556,6 @@ int main () doc.add( 'GCC.archs', '' ) doc.add( 'GCC.sysroot', '' ) doc.add( 'GCC.minver', '' ) - doc.add( 'GCC.ldsysroot', '$(GCC.sysroot)' ) - doc.add( 'GCC.ldminver', '$(GCC.minver)' ) if options.enable_asm and ( not Tools.yasm.fail or options.enable_local_yasm ): asm = '' |