compileVLCforiOS.sh 6.16 KB
Newer Older
Felix Paul Kühne's avatar
Felix Paul Kühne committed
1 2 3 4 5 6
#!/bin/sh
# Copyright (C) Pierre d'Herbemont, 2010
# Copyright (C) Felix Paul Kühne, 2012-2013

set -e

7
PLATFORM=iphoneos
8
SDK=7.0
9
SDK_MIN=6.1
Felix Paul Kühne's avatar
Felix Paul Kühne committed
10
VERBOSE=no
11
CONFIGURATION="Release"
12
NONETWORK=no
13
SKIPLIBVLCCOMPILATION=no
14

15
TESTEDVLCKITHASH=eb9b82880
16
TESTEDMEDIALIBRARYKITHASH=973a5eb38
Felix Paul Kühne's avatar
Felix Paul Kühne committed
17 18 19 20 21 22 23 24 25 26 27

usage()
{
cat << EOF
usage: $0 [-s] [-v] [-k sdk]

OPTIONS
   -k       Specify which sdk to use (see 'xcodebuild -showsdks', current: ${SDK})
   -v       Be more verbose
   -s       Build for simulator
   -d       Enable Debug
28
   -n       Skip script steps requiring network interaction
29
   -l       Skip libvlc compilation
Felix Paul Kühne's avatar
Felix Paul Kühne committed
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
EOF
}

spushd()
{
     pushd "$1" 2>&1> /dev/null
}

spopd()
{
     popd 2>&1> /dev/null
}

info()
{
     local green="\033[1;32m"
     local normal="\033[0m"
     echo "[${green}info${normal}] $1"
}

buildxcodeproj()
{
    local target="$2"
    if [ "x$target" = "x" ]; then
        target="$1"
    fi

    info "Building $1 ($target, ${CONFIGURATION})"

    local extra=""
    if [ "$PLATFORM" = "Simulator" ]; then
        extra="ARCHS=i386"
    fi

    xcodebuild -project "$1.xcodeproj" \
               -target "$target" \
66
               -sdk $PLATFORM$SDK \
Felix Paul Kühne's avatar
Felix Paul Kühne committed
67 68 69 70
               -configuration ${CONFIGURATION} ${extra} \
               IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
}

71
while getopts "hvsdnlk:" OPTION
Felix Paul Kühne's avatar
Felix Paul Kühne committed
72 73 74 75 76 77 78 79 80 81
do
     case $OPTION in
         h)
             usage
             exit 1
             ;;
         v)
             VERBOSE=yes
             ;;
         s)
82
             PLATFORM=iphonesimulator
Felix Paul Kühne's avatar
Felix Paul Kühne committed
83 84 85
             ;;
         d)  CONFIGURATION="Debug"
             ;;
86 87 88
         n)
             NONETWORK=yes
             ;;
89 90 91
         l)
             SKIPLIBVLCCOMPILATION=yes
             ;;
Felix Paul Kühne's avatar
Felix Paul Kühne committed
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
         k)
             SDK=$OPTARG
             ;;
         ?)
             usage
             exit 1
             ;;
     esac
done
shift $(($OPTIND - 1))

out="/dev/null"
if [ "$VERBOSE" = "yes" ]; then
   out="/dev/stdout"
fi

if [ "x$1" != "x" ]; then
    usage
    exit 1
fi

# Get root dir
spushd .
aspen_root_dir=`pwd`
spopd

info "Preparing build dirs"

mkdir -p ImportedSources

Felix Paul Kühne's avatar
Felix Paul Kühne committed
122 123 124
rm -rf External
mkdir -p External

Felix Paul Kühne's avatar
Felix Paul Kühne committed
125 126
spushd ImportedSources

