[vlc-devel] [PATCH 2/3] Allow build vlc-ios for selected architecture armv7 or armv7s

Gleb Pinigin gpinigin at gmail.com
Thu Jan 24 18:16:35 CET 2013


---
 configure.ac                |    3 ++-
 contrib/src/main.mak        |   10 +++++-----
 contrib/src/vpx/rules.mak   |    4 ++--
 extras/package/ios/build.sh |   42 ++++++++++++++++++++++++++++++------------
 4 files changed, 39 insertions(+), 20 deletions(-)

diff --git a/configure.ac b/configure.ac
index bbced23..c2d0b70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -143,7 +143,8 @@ case "${host_os}" in
         ARCH_flag="-arch x86_64"
       ;;
       arm*)
-        ARCH_flag="-arch armv7"
+        ARCH=${host%%-*}
+        ARCH_flag="-arch $ARCH"
         ac_cv_c_bigendian="no"
         ac_cv_c_attribute_packed="no"
       ;;
diff --git a/contrib/src/main.mak b/contrib/src/main.mak
index 598ea54..db448f1 100644
--- a/contrib/src/main.mak
+++ b/contrib/src/main.mak
@@ -126,7 +126,7 @@ endif
 ifdef HAVE_IOS
 CC=xcrun clang
 CXX=xcrun clang++
-ifeq ($(ARCH), arm)
+ifneq ($(findstring $(ARCH), armv7 armv7s),)
 AS=perl $(abspath ../../extras/tools/build/bin/gas-preprocessor.pl) $(CC)
 else
 AS=xcrun as
@@ -135,9 +135,9 @@ AR=xcrun ar
 LD=xcrun ld
 STRIP=xcrun strip
 RANLIB=xcrun ranlib
-ifeq ($(ARCH), arm)
-EXTRA_CFLAGS += -arch armv7 -mcpu=cortex-a8
-EXTRA_LDFLAGS += -arch armv7
+ifneq ($(findstring $(ARCH), armv7 armv7s),)
+EXTRA_CFLAGS += -arch $(ARCH) -mcpu=cortex-a8
+EXTRA_LDFLAGS += -arch $(ARCH)
 else
 EXTRA_CFLAGS += -m32
 EXTRA_LDFLAGS += -m32
@@ -166,7 +166,7 @@ LDFLAGS := $(LDFLAGS) $(EXTRA_LDFLAGS)
 ifneq ($(findstring $(ARCH),i386 sparc sparc64 ppc ppc64 x86_64),)
 # This should be consistent with include/vlc_cpu.h
 HAVE_FPU = 1
-else ifneq ($(findstring $(ARCH),arm),)
+else ifneq ($(findstring $(ARCH), armv7 armv7s),)
 ifneq ($(call cppcheck, __VFP_FP__)),)
 ifeq ($(call cppcheck, __SOFTFP__),)
 HAVE_FPU = 1
diff --git a/contrib/src/vpx/rules.mak b/contrib/src/vpx/rules.mak
index 76f1430..9f9fe94 100644
--- a/contrib/src/vpx/rules.mak
+++ b/contrib/src/vpx/rules.mak
@@ -31,8 +31,8 @@ else
 VPX_CROSS :=
 endif
 
-ifeq ($(ARCH),arm)
-VPX_ARCH := armv7
+ifneq ($(findstring $(ARCH), armv7 armv7s),)
+VPX_ARCH := $(ARCH)
 else ifeq ($(ARCH),i386)
 VPX_ARCH := x86
 else ifeq ($(ARCH),mips)
diff --git a/extras/package/ios/build.sh b/extras/package/ios/build.sh
index 1431e3c..ce325b8 100755
--- a/extras/package/ios/build.sh
+++ b/extras/package/ios/build.sh
@@ -5,15 +5,18 @@ PLATFORM=OS
 VERBOSE=no
 SDK_VERSION=6.0
 SDK_MIN=5.1
