Skip to content

Commit

Permalink
BuildSystem: initial Xcode5 support
Browse files Browse the repository at this point in the history
Tested on MacOSX 10.8.5 w/ Xcode 5.0, 4.6.3 and 4.5.2, various builds,
including terminal Xcode, terminal no Xcode and Xcode IDE,
and permutations with/without mp4v2 and mkv.

- push defs for optional static libraries (OSL) to respective modules
- adjust make-driven linking to use OSL
- adjust Xcode-driven linking to use OSL via ld -filelist option
- add Xcode project group for all OSL
- set Xcode project to use clang compiler
- add osx 10.8 xcconfig files
- add "supplemental" xcconfig file where EXTERNAL_CONFIGURE may be used
  to specify configure-time options
- patch mp4v2 to compile with clang

Intructions for custom configure-options within Xcode IDE:

1. edit macosx/xcconfig/supplemental.xcconfig
2. save file (unsure how long it takes IDE to see change but it does)
3. build clean
4. build
5. never commit supplemental.xcconfig to repository - it is meant to
   exist but not effect the build on a clean checkout, and to be used
   only as a developer transient developer customization file.


git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5800 b64f7644-9d1e-0410-96f1-a4d463321fa5
  • Loading branch information
KonaBlend committed Sep 24, 2013
1 parent 203b7a9 commit c0d3a07
Show file tree
Hide file tree
Showing 17 changed files with 1,572 additions and 42 deletions.
4 changes: 4 additions & 0 deletions contrib/faac/module.defs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ FAAC.EXTRACT.tarbase = faac-1.28
# If faac not already bootstrapped then add the following
#FAAC.CONFIGURE.bootstrap = ./bootstrap;
FAAC.CONFIGURE.extra = --without-mp4v2

## optional static libs need to be marked
FAAC.OSL.libs = faac
FAAC.OSL.files = $(foreach i,$(FAAC.OSL.libs),$(call fn.ABSOLUTE,$(CONTRIB.build/)lib/lib$(i).a))
3 changes: 3 additions & 0 deletions contrib/fdk-aac/module.defs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ $(eval $(call import.CONTRIB.defs,FDKAAC))

FDKAAC.FETCH.url = http://download.handbrake.fr/handbrake/contrib/fdk-aac-v0.1.1-6-gbae4553.tar.bz2

## optional static libs need to be marked
FDKAAC.OSL.libs = fdk-aac
FDKAAC.OSL.files = $(foreach i,$(FDKAAC.OSL.libs),$(call fn.ABSOLUTE,$(CONTRIB.build/)lib/lib$(i).a))
4 changes: 4 additions & 0 deletions contrib/libmfx/module.defs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ $(eval $(call import.CONTRIB.defs,LIBMFX))
LIBMFX.FETCH.url = http://download.handbrake.fr/contrib/libmfx_intel_msdk_2013r2.tar.bz2

LIBMFX.CONFIGURE.bootstrap = rm -fr aclocal.m4 autom4te.cache; autoreconf -fiv;

## optional static libs need to be marked
LIBMFX.OSL.libs = mfx
LIBMFX.OSL.files = $(foreach i,$(LIBMFX.OSL.libs),$(call fn.ABSOLUTE,$(CONTRIB.build/)lib/lib$(i).a))
4 changes: 4 additions & 0 deletions contrib/libmkv/module.defs
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ LIBMKV.CONFIGURE.bootstrap = rm -fr aclocal.m4 autom4te.cache; mkdir m4; autorec
ifeq (mingw,$(BUILD.system))
LIBMKV.GCC.D += random=rand srandom=srand
endif

## optional static libs need to be marked
LIBMKV.OSL.libs = mkv
LIBMKV.OSL.files = $(foreach i,$(LIBMKV.OSL.libs),$(call fn.ABSOLUTE,$(CONTRIB.build/)lib/lib$(i).a))
1,472 changes: 1,472 additions & 0 deletions contrib/mp4v2/A03-clang.patch

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions contrib/mp4v2/module.defs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ MP4V2.CONFIGURE.extra += --disable-util

# gch causes build errors with -g3 on many gcc toolchains
MP4V2.CONFIGURE.extra += --disable-gch

## optional static libs need to be marked
MP4V2.OSL.libs = mp4v2
MP4V2.OSL.files = $(foreach i,$(MP4V2.OSL.libs),$(call fn.ABSOLUTE,$(CONTRIB.build/)lib/lib$(i).a))
34 changes: 32 additions & 2 deletions macosx/HandBrake.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,13 @@
277A3FD014AE84C500A835E4 /* osx106.i386.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = osx106.i386.xcconfig; sourceTree = "<group>"; };
277A3FD114AE84C500A835E4 /* osx106.x86_64.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = osx106.x86_64.xcconfig; sourceTree = "<group>"; };
277A3FD214AE84C500A835E4 /* osx107.x86_64.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = osx107.x86_64.xcconfig; sourceTree = "<group>"; };
277EFE8917ED4F5D001D4A6A /* osx108.i386.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = osx108.i386.xcconfig; sourceTree = "<group>"; };
277EFE8B17ED4F63001D4A6A /* osx108.x86_64.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = osx108.x86_64.xcconfig; sourceTree = "<group>"; };
277EFE8D17ED5628001D4A6A /* supplemental.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = supplemental.xcconfig; sourceTree = "<group>"; };
277EFE8F17ED7296001D4A6A /* libmp4v2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmp4v2.a; path = external/contrib/lib/libmp4v2.a; sourceTree = BUILT_PRODUCTS_DIR; };
277EFE9017ED72A1001D4A6A /* libmkv.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmkv.a; path = external/contrib/lib/libmkv.a; sourceTree = BUILT_PRODUCTS_DIR; };
277EFE9117ED7749001D4A6A /* libfaac.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfaac.a; path = external/contrib/lib/libfaac.a; sourceTree = BUILT_PRODUCTS_DIR; };
277EFE9217ED799E001D4A6A /* libfdk-aac.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libfdk-aac.a"; path = "../../../../Users/mike/Library/Developer/Xcode/DerivedData/HandBrake-anpxrfhxsejsxehiwuiaexjoygra/Build/Products/debug/external/contrib/lib/libfdk-aac.a"; sourceTree = "<group>"; };
27D6C72414B1019100B785E4 /* libhb.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libhb.a; path = external/libhb/libhb.a; sourceTree = BUILT_PRODUCTS_DIR; };
27D6C72714B102DA00B785E4 /* liba52.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liba52.a; path = external/contrib/lib/liba52.a; sourceTree = BUILT_PRODUCTS_DIR; };
27D6C72814B102DA00B785E4 /* libass.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libass.a; path = external/contrib/lib/libass.a; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -680,15 +687,30 @@
277A3FD114AE84C500A835E4 /* osx106.x86_64.xcconfig */,
276941FA14B161B70027798C /* osx107.i386.xcconfig */,
277A3FD214AE84C500A835E4 /* osx107.x86_64.xcconfig */,
277EFE8917ED4F5D001D4A6A /* osx108.i386.xcconfig */,
277EFE8B17ED4F63001D4A6A /* osx108.x86_64.xcconfig */,
277EFE8D17ED5628001D4A6A /* supplemental.xcconfig */,
);
path = xcconfig;
sourceTree = "<group>";
};
277EFE8E17ED71A2001D4A6A /* Static Libraries (optional) */ = {
isa = PBXGroup;
children = (
277EFE9117ED7749001D4A6A /* libfaac.a */,
277EFE9217ED799E001D4A6A /* libfdk-aac.a */,
277EFE9017ED72A1001D4A6A /* libmkv.a */,
277EFE8F17ED7296001D4A6A /* libmp4v2.a */,
);
name = "Static Libraries (optional)";
sourceTree = "<group>";
};
27D6C72314B1013400B785E4 /* Products (external) */ = {
isa = PBXGroup;
children = (
271BA4C914B1238E00BC1D2C /* Support */,
271BA4C714B1236D00BC1D2C /* Static Libraries */,
277EFE8E17ED71A2001D4A6A /* Static Libraries (optional) */,
);
name = "Products (external)";
sourceTree = "<group>";
Expand Down Expand Up @@ -983,11 +1005,15 @@
"DEBUG=1",
"$(inherited)",
);
GCC_VERSION = com.apple.compilers.llvmgcc42;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OTHER_LDFLAGS = (
"-filelist",
"$(EXTERNAL_BUILD)/macosx/osl.filelist.txt",
);
SHARED_PRECOMPS_DIR = "$(CONFIGURATION_TEMP_DIR)/PrecompiledHeaders";
STRIP_INSTALLED_PRODUCT = NO;
};
Expand All @@ -1006,11 +1032,15 @@
EXTERNAL_SRC = ..;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_VERSION = com.apple.compilers.llvmgcc42;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OTHER_LDFLAGS = (
"-filelist",
"$(EXTERNAL_BUILD)/macosx/osl.filelist.txt",
);
SHARED_PRECOMPS_DIR = "$(CONFIGURATION_TEMP_DIR)/PrecompiledHeaders";
STRIP_INSTALLED_PRODUCT = YES;
};
Expand Down
24 changes: 4 additions & 20 deletions macosx/module.defs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ MACOSX.build/ = $(BUILD/)macosx/
MACOSX.m4.in = $(wildcard $(MACOSX.src/)*.m4)
MACOSX.m4.out = $(MACOSX.m4.in:$(MACOSX.src/)%.m4=$(MACOSX.build/)%)

MACOSX.osl.filelist = $(MACOSX.build/)osl.filelist.txt

###############################################################################

BUILD.out += $(MACOSX.m4.out)
BUILD.out += $(MACOSX.m4.wc.out)
BUILD.out += $(MACOSX.osl.filelist)

###############################################################################

Expand All @@ -26,25 +28,8 @@ MACOSX.map.g.std = debug
MACOSX.map.g.max = debug

ifeq (1,$(FEATURE.opencl))
MACOSX.extra_cflags = OTHER_CFLAGS='-DUSE_OPENCL'
endif

ifeq (1,$(FEATURE.fdk_aac))
extra_libs += $(abspath $(BUILD))/contrib/lib/libfdk-aac.a
endif

ifeq (1,$(FEATURE.faac))
extra_libs += $(abspath $(BUILD))/contrib/lib/libfaac.a
endif

ifeq (1,$(FEATURE.mp4v2))
extra_libs += $(abspath $(BUILD))/contrib/lib/libmp4v2.a
endif

ifeq (1,$(FEATURE.libmkv))
extra_libs += $(abspath $(BUILD))/contrib/lib/libmkv.a
MACOSX.extra_cflags = OTHER_CFLAGS='-DUSE_OPENCL'
endif
MACOSX.extra_ldflags = OTHER_LDFLAGS='$(extra_libs)'

## xcconfig: must be one of macosx/xcconfig/*.xcconfig
MACOSX.xcconfig = $(foreach x,$(XCODE.xcconfig),-xcconfig $(MACOSX.src/)xcconfig/$(x))
Expand Down Expand Up @@ -76,6 +61,5 @@ MACOSX.XCODE = $(strip \
EXTERNAL_VARS='$(-*-command-variables-*-)' \
\
$(MACOSX.extra_cflags) \
$(MACOSX.extra_ldflags) \
\
$(2) )
8 changes: 8 additions & 0 deletions macosx/module.rules
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
$(eval $(call import.MODULE.rules,MACOSX))

macosx.build: $(MACOSX.m4.out)
macosx.build: $(MACOSX.osl.filelist)

macosx.clean:
$(RM.exe) -f $(MACOSX.m4.out)
$(RM.exe) -f $(MACOSX.osl.filelist)

$(MACOSX.m4.out): $(BUILD/)project/handbrake.m4
$(MACOSX.m4.out): | $(dir $(MACOSX.m4.out))
$(MACOSX.m4.out): $(MACOSX.build/)%: $(MACOSX.src/)%.m4
$(M4.exe) -Iproject $< > $@

$(MACOSX.osl.filelist): | $(dir $(MACOSX.osl.filelist))
$(MACOSX.osl.filelist): $(BUILD/)GNUmakefile
@echo "creating $@"
@> $@
$(foreach i,$(foreach m,$(MODULES.NAMES),$($m.OSL.files)),$(call fn.PRINTLN,@echo $i >> $@))

###############################################################################

clean: macosx.clean
Expand Down
2 changes: 2 additions & 0 deletions macosx/xcconfig/base/os.osx108.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SDKROOT = macosx10.8
MACOSX_DEPLOYMENT_TARGET = 10.8
1 change: 1 addition & 0 deletions macosx/xcconfig/native.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#include "base/arch.native.xcconfig"
EXTERNAL_XCCONFIG = native
#include "supplemental.xcconfig"
3 changes: 3 additions & 0 deletions macosx/xcconfig/osx108.i386.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "base/os.osx108.xcconfig"
#include "base/arch.i386.xcconfig"
EXTERNAL_XCCONFIG = osx108.i386
3 changes: 3 additions & 0 deletions macosx/xcconfig/osx108.x86_64.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include "base/os.osx108.xcconfig"
#include "base/arch.x86_64.xcconfig"
EXTERNAL_XCCONFIG = osx108.x86_64
4 changes: 4 additions & 0 deletions macosx/xcconfig/supplemental.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// ## THIS FILE IS INTENDED FOR LOCAL WORKSPACE ONLY.
// ## THIS FILE SHOULD NEVER BE COMMITTED TO REPOSITORY WITH UNCOMMENTED LINES.

// EXTERNAL_CONFIGURE = --disable-mp4v2 --disable-mkv
5 changes: 5 additions & 0 deletions make/include/function.defs
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ fn.ARGS = $(strip $(foreach a,$(2), \
fn.VARS = $(foreach v,$($(1).vars),$(v)="$($(1).vars.$(v))")

fn.TARGET = $(TARGET.$(2).prefix)$(1)$(TARGET.$(2).suffix)$(TARGET.$(2).ext)

define fn.PRINTLN
$(1)

endef
22 changes: 18 additions & 4 deletions make/xcodemake
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,21 @@ if [ -n "$reconfigure" ]; then
driver="--xcode-driver=$EXTERNAL_DRIVER"
fi

## determine which compiler to use based on Xcode environment (project).
case "$GCC_VERSION" in
com.apple.compilers.llvmgcc42)
gcc="--gcc=$DEVELOPER_BIN_DIR/llvm-gcc-4.2"
gcc="--gcc=`$DEVELOPER_BIN_DIR/xcodebuild -find-executable llvm-gcc-4.2`"
;;
com.apple.compilers.llvm.clang.1_0)
gcc="--gcc=$DEVELOPER_BIN_DIR/clang"
gcc="--gcc=`$DEVELOPER_BIN_DIR/xcodebuild -find-executable clang`"
;;
*)
gcc=
echo "*********************************************************************"
echo "***"
echo "*** ERROR: unexpected value for GCC_VERSION: $GCC_VERSION"
echo "***"
echo "*********************************************************************"
exit 1
;;
esac

Expand Down Expand Up @@ -145,14 +151,22 @@ if [ -n "$reconfigure" ]; then
minver=
fi

## pickup user setting from Xcode IDE and avoid recursion
if [ -n "$EXTERNAL_CONFIGURE" ]; then
extconf="$EXTERNAL_CONFIGURE"
else
extconf=
fi
EXTERNAL_CONFIGURE=

## invoke configure with (hidden) option which indicates conf performed by xcode
(set -ex; $EXTERNAL_SRC/configure --force \
$EXTERNAL_CONF_ARGS \
--build="$EXTERNAL_BUILD" \
$driver \
--xcode-symroot="$SYMROOT" \
--xcode-config="$EXTERNAL_XCCONFIG" \
$gcc $arch $debug $sysroot $minver)
$gcc $arch $debug $sysroot $minver $extconf)
[ $? -ne 0 ] && exit 1
fi

Expand Down
17 changes: 1 addition & 16 deletions test/module.defs
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,10 @@ TEST.GCC.l = \
bluray xml2 bz2 z

ifeq (1,$(FEATURE.qsv))
TEST.GCC.l += mfx
TEST.GCC.D += USE_QSV HAVE_THREADS=1
endif

ifeq (1,$(FEATURE.fdk_aac))
TEST.GCC.l += fdk-aac
endif

ifeq (1,$(FEATURE.faac))
TEST.GCC.l += faac
endif

ifeq (1,$(FEATURE.mp4v2))
TEST.GCC.l += mp4v2
endif

ifeq (1,$(FEATURE.libmkv))
TEST.GCC.l += mkv
endif
TEST.GCC.l += $(foreach m,$(MODULES.NAMES),$($m.OSL.libs))

TEST.install.exe = $(DESTDIR)$(PREFIX/)bin/$(notdir $(TEST.exe))

Expand Down

0 comments on commit c0d3a07

Please sign in to comment.