127
if [ "$NONETWORK" != "yes" ]; then
Felix Paul Kühne's avatar
Felix Paul Kühne committed
128
if ! [ -e MediaLibraryKit ]; then
129
git clone git://git.videolan.org/MediaLibraryKit.git
130
cd MediaLibraryKit
131
git checkout -B localAspenBranch ${TESTEDMEDIALIBRARYKITHASH}
132 133 134 135 136 137
git branch --set-upstream-to=origin/master localAspenBranch
cd ..
else
cd MediaLibraryKit
git pull --rebase
git reset --hard ${TESTEDMEDIALIBRARYKITHASH}
138
cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
139 140 141
fi
if ! [ -e VLCKit ]; then
git clone git://git.videolan.org/vlc-bindings/VLCKit.git
142
cd VLCKit
143
git checkout -B localAspenBranch ${TESTEDVLCKITHASH}
144 145 146 147 148 149
git branch --set-upstream-to=origin/master localAspenBranch
cd ..
else
cd VLCKit
git pull --rebase
git reset --hard ${TESTEDVLCKITHASH}
150
cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
151 152
fi
if ! [ -e OBSlider ]; then
153
git clone git://github.com/ole/OBSlider.git
154 155
else
cd OBSlider && git pull --rebase && cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
156
fi
Felix Paul Kühne's avatar
Felix Paul Kühne committed
157 158
if ! [ -e DAVKit ]; then
git clone git://github.com/mattrajca/DAVKit.git
159 160
else
cd DAVKit && git pull --rebase && cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
161
fi
162 163
if ! [ -e GDrive ]; then
svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/Source GDrive
164 165
else
cd GDrive && svn up && cd ..
166
fi
Felix Paul Kühne's avatar
Felix Paul Kühne committed
167 168
if ! [ -e GHSidebarNav ]; then
git clone git://github.com/gresrun/GHSidebarNav.git
169 170
else
cd GHSidebarNav && git pull --rebase && cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
171
fi
Felix Paul Kühne's avatar
Felix Paul Kühne committed
172 173 174 175 176
if ! [ -e upnpx ]; then
UPNPXVERSION=1.2.4
curl -O http://upnpx.googlecode.com/files/upnpx-${UPNPXVERSION}.tar.gz
tar xf upnpx-${UPNPXVERSION}.tar.gz
mv upnpx-${UPNPXVERSION} upnpx
177 178 179 180
cd upnpx
for file in ../../patches/upnpx/*; do
patch -p1 < ../../patches/upnpx/"$file"
done
181
cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
182
fi
183
if ! [ -e WhiteRaccoon ]; then
184
git clone git://github.com/fkuehne/WhiteRaccoon.git
185 186
else
cd WhiteRaccoon && git pull --rebase && cd ..
187
fi
188 189
if ! [ -e CocoaHTTPServer ]; then
git clone git://github.com/robbiehanson/CocoaHTTPServer.git
190 191 192 193 194 195 196 197
cd CocoaHTTPServer
git am ../../patches/cocoahttpserver/*.patch
if [ $? -ne 0 ]; then
git am --abort
info "Applying the patches failed, aborting git-am"
exit 1
fi
cd ..
198 199
else
cd CocoaHTTPServer && git pull --rebase && cd ..
200
fi
201
if ! [ -e Dropbox ]; then
Felix Paul Kühne's avatar
Felix Paul Kühne committed
202
DROPBOXSDKVERSION=1.3.9
203 204 205 206 207 208
curl -O https://www.dropbox.com/static/developers/dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
unzip -q dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
mv dropbox-ios-sdk-${DROPBOXSDKVERSION} Dropbox
rm dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
rm -rf __MACOSX
fi
209 210
if ! [ -e InAppSettingsKit ]; then
git clone git://github.com/futuretap/InAppSettingsKit.git
211 212 213 214 215 216 217 218
cd InAppSettingsKit
git am ../../patches/inappsettingskit/*.patch
if [ $? -ne 0 ]; then
git am --abort
info "Applying the patches failed, aborting git-am"
exit 1
fi
cd ..
219 220
else
cd InAppSettingsKit && git pull --rebase && cd ..
221
fi
222
fi
223

Felix Paul Kühne's avatar
Felix Paul Kühne committed
224 225
info "Setup 'External' folders"

226
if [ "$PLATFORM" = "iphonesimulator" ]; then
227
    xcbuilddir="build/${CONFIGURATION}-iphonesimulator"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
228
else
229
    xcbuilddir="build/${CONFIGURATION}-iphoneos"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
230 231 232
fi
framework_build="${aspen_root_dir}/ImportedSources/VLCKit/${xcbuilddir}"
mlkit_build="${aspen_root_dir}/ImportedSources/MediaLibraryKit/${xcbuilddir}"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
233
upnpx_build="${aspen_root_dir}/ImportedSources/upnpx/projects/xcode4/upnpx/${xcbuilddir}"
Carola Nitz's avatar
Carola Nitz committed
234
gtl_build="${aspen_root_dir}/ImportedSources/GDrive/${xcbuilddir}"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
235

Felix Paul Kühne's avatar
Felix Paul Kühne committed
236 237 238 239 240
spushd MediaLibraryKit
rm -f External/MobileVLCKit
ln -sf ${framework_build} External/MobileVLCKit
spopd

Felix Paul Kühne's avatar
Felix Paul Kühne committed
241 242 243 244
spopd #ImportedSources

ln -sf ${framework_build} External/MobileVLCKit
ln -sf ${mlkit_build} External/MediaLibraryKit
Felix Paul Kühne's avatar
Felix Paul Kühne committed
245
ln -sf ${upnpx_build} External/upnpx
Carola Nitz's avatar
Carola Nitz committed
246
ln -sf ${gtl_build} External/gtl
Felix Paul Kühne's avatar
Felix Paul Kühne committed
247 248 249 250 251 252 253 254 255

#
# Build time
#

info "Building"

spushd ImportedSources

256 257
spushd VLCKit
echo `pwd`
Felix Paul Kühne's avatar
Felix Paul Kühne committed
258 259 260 261
args=""
if [ "$VERBOSE" = "yes" ]; then
    args="${args} -v"
fi
262
if [ "$PLATFORM" = "iphonesimulator" ]; then
263 264
    args="${args} -s"
fi
265 266
if [ "$NONETWORK" = "yes" ]; then
    args="${args} -n"
267
fi
268 269 270 271
if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
    args="${args} -l"
fi
./buildMobileVLCKit.sh ${args} -k "${SDK}"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
272 273 274 275 276
buildxcodeproj MobileVLCKit "Aggregate static plugins"
buildxcodeproj MobileVLCKit "MobileVLCKit"
spopd

spushd MediaLibraryKit
277
buildxcodeproj MediaLibraryKit
Felix Paul Kühne's avatar
Felix Paul Kühne committed
278 279
spopd

Felix Paul Kühne's avatar
Felix Paul Kühne committed
280 281 282 283
spushd upnpx/projects/xcode4/upnpx
buildxcodeproj upnpx
spopd

284 285 286 287
spushd GDrive
buildxcodeproj GTL "GTLTouchStaticLib"
spopd

Felix Paul Kühne's avatar
Felix Paul Kühne committed
288 289 290 291
spopd # ImportedSources


# Build the Aspen Project now
292
buildxcodeproj "VLC for iOS" "vlc-ios"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
293 294

info "Build completed"