+VLC_ARCHS="armv7 armv7s"
+
 
 usage()
 {
 cat << EOF
-usage: $0 [-s] [-k sdk]
+usage: $0 [-s] [-k sdk] [-a arch]
 
 OPTIONS
    -k       Specify which sdk to use ('xcodebuild -showsdks', current: ${SDK})
    -s       Build for simulator
+   -a       Build for arch (armv7 or armv7s)
 EOF
 }
 
@@ -34,7 +37,7 @@ info()
     echo "[${blue}info${normal}] $1"
 }
 
-while getopts "hvsk:" OPTION
+while getopts "hvska:" OPTION
 do
      case $OPTION in
          h)
@@ -50,6 +53,11 @@ do
              ;;
          k)
              SDK=$OPTARG
+             shift
+             ;;
+         a)
+             VLC_ARCH=$OPTARG
+             shift
              ;;
          ?)
              usage
@@ -57,6 +65,7 @@ do
              ;;
      esac
 done
+
 shift $(($OPTIND - 1))
 
 if [ "x$1" != "x" ]; then
@@ -72,12 +81,21 @@ fi
 info "Building libvlc for iOS"
 
 if [ "$PLATFORM" = "Simulator" ]; then
-    TARGET="i686-apple-darwin11"
+    TARGET="i386-apple-darwin11"
     ARCH="i386"
-    OPTIM="-O3 -g"
+    OPTIM="-O3"
 else
-    TARGET="arm-apple-darwin11"
-    ARCH="armv7 -g"
+    TARGET="armv7-apple-darwin11"
+    ARCH="armv7"
+fi
+
+if [ ".$VLC_ARCH" != "." ]; then
+    for i in $VLC_ARCHS; do
+        if [ "$i" = "$VLC_ARCH" ]; then
+            TARGET="${VLC_ARCH}-apple-darwin11"
+            ARCH=$VLC_ARCH
+        fi
+    done
 fi
 
 info "Using ${ARCH} with SDK version ${SDK_VERSION}"
@@ -100,9 +118,9 @@ then
     exit 1
 fi
 
-BUILDDIR="${VLCROOT}/build-ios-${PLATFORM}"
+BUILDDIR="${VLCROOT}/build-ios-${PLATFORM}-${ARCH}"
 
-PREFIX="${VLCROOT}/install-ios-${PLATFORM}"
+PREFIX="${VLCROOT}/install-ios-${PLATFORM}-${ARCH}"
 
 IOS_GAS_PREPROCESSOR="${VLCROOT}/extras/tools/gas/gas-preprocessor.pl"
 
@@ -117,7 +135,7 @@ spushd "${VLCROOT}/extras/tools"
 make && make .gas
 spopd
 
-info "Building contrib for iOS in '${VLCROOT}/contrib/iPhone${PLATFORM}'"
+info "Building contrib for iOS in '${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}'"
 
 # The contrib will read the following
 export AR="xcrun ar"
@@ -161,8 +179,8 @@ info "LD FLAGS SELECTED = '${LDFLAGS}'"
 spushd ${VLCROOT}/contrib
 
 echo ${VLCROOT}
-mkdir -p "${VLCROOT}/contrib/iPhone${PLATFORM}"
-cd "${VLCROOT}/contrib/iPhone${PLATFORM}"
+mkdir -p "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
+cd "${VLCROOT}/contrib/iPhone${PLATFORM}-${ARCH}"
 
 if [ "$PLATFORM" = "OS" ]; then
       export AS="${IOS_GAS_PREPROCESSOR} ${CC}"
@@ -173,7 +191,7 @@ else
   export ASCPP="xcrun as"
 fi
 
-../bootstrap --host=${TARGET} --build="i686-apple-darwin10" --disable-disc --disable-sout \
+../bootstrap --host=${TARGET} --build="i386-apple-darwin10" --disable-disc --disable-sout \
     --enable-small \
     --disable-sdl \
     --disable-SDL_image \
-- 
1.7.10.2 (Apple Git-33)




More information about the vlc-devel mailing list