summaryrefslogtreecommitdiffstats
path: root/make
diff options
context:
space:
mode:
Diffstat (limited to 'make')
-rw-r--r--make/configure.py77
-rw-r--r--make/include/contrib.defs6
-rw-r--r--make/include/gcc.defs60
-rw-r--r--make/include/main.defs35
-rw-r--r--make/include/main.rules4
-rw-r--r--make/variant/mingw.defs10
6 files changed, 140 insertions, 52 deletions
diff --git a/make/configure.py b/make/configure.py
index 26a1dc118..ba089411a 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
@@ -629,7 +642,7 @@ class Project( Action ):
self.name = 'HandBrake'
self.acro_lower = 'hb'
self.acro_upper = 'HB'
- self.url_website = 'http://handbrake.fr'
+ self.url_website = 'http://code.google.com/p/hbfork'
self.url_community = 'http://forum.handbrake.fr'
self.url_irc = 'irc://irc.freenode.net/handbrake'
@@ -783,9 +796,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 +949,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 +974,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 +1123,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 +1165,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()
@@ -1207,14 +1238,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 +1266,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()
diff --git a/make/include/contrib.defs b/make/include/contrib.defs
index cbc70866b..a3019ade7 100644
--- a/make/include/contrib.defs
+++ b/make/include/contrib.defs
@@ -83,10 +83,10 @@ 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)"
+ $(1).CONFIGURE.env.CFLAGS = CFLAGS="$$(call fn.ARGS,$(1).GCC,*archs ?extra)"
$(1).CONFIGURE.env.CXX = CXX=$$($(1).GCC.gxx)
- $(1).CONFIGURE.env.CXXFLAGS = CXXFLAGS="$$(call fn.ARGS,$(1).GCC,*archs)"
- $(1).CONFIGURE.env.CPPFLAGS = CPPFLAGS="$$(call fn.ARGS,$(1).GCC,*archs)"
+ $(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.args = !CC !CFLAGS !CXX !CXXFLAGS !CPPFLAGS !LDFLAGS
diff --git a/make/include/gcc.defs b/make/include/gcc.defs
index 35a6e50a8..f9511d1b5 100644
--- a/make/include/gcc.defs
+++ b/make/include/gcc.defs
@@ -12,7 +12,6 @@ GCC.vis = 0
GCC.pic = 0
GCC.g = none
GCC.O = none
-GCC.extra = 1
GCC.D =
GCC.I =
GCC.muldefs = 0
@@ -24,6 +23,16 @@ GCC.L =
GCC.l =
GCC.end = 0
+GCC.extra = 1
+GCC.extra.h_o = 1
+GCC.extra.c_o = 1
+GCC.extra.dylib = 1
+GCC.extra.exe = 1
+GCC.extra.hpp_o = 1
+GCC.extra.cpp_o = 1
+GCC.extra.dylib++ = 1
+GCC.extra.exe++ = 1
+
GCC.args.pipe = -pipe
GCC.args.strip = -Wl,-S
GCC.args.dylib = -dynamiclib
@@ -40,7 +49,6 @@ GCC.args.g.max = -gdwarf-2 -g3
GCC.args.O.none = -O0
GCC.args.O.size = -Os
GCC.args.O.speed = -O3
-GCC.args.extra =
GCC.args.D = -D$(1)
GCC.args.I = -I$(1)
GCC.args.muldefs = -Wl,--allow-multiple-definition
@@ -51,6 +59,16 @@ GCC.args.L = -L$(1)
GCC.args.l = -l$(1)
GCC.args.end = -Wl,--end-group
+GCC.args.extra =
+GCC.args.extra.h_o =
+GCC.args.extra.c_o =
+GCC.args.extra.dylib =
+GCC.args.extra.exe =
+GCC.args.extra.hpp_o =
+GCC.args.extra.cpp_o =
+GCC.args.extra.dylib++ =
+GCC.args.extra.exe++ =
+
###############################################################################
define import.GCC
@@ -68,7 +86,6 @@ define import.GCC
$(1).GCC.pic = $$(GCC.pic)
$(1).GCC.g = $$(GCC.g)
$(1).GCC.O = $$(GCC.O)
- $(1).GCC.extra = $$(GCC.extra)
$(1).GCC.D = $$(GCC.D)
$(1).GCC.I = $$(GCC.I)
$(1).GCC.muldefs = $$(GCC.muldefs)
@@ -80,6 +97,16 @@ define import.GCC
$(1).GCC.l = $$(GCC.l)
$(1).GCC.end = $$(GCC.end)
+ $(1).GCC.extra = $$(GCC.extra)
+ $(1).GCC.extra.h_o = $$(GCC.extra.h_o)
+ $(1).GCC.extra.c_o = $$(GCC.extra.c_o)
+ $(1).GCC.extra.dylib = $$(GCC.extra.dylib)
+ $(1).GCC.extra.exe = $$(GCC.extra.exe)
+ $(1).GCC.extra.hpp_o = $$(GCC.extra.hpp_o)
+ $(1).GCC.extra.cpp_o = $$(GCC.extra.cpp_o)
+ $(1).GCC.extra.dylib++ = $$(GCC.extra.dylib++)
+ $(1).GCC.extra.exe++ = $$(GCC.extra.exe++)
+
$(1).GCC.args.pipe = $$(GCC.args.pipe)
$(1).GCC.args.strip = $$(GCC.args.strip)
$(1).GCC.args.dylib = $$(GCC.args.dylib)
@@ -96,7 +123,6 @@ define import.GCC
$(1).GCC.args.O.none = $$(GCC.args.O.none)
$(1).GCC.args.O.size = $$(GCC.args.O.size)
$(1).GCC.args.O.speed = $$(GCC.args.O.speed)
- $(1).GCC.args.extra = $$(GCC.args.extra)
$(1).GCC.args.D = $$(GCC.args.D)
$(1).GCC.args.I = $$(GCC.args.I)
$(1).GCC.args.muldefs = $$(GCC.args.muldefs)
@@ -107,25 +133,35 @@ define import.GCC
$(1).GCC.args.l = $$(GCC.args.l)
$(1).GCC.args.end = $$(GCC.args.end)
+ $(1).GCC.args.extra = $$(GCC.args.extra)
+ $(1).GCC.args.extra.h_o = $$(GCC.args.extra.h_o)
+ $(1).GCC.args.extra.c_o = $$(GCC.args.extra.c_o)
+ $(1).GCC.args.extra.dylib = $$(GCC.args.extra.dylib)
+ $(1).GCC.args.extra.exe = $$(GCC.args.extra.exe)
+ $(1).GCC.args.extra.hpp_o = $$(GCC.args.extra.hpp_o)
+ $(1).GCC.args.extra.cpp_o = $$(GCC.args.extra.cpp_o)
+ $(1).GCC.args.extra.dylib++ = $$(GCC.args.extra.dylib++)
+ $(1).GCC.args.extra.exe++ = $$(GCC.args.extra.exe++)
+
###########################################################################
$(1).GCC.c = -c $$(4)
$(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 *D *I !c !o
+ $(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 = $$(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 *D *I !c !o
+ $(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 = $$(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 *D *I !c !o
+ $(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 = $$(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 *D *I !c !o
+ $(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 = $$(call fn.ARGS,$(1).GCC,$$($(1).GCC.CPP_O.args),$$(1),$$(2))
###########################################################################
@@ -133,18 +169,18 @@ define import.GCC
$(1).GCC.i = $$(4)
# FUNCTION: C link dynamic-lib
- $(1).GCC.DYLIB.args = !gcc ?pipe ?strip ?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 ?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 ?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 ?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 ?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 *archs ?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 ?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 ?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
diff --git a/make/include/main.defs b/make/include/main.defs
index f07678b79..a1bafbb92 100644
--- a/make/include/main.defs
+++ b/make/include/main.defs
@@ -10,7 +10,7 @@ include $(SRC/)make/include/tool.defs
MODULES += contrib/a52dec
-ifneq (,$(filter $(BUILD.system),cygwin))
+ifneq (,$(filter $(BUILD.system),cygwin mingw))
MODULES += contrib/bzip2
endif
@@ -27,10 +27,15 @@ MODULES += contrib/libsamplerate
MODULES += contrib/libtheora
MODULES += contrib/libvorbis
MODULES += contrib/mpeg2dec
+
+ifneq (,$(filter $(BUILD.system),mingw))
+ MODULES += contrib/pthreadw32
+endif
+
MODULES += contrib/x264
MODULES += contrib/xvidcore
-ifneq (,$(filter $(BUILD.system),cygwin))
+ifneq (,$(filter $(BUILD.system),cygwin mingw))
MODULES += contrib/zlib
endif
@@ -39,21 +44,21 @@ MODULES += libhb
###############################################################################
-## test module is replaced with macosx when Darwin+Xcode
-ifneq (,$(filter $(BUILD.system),darwin))
- ifeq (1,$(FEATURE.xcode))
- MODULES += macosx
- else
- MODULES += test
- endif
+ifeq (1-darwin,$(FEATURE.xcode)-$(BUILD.system))
+ ## use macosx module when xcode+darwin
+ MODULES += macosx
else
+ ## default is to build CLI
MODULES += test
endif
-ifneq (,$(filter $(BUILD.system),linux))
- ifeq (1,$(FEATURE.gtk))
- MODULES += gtk
- endif
+ifeq (1-mingw,$(FEATURE.gtk.mingw)-$(BUILD.system))
+ MODULES += gtk
+endif
+
+ifeq (1-linux,$(FEATURE.gtk)-$(BUILD.system))
+ ## build gtk when gtk+linux
+ MODULES += gtk
endif
###############################################################################
@@ -63,5 +68,5 @@ MODULES += doc
###############################################################################
include $(MODULES:%=$(SRC/)%/module.defs)
-include $(SRC/)make/variant/$(HOST.system).defs
--include $(SRC/)make/variant/$(HOST.system).$(BUILD.machine).defs
+include $(SRC/)make/variant/$(BUILD.system).defs
+-include $(SRC/)make/variant/$(BUILD.system).$(BUILD.machine).defs
diff --git a/make/include/main.rules b/make/include/main.rules
index d1a16212a..2b288ab31 100644
--- a/make/include/main.rules
+++ b/make/include/main.rules
@@ -33,8 +33,8 @@ mrproper: xclean
include $(SRC/)make/include/base.rules
include $(MODULES:%=$(SRC/)%/module.rules)
--include $(SRC/)make/variant/$(HOST.system).rules
--include $(SRC/)make/variant/$(HOST.system).$(BUILD.machine).rules
+-include $(SRC/)make/variant/$(BUILD.system).rules
+-include $(SRC/)make/variant/$(BUILD.system).$(BUILD.machine).rules
###############################################################################
diff --git a/make/variant/mingw.defs b/make/variant/mingw.defs
new file mode 100644
index 000000000..81c2b043a
--- /dev/null
+++ b/make/variant/mingw.defs
@@ -0,0 +1,10 @@
+TARGET.exe.suffix = .exe
+
+GCC.start = 1
+GCC.end = 1
+
+GCC.args.dylib = -shared
+GCC.args.g.none = -g0
+GCC.args.g.min = -g1
+GCC.args.g.default = -g2
+GCC.args.g.max = -g3