X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=make%2Fconfigure.py;h=1b140739b91213fde0ae343ffee73f7ba5fd193c;hb=44946a6f8be82a70e65ca534541183a26fdb804b;hp=26a1dc118af852fe3d92524e3ae755d08ce199d8;hpb=faf21aea1b410fbb0a1965a36c2d805c129eca9f;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/make/configure.py b/make/configure.py index 26a1dc11..1b140739 100644 --- a/make/configure.py +++ b/make/configure.py @@ -315,7 +315,7 @@ class ShellProbe( Action ): ## x86_64-unknown-linux-gnu (Linux, Fedora 10 x86_64) ## class HostTupleProbe( ShellProbe, list ): - GNU_TUPLE_RX = '([^-]+)-([^-]+)-([^0-9-]+)([^-]*)-?([^-]*)' + GNU_TUPLE_RE = '([^-]+)-?([^-]*)-([^0-9-]+)([^-]*)-?([^-]*)' def __init__( self ): super( HostTupleProbe, self ).__init__( 'host tuple', '%s/config.guess' % (cfg.dir), abort=True, head=True ) @@ -327,7 +327,7 @@ class HostTupleProbe( ShellProbe, list ): self.spec = '' ## grok GNU host tuples - m = re.match( HostTupleProbe.GNU_TUPLE_RX, self.spec ) + m = re.match( HostTupleProbe.GNU_TUPLE_RE, self.spec ) if not m: self.fail = True self.msg_end = 'invalid host tuple: %s' % (self.spec) @@ -365,10 +365,14 @@ class BuildAction( Action, list ): super( BuildAction, self ).__init__( 'compute', 'build tuple', abort=True ) def _action( self ): - self.spec = arch.mode[arch.mode.mode] + ## check if --cross spec was used; must maintain 5-tuple compatibility with regex + if options.cross: + self.spec = os.path.basename( options.cross ).rstrip( '-' ) + else: + self.spec = arch.mode[arch.mode.mode] ## grok GNU host tuples - m = re.match( HostTupleProbe.GNU_TUPLE_RX, self.spec ) + m = re.match( HostTupleProbe.GNU_TUPLE_RE, self.spec ) if not m: self.msg_end = 'invalid host tuple: %s' % (self.spec) return @@ -386,6 +390,15 @@ class BuildAction( Action, list ): self.extra = self[4] self.systemf = host.systemf + ## when cross we need switch for platforms + if options.cross: + if self.match( '*mingw*' ): + self.systemf = 'MinGW' + elif self.systemf: + self.systemf[0] = self.systemf[0].upper() + self.title = '%s %s' % (build.systemf,self.machine) + else: + self.title = '%s %s' % (build.systemf,arch.mode.mode) self.fail = False ## glob-match against spec @@ -641,23 +654,33 @@ class Project( Action ): self.vpoint = 4 def _action( self ): - appcastfmt = 'http://handbrake.fr/appcast%s.xml' + ## add architecture to URL only for Mac + if fnmatch.fnmatch( build.spec, '*-*-darwin*' ): + url_arch = '.%s' % (arch.mode.mode) + else: + url_arch = '' if repo.type == 'release': self.version = '%d.%d.%d' % (self.vmajor,self.vminor,self.vpoint) - self.url_appcast = appcastfmt % ('') + url_ctype = '' + url_ntype = 'stable' self.build = time.strftime('%Y%m%d') + '00' self.title = '%s %s (%s)' % (self.name,self.version,self.build) elif repo.type == 'developer': self.version = 'svn%d' % (repo.rev) - self.url_appcast = appcastfmt % ('_unstable') + url_ctype = '_unstable' + url_ntype = 'unstable' self.build = time.strftime('%Y%m%d') + '01' self.title = '%s svn%d (%s)' % (self.name,repo.rev,self.build) else: - self.version = 'svn%d' % (repo.rev) - self.url_appcast = appcastfmt % ('_unofficial') + self.version = 'rev%d' % (repo.rev) + url_ctype = '_unofficial' + url_ntype = 'unofficial' self.build = time.strftime('%Y%m%d') + '99' - self.title = 'Unofficial svn%d (%s)' % (repo.rev,self.build) + self.title = '%s rev%d (%s)' % (self.name,repo.rev,self.build) + + self.url_appcast = 'http://handbrake.fr/appcast%s%s.xml' % (url_ctype,url_arch) + self.url_appnote = 'http://handbrake.fr/appcast/%s.html' % (url_ntype) self.msg_end = '%s (%s)' % (self.name,repo.type) self.fail = False @@ -783,9 +806,15 @@ class ConfigDocument: def _outputMake( self, file, namelen, name, value, append ): if append: - file.write( '%-*s += %s\n' % (namelen, name, value )) + if value == None or len(str(value)) == 0: + file.write( '%-*s +=\n' % (namelen, name) ) + else: + file.write( '%-*s += %s\n' % (namelen, name, value) ) else: - file.write( '%-*s = %s\n' % (namelen, name, value )) + if value == None or len(str(value)) == 0: + file.write( '%-*s =\n' % (namelen, name) ) + else: + file.write( '%-*s = %s\n' % (namelen, name, value) ) def _outputM4( self, file, namelen, name, value ): namelen += 7 @@ -930,6 +959,8 @@ def createCLI(): h = IfHost( 'disable GTK GUI', '*-*-linux*', none=optparse.SUPPRESS_HELP ).value grp.add_option( '--disable-gtk', default=False, action='store_true', help=h ) + h = IfHost( 'enable GTK GUI (mingw)', '*-*-mingw*', none=optparse.SUPPRESS_HELP ).value + grp.add_option( '--enable-gtk-mingw', 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 ) @@ -953,6 +984,8 @@ def createCLI(): debugMode.cli_add_option( grp, '--debug' ) optimizeMode.cli_add_option( grp, '--optimize' ) arch.mode.cli_add_option( grp, '--arch' ) + grp.add_option( '--cross', default=None, action='store', metavar='SPEC', + help='specify GCC cross-compilation spec' ) cli.add_option_group( grp ) ## add tool locations @@ -1100,13 +1133,15 @@ try: else: gmake = ToolProbe( 'GMAKE.exe', 'gmake', 'make' ) - m4 = ToolProbe( 'M4.exe', 'm4' ) - mkdir = ToolProbe( 'MKDIR.exe', 'mkdir' ) - patch = ToolProbe( 'PATCH.exe', 'gpatch', 'patch' ) - rm = ToolProbe( 'RM.exe', 'rm' ) - tar = ToolProbe( 'TAR.exe', 'gtar', 'tar' ) - wget = ToolProbe( 'WGET.exe', 'wget', abort=False ) - yasm = ToolProbe( 'YASM.exe', 'yasm', abort=False ) + m4 = ToolProbe( 'M4.exe', 'm4' ) + mkdir = ToolProbe( 'MKDIR.exe', 'mkdir' ) + patch = ToolProbe( 'PATCH.exe', 'gpatch', 'patch' ) + rm = ToolProbe( 'RM.exe', 'rm' ) + ranlib = ToolProbe( 'RANLIB.exe', 'ranlib' ) + strip = ToolProbe( 'STRIP.exe', 'strip' ) + tar = ToolProbe( 'TAR.exe', 'gtar', 'tar' ) + wget = ToolProbe( 'WGET.exe', 'wget', abort=False ) + yasm = ToolProbe( 'YASM.exe', 'yasm', abort=False ) xcodebuild = ToolProbe( 'XCODEBUILD.exe', 'xcodebuild', abort=False ) lipo = ToolProbe( 'LIPO.exe', 'lipo', abort=False ) @@ -1140,6 +1175,12 @@ try: else: targets.append( arg ) + ## re-run tools with cross-compilation needs + if options.cross: + for tool in ( Tools.ar, Tools.gcc, Tools.ranlib, Tools.strip ): + tool.__init__( tool.var, '%s-%s' % (options.cross,tool.name), **tool.kwargs ) + tool.run() + ## run delayed actions for action in Action.actions: action.run() @@ -1159,17 +1200,18 @@ try: doc.add( 'CONF.args', ' '.join( args )) doc.addBlank() - doc.add( 'HB.title', project.title ) - doc.add( 'HB.name', project.name ) - doc.add( 'HB.name.lower', project.name_lower ) - doc.add( 'HB.name.upper', project.name_upper ) - doc.add( 'HB.acro.lower', project.acro_lower ) - doc.add( 'HB.acro.upper', project.acro_upper ) - - doc.add( 'HB.url.website', project.url_website ) - doc.add( 'HB.url.community', project.url_community ) - doc.add( 'HB.url.irc', project.url_irc ) - doc.add( 'HB.url.appcast', project.url_appcast ) + doc.add( 'HB.title', project.title ) + doc.add( 'HB.name', project.name ) + doc.add( 'HB.name.lower', project.name_lower ) + doc.add( 'HB.name.upper', project.name_upper ) + doc.add( 'HB.acro.lower', project.acro_lower ) + doc.add( 'HB.acro.upper', project.acro_upper ) + + doc.add( 'HB.url.website', project.url_website ) + doc.add( 'HB.url.community', project.url_community ) + doc.add( 'HB.url.irc', project.url_irc ) + doc.add( 'HB.url.appcast', project.url_appcast ) + doc.add( 'HB.url.appnote', project.url_appnote ) doc.add( 'HB.version.major', project.vmajor ) doc.add( 'HB.version.minor', project.vminor ) @@ -1207,14 +1249,19 @@ try: doc.add( 'BUILD.systemf', build.systemf ) doc.add( 'BUILD.release', build.release ) doc.add( 'BUILD.extra', build.extra ) - doc.add( 'BUILD.title', '%s %s' % (build.systemf,arch.mode.mode) ) + doc.add( 'BUILD.title', build.title ) doc.add( 'BUILD.ncpu', core.count ) doc.add( 'BUILD.jobs', core.jobs ) - doc.add( 'BUILD.cross', int(arch.mode.mode != arch.mode.default) ) - doc.add( 'BUILD.method', 'terminal' ) - doc.add( 'BUILD.date', time.strftime('%c') ) - doc.add( 'BUILD.arch', arch.mode.mode ) + 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 ) @@ -1230,7 +1277,8 @@ try: doc.addBlank() doc.add( 'FEATURE.asm', 'disabled' ) doc.add( 'FEATURE.gtk', int( not options.disable_gtk )) - doc.add( 'FEATURE.xcode', int( not (Tools.xcodebuild.fail or options.disable_xcode) )) + doc.add( 'FEATURE.gtk.mingw', int( options.enable_gtk_mingw )) + 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()