[vlc-devel] [PATCH 2/2] Adds: -a build flag

Christopher Loessl cloessl at x-berg.de
Thu May 29 11:56:14 CEST 2014


This will combine the device libs and simulator libs into one. This
makes it possible in Xcode to change the deployment target from device
to simulator without rerunning this script.

If compileVLCforiOS.sh is run without flag it behaves like before.
If compileVLCforiOS.sh is run with -s it behaves like before.
Just if -a is provided it combines the device libraries together with the simulator libraries.

---
 compileVLCforiOS.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 51 insertions(+), 2 deletions(-)

diff --git a/compileVLCforiOS.sh b/compileVLCforiOS.sh
index 268cb32..62db050 100755
--- a/compileVLCforiOS.sh
+++ b/compileVLCforiOS.sh
@@ -11,6 +11,7 @@ VERBOSE=no
 CONFIGURATION="Release"
 NONETWORK=no
 SKIPLIBVLCCOMPILATION=no
+COMBINE_LIBRARIES=no
 UNSTABLEVLCKIT=yes
 
 TESTEDVLCKITHASH=4c79a817e
@@ -21,7 +22,7 @@ TESTEDQUINCYKITHASH=f1d93b96b
 usage()
 {
 cat << EOF
-usage: $0 [-s] [-v] [-k sdk] [-d] [-n] [-l] [-u]
+usage: $0 [-s] [-v] [-k sdk] [-d] [-n] [-l] [-u] [-a]
 
 OPTIONS
    -k       Specify which sdk to use (see 'xcodebuild -showsdks', current: ${SDK})
@@ -31,6 +32,7 @@ OPTIONS
    -n       Skip script steps requiring network interaction
    -l       Skip libvlc compilation
    -u       Compile not an unstable version of MobileVLCKit
+   -a       Combine simulator and device libraries (first build libraries for the device, afterwards run "$0 -s -a"
 EOF
 }
 
@@ -51,6 +53,13 @@ info()
      echo "[${green}info${normal}] $1"
 }
 
+warn()
+{
+     local red="\033[1;31m"
+     local normal="\033[0m"
+     echo "[${red}Warning${normal}] $1"
+}
+
 buildxcodeproj()
 {
     local target="$2"
@@ -72,7 +81,7 @@ buildxcodeproj()
                IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
 }
 
-while getopts "hvsdnluk:" OPTION
+while getopts "hvsdnluak:" OPTION
 do
      case $OPTION in
          h)
@@ -99,6 +108,10 @@ do
          u)
              UNSTABLEVLCKIT=no
              ;;
+         a)
+             COMBINE_LIBRARIES=yes
+             PLATFORM=iphonesimulator
+             ;;
          ?)
              usage
              exit 1
@@ -117,6 +130,8 @@ if [ "x$1" != "x" ]; then
     exit 1
 fi
 
+echo $PATH | grep -q 'usr/local' && info "Your \$PATH contains usr/local which might lead to compile problems"
+
 # Get root dir
 spushd .
 aspen_root_dir=`pwd`
@@ -270,6 +285,13 @@ ln -sf ${gtl_build} External/gtl
 ln -sf ${plcrashreporter_build} External/PLCrashReporter
 ln -sf ${quincykit_build} External/QuincyKit
 
+if [ "$COMBINE_LIBRARIES" = "yes" -o "$PLATFORM" = "iphonesimulator" ]; then
+    rm -rf ImportedSources/GDrive/build/Release-iphonesimulator/
+    rm -rf ImportedSources/PLCrashReporter/build/Release-iphonesimulator
+    rm -rf ImportedSources/QuincyKit/client/iOS/QuincyLib/build/QuincyLib.build/Release-iphonesimulator
+    rm -rf ImportedSources/upnpx/projects/xcode4/upnpx/build/Release-iphonesimulator
+fi
+
 #
 # Build time
 #
@@ -293,6 +315,9 @@ fi
 if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
     args="${args} -l"
 fi
+if [ "$COMBINE_LIBRARIES" = "yes" ]; then
+    args="${args} -f"
+fi
 ./buildMobileVLCKit.sh ${args} -k "${SDK}"
 buildxcodeproj MobileVLCKit "Aggregate static plugins"
 buildxcodeproj MobileVLCKit "MobileVLCKit"
@@ -306,10 +331,22 @@ spopd
 
 spushd upnpx/projects/xcode4/upnpx
 buildxcodeproj upnpx
+if [ "$COMBINE_LIBRARIES" = "yes" ]; then
+    spushd build
+    lipo Release-iphoneos/libupnpx.a Release-iphonesimulator/libupnpx.a -create -output lipo.a
+    mv lipo.a Release-iphonesimulator/libupnpx.a
+    spopd
+fi
 spopd
 
 spushd GDrive
 buildxcodeproj GTL "GTLTouchStaticLib"
+if [ "$COMBINE_LIBRARIES" = "yes" ]; then
+    spushd build
+    lipo Release-iphoneos/libGTLTouchStaticLib.a Release-iphonesimulator/libGTLTouchStaticLib.a -create -output lipo.a
+    mv lipo.a Release-iphonesimulator/libGTLTouchStaticLib.a
+    spopd
+fi
 spopd
 
 spushd PLCrashReporter
@@ -318,10 +355,22 @@ if [ "$PLATFORM" = "iphonesimulator" ]; then
 else
     buildxcodeproj CrashReporter "CrashReporter-iOS-Device"
 fi
+if [ "$COMBINE_LIBRARIES" = "yes" ]; then
+    spushd build
+    lipo Release-iphoneos/libCrashReporter.a Release-iphonesimulator/libCrashReporter.a -create -output lipo.a
+    mv lipo.a Release-iphonesimulator/libCrashReporter.a
+    spopd
+fi
 spopd
 
 spushd QuincyKit/client/iOS/QuincyLib
 buildxcodeproj QuincyLib
+if [ "$COMBINE_LIBRARIES" = "yes" ]; then
+    spushd build
+    lipo Release-iphoneos/libQuincyLib.a Release-iphonesimulator/libQuincyLib.a -create -output lipo.a
+    mv lipo.a Release-iphonesimulator/libQuincyLib.a
+    spopd
+fi
 spopd
 
 spopd # ImportedSources
-- 
1.8.5.2 (Apple Git-48)




More information about the vlc-devel mailing list