[vlc-devel] [PATCH] Add option to specify arhitecture variant for building vlc for iOS

Gleb Pinigin gpinigin at gmail.com
Wed Jan 30 14:42:21 CET 2013


---
 configure.ac                |    1 -
 contrib/src/main.mak        |    7 -------
 extras/package/ios/build.sh |   35 ++++++++++++++++++++++++++---------
 3 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/configure.ac b/configure.ac
index cc557e5..cb63660 100644
--- a/configure.ac
+++ b/configure.ac
@@ -143,7 +143,6 @@ case "${host_os}" in
         ARCH_flag="-arch x86_64"
       ;;
       arm*)
-        ARCH_flag="-arch armv7"
         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..64ecf76 100644
--- a/contrib/src/main.mak
+++ b/contrib/src/main.mak
@@ -135,13 +135,6 @@ 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
-else
-EXTRA_CFLAGS += -m32
-EXTRA_LDFLAGS += -m32
-endif
 EXTRA_CFLAGS += -isysroot $(SDKROOT)  -miphoneos-version-min=5.0
 EXTRA_LDFLAGS += -Wl,-syslibroot,$(SDKROOT) -isysroot $(SDKROOT) -miphoneos-version-min=5.0
 endif
diff --git a/extras/package/ios/build.sh b/extras/package/ios/build.sh
index 1431e3c..d69d926 100755
--- a/extras/package/ios/build.sh
+++ b/extras/package/ios/build.sh
@@ -5,6 +5,7 @@ PLATFORM=OS
 VERBOSE=no
 SDK_VERSION=6.0
 SDK_MIN=5.1
+ARCH=armv7
 
 usage()
 {
@@ -12,8 +13,9 @@ cat << EOF
 usage: $0 [-s] [-k sdk]
 
 OPTIONS
-   -k       Specify which sdk to use ('xcodebuild -showsdks', current: ${SDK})
-   -s       Build for simulator
+   -k <sdk>      Specify which sdk to use ('xcodebuild -showsdks', current: ${SDK})
+   -s            Build for simulator
+   -a <arch>     Specify which arch to use (current: ${ARCH})
 EOF
 }
 
@@ -34,7 +36,7 @@ info()
     echo "[${blue}info${normal}] $1"
 }
 
-while getopts "hvsk:" OPTION
+while getopts "hvsk:a:" OPTION
 do
      case $OPTION in
          h)
@@ -51,6 +53,9 @@ do
          k)
              SDK=$OPTARG
              ;;
+         a)
+             ARCH=$OPTARG
+             ;;
          ?)
              usage
              exit 1
@@ -77,7 +82,6 @@ if [ "$PLATFORM" = "Simulator" ]; then
     OPTIM="-O3 -g"
 else
     TARGET="arm-apple-darwin11"
-    ARCH="armv7 -g"
 fi
 
 info "Using ${ARCH} with SDK version ${SDK_VERSION}"
@@ -100,9 +104,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 +121,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"
@@ -156,13 +160,21 @@ else
   export LDFLAGS="-syslibroot=${SDKROOT}/ -arch ${ARCH} -miphoneos-version-min=${SDK_MIN}"
 fi
 
+if [ "$PLATFORM" = "OS" ]; then
+    EXTRA_CFLAGS="-arch ${ARCH} -mcpu=cortex-a8"
+    EXTRA_LDFLAGS="-arch ${ARCH}"
+else
+    EXTRA_CFLAGS="-m32"
+    EXTRA_LDFLAGS="-m32"
+fi
+
 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}"
@@ -200,6 +212,9 @@ fi
     --disable-schroedinger \
     --disable-libmpeg2 \
     --enable-mad > ${out}
+
+echo "EXTRA_CFLAGS += ${EXTRA_CFLAGS}" >> config.mak
+echo "EXTRA_LDFLAGS += ${EXTRA_LDFLAGS}" >> config.mak
 make
 spopd
 
@@ -316,7 +331,9 @@ make -j$MAKE_JOBS > ${out}
 
 info "Installing libvlc"
 make install > ${out}
+
 find ${PREFIX}/lib/vlc/plugins -name *.a -type f -exec cp '{}' ${PREFIX}/lib/vlc/plugins \;
+cp -R "${VLCROOT}/contrib/${TARGET}" "${PREFIX}/contribs"
 
 info "Removing unneeded modules"
 blacklist="
-- 
1.7.10.2 (Apple Git-33)




More information about the vlc-devel mailing list