X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=make%2Fconfigure.py;h=6702ee28d4bd40a797b6c8c9c00be3fc89a926c4;hb=4b72a63eb61a01275493c4bfb51ba02152d1c5e1;hp=b6705d726e1d2e848a2a3ec878e9ae4e52e3f921;hpb=5e7277684b930762d687444feb915466d7fea2cf;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/make/configure.py b/make/configure.py index b6705d72..6702ee28 100644 --- a/make/configure.py +++ b/make/configure.py @@ -199,6 +199,15 @@ class Configure( object ): self.src_dir = os.path.normpath( options.src ) self.build_dir = os.path.normpath( options.build ) self.prefix_dir = os.path.normpath( options.prefix ) + if options.sysroot != None: + self.sysroot_dir = os.path.normpath( options.sysroot ) + else: + self.sysroot_dir = "" + + if options.minver != None: + self.minver = options.minver + else: + self.minver = "" ## special case if src == build: add build subdir if os.path.abspath( self.src_dir ) == os.path.abspath( self.build_dir ): @@ -305,6 +314,90 @@ class ShellProbe( Action ): ############################################################################### ## +## Compile test probe: determine if compile time feature is supported +## +## returns true if feature successfully compiles +## +## +class CCProbe( Action ): + def __init__( self, pretext, command, test_file ): + super( CCProbe, self ).__init__( 'probe', pretext ) + self.command = command + self.test_file = test_file + + def _action( self ): + ## write program file + file = open( 'conftest.c', 'w' ) + file.write( self.test_file ) + file.close() + ## pipe and redirect stderr to stdout; effects communicate result + pipe = subprocess.Popen( '%s -c -o conftest.o conftest.c' % self.command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT ) + + ## read data into memory buffers, only first element (stdout) data is used + data = pipe.communicate() + self.fail = pipe.returncode != 0 + + if data[0]: + self.session = data[0].splitlines() + else: + self.session = [] + + if pipe.returncode: + self.msg_end = 'code %d' % (pipe.returncode) + os.remove( 'conftest.c' ) + if not self.fail: + os.remove( 'conftest.o' ) + + def _dumpSession( self, printf ): + printf( ' + %s\n', self.command ) + super( CCProbe, self )._dumpSession( printf ) + + +############################################################################### +## +## Compile test probe: determine if compile time feature is supported +## +## returns true if feature successfully compiles +## +## +class LDProbe( Action ): + def __init__( self, pretext, command, lib, test_file ): + super( LDProbe, self ).__init__( 'probe', pretext ) + self.command = command + self.test_file = test_file + self.lib = lib + + def _action( self ): + ## write program file + file = open( 'conftest.c', 'w' ) + file.write( self.test_file ) + file.close() + ## pipe and redirect stderr to stdout; effects communicate result + pipe = subprocess.Popen( '%s -o conftest conftest.c %s' % (self.command, self.lib), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT ) + + ## read data into memory buffers, only first element (stdout) data is used + data = pipe.communicate() + self.fail = pipe.returncode != 0 + + if data[0]: + self.session = data[0].splitlines() + else: + self.session = [] + + if pipe.returncode: + self.msg_end = 'code %d' % (pipe.returncode) + + os.remove( 'conftest.c' ) + if not self.fail: + os.remove( 'conftest' ) + + def _dumpSession( self, printf ): + printf( ' + %s\n', self.command ) + super( LDProbe, self )._dumpSession( printf ) + + +############################################################################### +## ## GNU host tuple probe: determine canonical platform type ## ## example results from various platforms: @@ -621,7 +714,7 @@ class RepoProbe( ShellProbe ): if self.uuid == 'b64f7644-9d1e-0410-96f1-a4d463321fa5': self.official = 1 m = re.match( '([^:]+)://([^/]+)/(.+)', self.url ) - if m and re.match( 'tags/', m.group( 3 )): + if m and re.match( '.*tags/.*', m.group( 3 )): self.type = 'release' else: self.type = 'developer' @@ -651,7 +744,7 @@ class Project( Action ): self.vmajor = 0 self.vminor = 9 - self.vpoint = 4 + self.vpoint = 5 def _action( self ): ## add architecture to URL only for Mac @@ -673,11 +766,11 @@ class Project( Action ): 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.version = 'rev%d' % (repo.rev) url_ctype = '_unofficial' url_ntype = 'unofficial' self.build = time.strftime('%Y%m%d') + '99' - self.title = '%s svn%d (%s)' % (self.name,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) @@ -943,6 +1036,9 @@ def createCLI(): ## 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 + grp.add_option( '--sysroot', default=None, action='store', metavar='DIR', + help=h ) grp.add_option( '--src', default=cfg.src_dir, action='store', metavar='DIR', help='specify top-level source dir [%s]' % (cfg.src_dir) ) grp.add_option( '--build', default=cfg.build_dir, action='store', metavar='DIR', @@ -959,6 +1055,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( 'disable GTK GUI update checks', '*-*-linux*', none=optparse.SUPPRESS_HELP ).value + grp.add_option( '--disable-gtk-update-checks', 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 ) @@ -986,6 +1084,9 @@ 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 + grp.add_option( '--minver', default=None, action='store', metavar='VER', + help=h ) cli.add_option_group( grp ) ## add tool locations @@ -1185,6 +1286,81 @@ try: for action in Action.actions: action.run() + if build.system == 'mingw': + dlfcn_test = """ +#include +#include + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, RTLD_GLOBAL|RTLD_NOW); + int status = 1; + + if (self) + { + if (dlsym (self,"fnord")) status = 0; + else if (dlsym( self,"_fnord")) status = 0; + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +""" + dlfcn = LDProbe( 'static dlfcn', '%s -static' % Tools.gcc.pathname, '-ldl', dlfcn_test ) + dlfcn.run() + + pthread_test = """ +#include +#include +int main () +{ + pthread_t thread; + pthread_create (&thread, NULL, NULL, NULL); + return 0; +} +""" + pthread = LDProbe( 'static pthread', '%s -static' % Tools.gcc.pathname, '-lpthreadGC2', pthread_test ) + pthread.run() + + bz2_test = """ +#include +#include +int main () +{ + BZ2_bzReadOpen(NULL, NULL, 0, 0, NULL, 0); + return 0; +} +""" + bz2 = LDProbe( 'static bz2', '%s -static' % Tools.gcc.pathname, '-lbz2', bz2_test ) + bz2.run() + + libz_test = """ +#include +#include +int main () +{ + compress(NULL, NULL, NULL, 0); + return 0; +} +""" + libz = LDProbe( 'static zlib', '%s -static' % Tools.gcc.pathname, '-lz', libz_test ) + libz.run() + + iconv_test = """ +#include +#include +int main () +{ + iconv_open(NULL, NULL); + return 0; +} +""" + iconv = LDProbe( 'static iconv', '%s -static' % Tools.gcc.pathname, '-liconv', iconv_test ) + iconv.run() + ## cfg hook before doc prep cfg.doc_ready() @@ -1277,6 +1453,7 @@ try: doc.addBlank() 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.xcode', int( not (Tools.xcodebuild.fail or options.disable_xcode or options.cross) )) @@ -1286,7 +1463,24 @@ try: doc.add( 'XCODE.external.build', cfg.xcode_x_build ) doc.add( 'XCODE.external.prefix', cfg.xcode_x_prefix ) + doc.addBlank() + if build.system == 'mingw': + if not dlfcn.fail: + doc.add( 'HAS.dlfcn', 1 ) + if not pthread.fail: + doc.add( 'HAS.pthread', 1 ) + if not bz2.fail: + doc.add( 'HAS.bz2', 1 ) + if not libz.fail: + doc.add( 'HAS.libz', 1 ) + if not iconv.fail: + doc.add( 'HAS.iconv', 1 ) + doc.addMake( '' ) + doc.addMake( '## define debug mode before other includes' ) + doc.addMake( '## since it is tested in some module.defs' ) + doc.add( 'GCC.g', debugMode.mode ) + doc.addBlank() doc.addMake( '## include definitions' ) doc.addMake( 'include $(SRC/)make/include/main.defs' ) @@ -1299,11 +1493,16 @@ try: select.doc_add( doc ) doc.addBlank() - if arch.mode.mode != arch.mode.default: + if build.match( '*-*-darwin*' ): doc.add( 'GCC.archs', arch.mode.mode ) + doc.add( 'GCC.sysroot', cfg.sysroot_dir ) + doc.add( 'GCC.minver', cfg.minver ) else: doc.add( 'GCC.archs', '' ) - doc.add( 'GCC.g', debugMode.mode ) + doc.add( 'GCC.sysroot', '' ) + doc.add( 'GCC.minver', '' ) + doc.add( 'GCC.ldsysroot', '$(GCC.sysroot)' ) + doc.add( 'GCC.ldminver', '$(GCC.minver)' ) doc.add( 'GCC.O', optimizeMode.mode ) if options.enable_asm and not Tools.yasm.fail: