[vlc-devel] [PATCH 1/3] contrib/vpx: fix compilation for iOS

Felix Paul Kühne fkuehne at videolan.org
Tue Nov 4 21:52:29 CET 2014


---
 contrib/src/vpx/libvpx-ios.patch | 78 ++++++++++++++++++++++++++++++++++++++++
 contrib/src/vpx/rules.mak        | 16 +++++----
 2 files changed, 87 insertions(+), 7 deletions(-)
 create mode 100644 contrib/src/vpx/libvpx-ios.patch

diff --git a/contrib/src/vpx/libvpx-ios.patch b/contrib/src/vpx/libvpx-ios.patch
new file mode 100644
index 0000000..852792d
--- /dev/null
+++ b/contrib/src/vpx/libvpx-ios.patch
@@ -0,0 +1,78 @@
+diff -ru libvpx/build/make/configure.sh libvpx/build/make/configure.sh
+--- libvpx/build/make/configure.sh	2014-11-04 21:34:04.000000000 +0100
++++ libvpx/build/make/configure.sh	2014-11-04 21:36:12.000000000 +0100
+@@ -714,59 +714,6 @@
+     # PIC is probably what we want when building shared libs
+     enabled shared && soft_enable pic
+ 
+-    # Handle darwin variants. Newer SDKs allow targeting older
+-    # platforms, so find the newest SDK available.
+-    case ${toolchain} in
+-        *-darwin*)
+-            if [ -z "${DEVELOPER_DIR}" ]; then
+-                DEVELOPER_DIR=`xcode-select -print-path 2> /dev/null`
+-                [ $? -ne 0 ] && OSX_SKIP_DIR_CHECK=1
+-            fi
+-            if [ -z "${OSX_SKIP_DIR_CHECK}" ]; then
+-                OSX_SDK_ROOTS="${DEVELOPER_DIR}/SDKs"
+-                OSX_SDK_VERSIONS="MacOSX10.4u.sdk MacOSX10.5.sdk MacOSX10.6.sdk"
+-                OSX_SDK_VERSIONS="${OSX_SDK_VERSIONS} MacOSX10.7.sdk"
+-                for v in ${OSX_SDK_VERSIONS}; do
+-                    if [ -d "${OSX_SDK_ROOTS}/${v}" ]; then
+-                        osx_sdk_dir="${OSX_SDK_ROOTS}/${v}"
+-                    fi
+-                done
+-            fi
+-            ;;
+-    esac
+-
+-    if [ -d "${osx_sdk_dir}" ]; then
+-        add_cflags  "-isysroot ${osx_sdk_dir}"
+-        add_ldflags "-isysroot ${osx_sdk_dir}"
+-    fi
+-
+-    case ${toolchain} in
+-        *-darwin8-*)
+-            add_cflags  "-mmacosx-version-min=10.4"
+-            add_ldflags "-mmacosx-version-min=10.4"
+-            ;;
+-        *-darwin9-*)
+-            add_cflags  "-mmacosx-version-min=10.5"
+-            add_ldflags "-mmacosx-version-min=10.5"
+-            ;;
+-        *-darwin10-*)
+-            add_cflags  "-mmacosx-version-min=10.6"
+-            add_ldflags "-mmacosx-version-min=10.6"
+-            ;;
+-        *-darwin11-*)
+-            add_cflags  "-mmacosx-version-min=10.7"
+-            add_ldflags "-mmacosx-version-min=10.7"
+-            ;;
+-        *-darwin12-*)
+-            add_cflags  "-mmacosx-version-min=10.8"
+-            add_ldflags "-mmacosx-version-min=10.8"
+-            ;;
+-        *-darwin13-*)
+-            add_cflags  "-mmacosx-version-min=10.9"
+-            add_ldflags "-mmacosx-version-min=10.9"
+-            ;;
+-    esac
+-
+     # Handle Solaris variants. Solaris 10 needs -lposix4
+     case ${toolchain} in
+         sparc-solaris-*)
+@@ -1070,7 +1017,13 @@
+             ;;
+             gcc*)
+                 add_cflags -m${bits}
+-                add_ldflags -m${bits}
++                case ${tgt_os} in
++                    darwin*)
++                    ;;
++                    *)
++                    add_ldflags -m${bits}
++                    ;;
++                esac
+                 link_with_cc=gcc
+                 tune_cflags="-march="
+                 setup_gnu_toolchain
diff --git a/contrib/src/vpx/rules.mak b/contrib/src/vpx/rules.mak
index 9f4f183..5b5613e 100644
--- a/contrib/src/vpx/rules.mak
+++ b/contrib/src/vpx/rules.mak
@@ -13,6 +13,7 @@ libvpx: libvpx-$(VPX_VERSION).tar.bz2 .sum-vpx
 	$(APPLY) $(SRC)/vpx/libvpx-sysroot.patch
 	$(APPLY) $(SRC)/vpx/libvpx-no-cross.patch
 	$(APPLY) $(SRC)/vpx/libvpx-mac.patch
+	$(APPLY) $(SRC)/vpx/libvpx-ios.patch
 	$(MOVE)
 
 DEPS_vpx =
@@ -23,6 +24,8 @@ else
 VPX_CROSS :=
 endif
 
+VPX_LDFLAGS := $(LDFLAGS)
+
 ifeq ($(ARCH),arm)
 VPX_ARCH := armv7
 else ifeq ($(ARCH),i386)
@@ -43,16 +46,14 @@ ifdef HAVE_ANDROID
 VPX_OS := android
 else ifdef HAVE_LINUX
 VPX_OS := linux
-else ifdef HAVE_DARWIN_OS
-ifeq ($(ARCH),arm)
-VPX_OS := darwin
-else
+else ifdef HAVE_MACOSX
 ifeq ($(OSX_VERSION),10.5)
 VPX_OS := darwin9
 else
 VPX_OS := darwin10
 endif
-endif
+else ifdef HAVE_IOS
+VPX_OS := darwin11
 else ifdef HAVE_SOLARIS
 VPX_OS := solaris
 else ifdef HAVE_WIN64 # must be before WIN32
@@ -89,7 +90,8 @@ ifdef HAVE_MACOSX
 VPX_CONF += --sdk-path=$(MACOSX_SDK)
 endif
 ifdef HAVE_IOS
-VPX_CONF += --sdk-path=$(SDKROOT)
+VPX_CONF += --sdk-path=$(IOS_SDK) --enable-vp8-decoder --disable-vp8-encoder --disable-vp9-encoder
+VPX_LDFLAGS := "-L$(IOS_SDK)/usr/lib -arch $(ARCH) -syslibroot $(IOS_SDK) -ios_version_min 6.1"
 endif
 ifdef HAVE_ANDROID
 # vpx configure.sh overrides our sysroot and it looks for it itself, and
@@ -100,7 +102,7 @@ VPX_CONF += --extra-cflags="-I $(ANDROID_NDK)/sources/cpufeatures/"
 endif
 
 .vpx: libvpx
-	cd $< && CROSS=$(VPX_CROSS) ./configure --target=$(VPX_TARGET) \
+	cd $< && LDFLAGS=$(VPX_LDFLAGS) CROSS=$(VPX_CROSS) ./configure --target=$(VPX_TARGET) \
 		$(VPX_CONF) --prefix=$(PREFIX)
 	cd $< && $(MAKE)
 	cd $< && ../../../contrib/src/pkg-static.sh vpx.pc
-- 
1.9.3 (Apple Git-50)




More information about the vlc-devel mailing list