From: jstebbins Date: Fri, 4 Sep 2009 21:22:41 +0000 (+0000) Subject: build system: add capability to build Leopard target from Snow Leopard Host X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=b3cc33cfefb44ec9ac18b19464d61f3cbd584162;p=handbrake-jp%2Fhandbrake-jp-git.git build system: add capability to build Leopard target from Snow Leopard Host To configure for building Leopard target from Snow Leopard: configure --sysroot /Developer/SDKs/MacOSX10.5.sdk --minver 10.5 git-svn-id: svn://localhost/HandBrake/trunk@2806 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- diff --git a/contrib/bzip2/module.defs b/contrib/bzip2/module.defs index 76eacbe9..8cb6d7ef 100644 --- a/contrib/bzip2/module.defs +++ b/contrib/bzip2/module.defs @@ -7,7 +7,7 @@ BZIP2.CONFIGURE = $(TOUCH.exe) $@ BZIP2.BUILD.extra = \ CC=$(BZIP2.GCC.gcc) \ - CFLAGS="$(call fn.ARGS,BZIP2.GCC,*archs)" \ + CFLAGS="$(call fn.ARGS,BZIP2.GCC,*archs *sysroot *minver)" \ RANLIB="$(RANLIB.exe)" PREFIX=$(call fn.ABSOLUTE,$(CONTRIB.build/)) diff --git a/contrib/ffmpeg/module.defs b/contrib/ffmpeg/module.defs index 2f6e633d..2f36ee99 100644 --- a/contrib/ffmpeg/module.defs +++ b/contrib/ffmpeg/module.defs @@ -23,8 +23,8 @@ FFMPEG.CONFIGURE.extra = \ --enable-muxer=ipod \ --enable-zlib \ --cc="$(FFMPEG.GCC.gcc)" \ - --extra-cflags="$(call fn.ARGS,FFMPEG.GCC,*archs ?extra) -I$(call fn.ABSOLUTE,$(CONTRIB.build/)include)" \ - --extra-ldflags="$(call fn.ARGS,FFMPEG.GCC,*archs ?extra) -L$(call fn.ABSOLUTE,$(CONTRIB.build/)lib)" + --extra-cflags="$(call fn.ARGS,FFMPEG.GCC,*archs *sysroot *minver ?extra) -I$(call fn.ABSOLUTE,$(CONTRIB.build/)include)" \ + --extra-ldflags="$(call fn.ARGS,FFMPEG.GCC,*archs *sysroot *minver ?extra) -L$(call fn.ABSOLUTE,$(CONTRIB.build/)lib)" ## check against tuple: B-SYSTEM where B is { 0 | 1 } for cross-compiling flag ifeq (0-cygwin,$(BUILD.cross)-$(BUILD.system)) diff --git a/contrib/mp4v2/module.defs b/contrib/mp4v2/module.defs index aa521950..c27f3470 100644 --- a/contrib/mp4v2/module.defs +++ b/contrib/mp4v2/module.defs @@ -4,8 +4,8 @@ $(eval $(call import.CONTRIB.defs,MP4V2)) MP4V2.FETCH.url = http://download.m0k.org/handbrake/contrib/mp4v2-trunk-r355.tar.bz2 ## propagate more flags -MP4V2.CONFIGURE.env.CFLAGS = CFLAGS="$(call fn.ARGS,MP4V2.GCC,*archs *D .g .O)" -MP4V2.CONFIGURE.env.CXXFLAGS = CXXFLAGS="$(call fn.ARGS,MP4V2.GCC,*archs *D .g .O)" +MP4V2.CONFIGURE.env.CFLAGS = CFLAGS="$(call fn.ARGS,MP4V2.GCC,*archs *sysroot *minver *D .g .O)" +MP4V2.CONFIGURE.env.CXXFLAGS = CXXFLAGS="$(call fn.ARGS,MP4V2.GCC,*archs *sysroot *minver *D .g .O)" ## save some build-time by disabling utils MP4V2.CONFIGURE.extra += --disable-util diff --git a/contrib/x264/module.defs b/contrib/x264/module.defs index cc6e1aca..382bff46 100644 --- a/contrib/x264/module.defs +++ b/contrib/x264/module.defs @@ -12,8 +12,8 @@ X264.CONFIGURE.extra = --disable-mp4-output ifeq (1-mingw,$(BUILD.cross)-$(BUILD.system)) X264.CONFIGURE.extra += --enable-pthread --cross-prefix=$(BUILD.spec)- - X264.CONFIGURE.env.CFLAGS = CFLAGS="-I$(call fn.ABSOLUTE,$(CONTRIB.build/)include) $(call fn.ARGS,X264.GCC,*archs ?extra)" - X264.CONFIGURE.env.LDFLAGS = LDFLAGS=-L$(call fn.ABSOLUTE,$(CONTRIB.build/)lib) + X264.CONFIGURE.env.CFLAGS = CFLAGS="-I$(call fn.ABSOLUTE,$(CONTRIB.build/)include) $(call fn.ARGS,X264.GCC,*archs *sysroot *minver ?extra)" + X264.CONFIGURE.env.LDFLAGS = LDFLAGS="-L$(call fn.ABSOLUTE,$(CONTRIB.build/)lib) $(call fn.ARGS,X264.GCC,*archs *sysroot *minver)" else X264.CONFIGURE.extra += --enable-pthread endif diff --git a/macosx/module.defs b/macosx/module.defs index 4b9329f0..725fdfc3 100644 --- a/macosx/module.defs +++ b/macosx/module.defs @@ -39,11 +39,13 @@ MACOSX.XCODE.project = HandBrake.xcodeproj ## $(1) = list of targets ## $(2) = list of goals to shunt thru xcodebuild->make ## +XCODE.sysroot = $(foreach sdk,$(GCC.sysroot),-sdk $(sdk)) MACOSX.XCODE = $(strip \ cd $(MACOSX.src/) && \ $(MACOSX.XCODE.exe) \ -project $(MACOSX.XCODE.project) \ -configuration $(MACOSX.conf) \ + $(XCODE.sysroot) \ $(foreach t,$(1),-target $t) \ EXTERNAL_SRC='$(XCODE.external.src)' \ EXTERNAL_BUILD='$(XCODE.external.build)' \ diff --git a/make/configure.py b/make/configure.py index 4b98b9bf..9580bfbb 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 ): @@ -943,6 +952,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', @@ -986,6 +998,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 @@ -1301,8 +1316,14 @@ try: doc.addBlank() 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.sysroot', '' ) + doc.add( 'GCC.minver', '' ) + doc.add( 'GCC.ldsysroot', '$(GCC.sysroot)' ) + doc.add( 'GCC.ldminver', '$(GCC.minver)' ) doc.add( 'GCC.g', debugMode.mode ) doc.add( 'GCC.O', optimizeMode.mode ) diff --git a/make/include/contrib.defs b/make/include/contrib.defs index 2b7d6223..fcff2735 100644 --- a/make/include/contrib.defs +++ b/make/include/contrib.defs @@ -83,11 +83,11 @@ define import.CONTRIB.defs $(1).CONFIGURE.args = !sete @dir !bootstrap !env !exe @host @prefix !deps !shared !static !extra $(1).CONFIGURE.env.CC = CC=$$($(1).GCC.gcc) - $(1).CONFIGURE.env.CFLAGS = CFLAGS="$$(call fn.ARGS,$(1).GCC,*archs ?extra)" + $(1).CONFIGURE.env.CFLAGS = CFLAGS="$$(call fn.ARGS,$(1).GCC,*archs *sysroot *minver ?extra)" $(1).CONFIGURE.env.CXX = CXX=$$($(1).GCC.gxx) - $(1).CONFIGURE.env.CXXFLAGS = CXXFLAGS="$$(call fn.ARGS,$(1).GCC,*archs ?extra)" - $(1).CONFIGURE.env.CPPFLAGS = CPPFLAGS="$$(call fn.ARGS,$(1).GCC,*archs ?extra)" - $(1).CONFIGURE.env.LDFLAGS = LDFLAGS="$$(call fn.ARGS,$(1).GCC,*archs)" + $(1).CONFIGURE.env.CXXFLAGS = CXXFLAGS="$$(call fn.ARGS,$(1).GCC,*archs *sysroot *minver ?extra)" + $(1).CONFIGURE.env.CPPFLAGS = CPPFLAGS="$$(call fn.ARGS,$(1).GCC,*archs *sysroot *minver ?extra)" + $(1).CONFIGURE.env.LDFLAGS = LDFLAGS="$$(call fn.ARGS,$(1).GCC,*archs *sysroot *minver)" $(1).CONFIGURE.env.args = !CC !CFLAGS !CXX !CXXFLAGS !CPPFLAGS !LDFLAGS $(1).CONFIGURE.env = $$(call fn.ARGS,$(1).CONFIGURE.env,$$($(1).CONFIGURE.env.args)) diff --git a/make/include/gcc.defs b/make/include/gcc.defs index f9511d1b..a9523ddd 100644 --- a/make/include/gcc.defs +++ b/make/include/gcc.defs @@ -8,6 +8,10 @@ GCC.ML = 1 GCC.H = 0 GCC.W = all GCC.archs = +GCC.sysroot = +GCC.ldsysroot = +GCC.minver = +GCC.ldminver= GCC.vis = 0 GCC.pic = 0 GCC.g = none @@ -40,6 +44,10 @@ GCC.args.ML = -fmessage-length=0 GCC.args.H = -H GCC.args.W = -W$(1) GCC.args.archs = -arch $(1) +GCC.args.sysroot = --sysroot=$(1) +GCC.args.ldsysroot = -syslibroot $(1) +GCC.args.minver = -mmacosx-version-min=$(1) +GCC.args.ldminver = -macosx_version_min $(1) GCC.args.vis = -fvisibility=hidden GCC.args.pic = -fPIC GCC.args.g.none = -g0 @@ -82,6 +90,10 @@ define import.GCC $(1).GCC.H = $$(GCC.H) $(1).GCC.W = $$(GCC.W) $(1).GCC.archs = $$(GCC.archs) + $(1).GCC.sysroot = $$(GCC.sysroot) + $(1).GCC.ldsysroot = $$(GCC.ldsysroot) + $(1).GCC.minver = $$(GCC.minver) + $(1).GCC.ldminver = $$(GCC.ldminver) $(1).GCC.vis = $$(GCC.vis) $(1).GCC.pic = $$(GCC.pic) $(1).GCC.g = $$(GCC.g) @@ -114,6 +126,10 @@ define import.GCC $(1).GCC.args.H = $$(GCC.args.H) $(1).GCC.args.W = $$(GCC.args.W) $(1).GCC.args.archs = $$(GCC.args.archs) + $(1).GCC.args.sysroot = $$(GCC.args.sysroot) + $(1).GCC.args.ldsysroot = $$(GCC.args.ldsysroot) + $(1).GCC.args.minver = $$(GCC.args.minver) + $(1).GCC.args.ldminver = $$(GCC.args.ldminver) $(1).GCC.args.vis = $$(GCC.args.vis) $(1).GCC.args.pic = $$(GCC.args.pic) $(1).GCC.args.g.none = $$(GCC.args.g.none) @@ -149,19 +165,19 @@ define import.GCC $(1).GCC.o = -o $$(3) # FUNCTION: C precompiled headers - $(1).GCC.H_O.args = !gcc ?pipe ?ML ?H *W *archs ?vis ?pic .g .O ?extra ?extra.h_o *D *I !c !o + $(1).GCC.H_O.args = !gcc ?pipe ?ML ?H *W *archs *sysroot *minver ?vis ?pic .g .O ?extra ?extra.h_o *D *I !c !o $(1).GCC.H_O = $$(call fn.ARGS,$(1).GCC,$$($(1).GCC.H_O.args),$$(1),$$(2)) # FUNCTION: C compile source - $(1).GCC.C_O.args = !gcc ?pipe ?ML ?H *W *archs ?vis ?pic .g .O ?extra ?extra.c_o *D *I !c !o + $(1).GCC.C_O.args = !gcc ?pipe ?ML ?H *W *archs *sysroot *minver ?vis ?pic .g .O ?extra ?extra.c_o *D *I !c !o $(1).GCC.C_O = $$(call fn.ARGS,$(1).GCC,$$($(1).GCC.C_O.args),$$(1),$$(2)) # FUNCTION: C++ precompile headers - $(1).GCC.HPP_O.args = !gxx ?pipe ?ML ?H *W *archs ?vis ?pic .g .O ?extra ?extra.hpp_o *D *I !c !o + $(1).GCC.HPP_O.args = !gxx ?pipe ?ML ?H *W *archs *sysroot *minver ?vis ?pic .g .O ?extra ?extra.hpp_o *D *I !c !o $(1).GCC.HPP_O = $$(call fn.ARGS,$(1).GCC,$$($(1).GCC.HPP_O.args),$$(1),$$(2)) # FUNCTION: C++ compile source - $(1).GCC.CPP_O.args = !gxx ?pipe ?ML ?H *W *archs ?vis ?pic .g .O ?extra ?extra.cpp_o *D *I !c !o + $(1).GCC.CPP_O.args = !gxx ?pipe ?ML ?H *W *archs *sysroot *minver ?vis ?pic .g .O ?extra ?extra.cpp_o *D *I !c !o $(1).GCC.CPP_O = $$(call fn.ARGS,$(1).GCC,$$($(1).GCC.CPP_O.args),$$(1),$$(2)) ########################################################################### @@ -169,18 +185,18 @@ define import.GCC $(1).GCC.i = $$(4) # FUNCTION: C link dynamic-lib - $(1).GCC.DYLIB.args = !gcc ?pipe ?strip ?dylib ?extra.dylib ?ML *W *archs ?vis ?pic .g .O ?extra *D *I !o ?muldefs ?start !i *F *f *L *l *i !a ?end + $(1).GCC.DYLIB.args = !gcc ?pipe ?strip ?dylib ?extra.dylib ?ML *W *archs *sysroot *minver ?vis ?pic .g .O ?extra *D *I !o ?muldefs ?start !i *F *f *L *l *i !a ?end $(1).GCC.DYLIB = $$(call fn.ARGS,$(1).GCC,$$($(1).GCC.DYLIB.args),$$(1),$$(2)) # FUNCTION: C link executable - $(1).GCC.EXE.args = !gcc ?pipe ?strip ?extra.exe ?ML *W *archs ?vis ?pic .g .O ?extra *D *I !o ?muldefs ?start !i *F *f *L *l *i !a ?end + $(1).GCC.EXE.args = !gcc ?pipe ?strip ?extra.exe ?ML *W *archs *sysroot *minver ?vis ?pic .g .O ?extra *D *I !o ?muldefs ?start !i *F *f *L *l *i !a ?end $(1).GCC.EXE = $$(call fn.ARGS,$(1).GCC,$$($(1).GCC.EXE.args),$$(1),$$(2)) # FUNCTION: C++ link dynamic-lib - $(1).GCC.DYLIB++.args = !gxx ?pipe ?strip ?dylib ?extra.dylib++ ?ML *W *archs ?vis ?pic .g .O ?extra *D *I !o ?muldefs ?start !i *F *f *L *l *i !a ?end + $(1).GCC.DYLIB++.args = !gxx ?pipe ?strip ?dylib ?extra.dylib++ ?ML *W *arch *sysroot *minvers ?vis ?pic .g .O ?extra *D *I !o ?muldefs ?start !i *F *f *L *l *i !a ?end $(1).GCC.DYLIB++ = $$(call fn.ARGS,$(1).GCC,$$($(1).GCC.DYLIB++.args),$$(1),$$(2)) # FUNCTION: C++ link executable - $(1).GCC.EXE++.args = !gxx ?pipe ?strip ?extra.exe++ ?ML *W *archs ?vis ?pic .g .O ?extra *D *I !o ?muldefs ?start !i *F *f *L *l *i !a ?end + $(1).GCC.EXE++.args = !gxx ?pipe ?strip ?extra.exe++ ?ML *W *archs *sysroot *minver ?vis ?pic .g .O ?extra *D *I !o ?muldefs ?start !i *F *f *L *l *i !a ?end $(1).GCC.EXE++ = $$(call fn.ARGS,$(1).GCC,$$($(1).GCC.EXE++.args),$$(1),$$(2)) endef