compileVLCforiOS.sh 7.86 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
Felix Paul Kühne's avatar
Felix Paul Kühne committed
8
SDK=7.1
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
UNSTABLEVLCKIT=yes
15

Felix Paul Kühne's avatar
Felix Paul Kühne committed
16
TESTEDVLCKITHASH=766c3b7fa
17
TESTEDUNSTABLEVLCKITHASH=5b4f892cf
18
TESTEDMEDIALIBRARYKITHASH=e6b613478
Felix Paul Kühne's avatar
Felix Paul Kühne committed
19
TESTEDQUINCYKITHASH=f1d93b96b
Felix Paul Kühne's avatar
Felix Paul Kühne committed
20 21 22 23

usage()
{
cat << EOF
24
usage: $0 [-s] [-v] [-k sdk] [-d] [-n] [-l] [-u]
Felix Paul Kühne's avatar
Felix Paul Kühne committed
25 26 27 28 29 30

OPTIONS
   -k       Specify which sdk to use (see 'xcodebuild -showsdks', current: ${SDK})
   -v       Be more verbose
   -s       Build for simulator
   -d       Enable Debug
31
   -n       Skip script steps requiring network interaction
32
   -l       Skip libvlc compilation
33
   -u       Compile unstable version of MobileVLCKit
Felix Paul Kühne's avatar
Felix Paul Kühne committed
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 66 67 68 69
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" \
70
               -sdk $PLATFORM$SDK \
Felix Paul Kühne's avatar
Felix Paul Kühne committed
71 72 73 74
               -configuration ${CONFIGURATION} ${extra} \
               IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
}

75
while getopts "hvsdnluk:" OPTION
Felix Paul Kühne's avatar
Felix Paul Kühne committed
76 77 78 79 80 81 82 83 84 85
do
     case $OPTION in
         h)
             usage
             exit 1
             ;;
         v)
             VERBOSE=yes
             ;;
         s)
86
             PLATFORM=iphonesimulator
Felix Paul Kühne's avatar
Felix Paul Kühne committed
87 88 89
             ;;
         d)  CONFIGURATION="Debug"
             ;;
90 91 92
         n)
             NONETWORK=yes
             ;;
93 94 95
         l)
             SKIPLIBVLCCOMPILATION=yes
             ;;
Felix Paul Kühne's avatar
Felix Paul Kühne committed
96 97 98
         k)
             SDK=$OPTARG
             ;;
99
         u)
100
             UNSTABLEVLCKIT=no
101
             ;;
Felix Paul Kühne's avatar
Felix Paul Kühne committed
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
         ?)
             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
129 130 131
rm -rf External
mkdir -p External

Felix Paul Kühne's avatar
Felix Paul Kühne committed
132 133
spushd ImportedSources

134
if [ "$NONETWORK" != "yes" ]; then
Felix Paul Kühne's avatar
Felix Paul Kühne committed
135
if ! [ -e MediaLibraryKit ]; then
136
git clone git://git.videolan.org/MediaLibraryKit.git
137
cd MediaLibraryKit
138
git checkout -B localAspenBranch ${TESTEDMEDIALIBRARYKITHASH}
139 140 141 142 143
git branch --set-upstream-to=origin/master localAspenBranch
cd ..
else
cd MediaLibraryKit
git reset --hard ${TESTEDMEDIALIBRARYKITHASH}
144
cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
145
fi
146
if [ "$UNSTABLEVLCKIT" = "no" ]; then
Felix Paul Kühne's avatar
Felix Paul Kühne committed
147 148
if ! [ -e VLCKit ]; then
git clone git://git.videolan.org/vlc-bindings/VLCKit.git
149
cd VLCKit
Felix Paul Kühne's avatar
Felix Paul Kühne committed
150 151
git checkout 2.1-stable
git reset --hard ${TESTEDVLCKITHASH}
152 153 154 155
cd ..
else
cd VLCKit
git reset --hard ${TESTEDVLCKITHASH}
156
cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
157
fi
158 159 160
else
if ! [ -e VLCKit ]; then
git clone git://git.videolan.org/vlc-bindings/VLCKit.git
161 162 163
cd VLCKit
git reset --hard ${TESTEDUNSTABLEVLCKITHASH}
cd ..
164
else
165 166 167
cd VLCKit
git reset --hard ${TESTEDUNSTABLEVLCKITHASH}
cd ..
168 169
fi
fi
Felix Paul Kühne's avatar
Felix Paul Kühne committed
170
if ! [ -e OBSlider ]; then
171
git clone git://github.com/ole/OBSlider.git
172 173
else
cd OBSlider && git pull --rebase && cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
174
fi
Felix Paul Kühne's avatar
Felix Paul Kühne committed
175 176
if ! [ -e DAVKit ]; then
git clone git://github.com/mattrajca/DAVKit.git
177 178
else
cd DAVKit && git pull --rebase && cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
179
fi
180 181 182 183 184 185 186 187 188 189 190 191 192 193
if ! [ -e PLCrashReporter ]; then
git clone https://opensource.plausible.coop/stash/scm/plcr/plcrashreporter.git PLCrashReporter
cd PLCrashReporter
git am ../../patches/plcrashreporter/*.patch
if [ $? -ne 0 ]; then
git am --abort
info "Applying the patches failed, aborting git-am"
exit 1
fi
cd ..
fi
if ! [ -e QuincyKit ]; then
git clone git://github.com/TheRealKerni/QuincyKit.git
cd QuincyKit
Felix Paul Kühne's avatar
Felix Paul Kühne committed
194 195
git checkout -B localAspenBranch ${TESTEDQUINCYKITHASH}
git branch --set-upstream-to=origin/master localAspenBranch
196 197 198 199 200 201 202 203
git am ../../patches/quincykit/*.patch
if [ $? -ne 0 ]; then
git am --abort
info "Applying the patches failed, aborting git-am"
exit 1
fi
cd ..
fi
204 205
if ! [ -e GDrive ]; then
svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/Source GDrive
206
cd GDrive && patch -p0 < ../../patches/gdrive/upgrade-default-target.patch && cd ..
207 208
else
cd GDrive && svn up && cd ..
209
fi
Felix Paul Kühne's avatar
Felix Paul Kühne committed
210 211
if ! [ -e GHSidebarNav ]; then
git clone git://github.com/gresrun/GHSidebarNav.git
212 213
else
cd GHSidebarNav && git pull --rebase && cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
214
fi
215
if ! [ -e LXReorderableCollectionViewFlowLayout ]; then
216
git clone git://github.com/lxcid/LXReorderableCollectionViewFlowLayout.git
217 218 219 220 221 222 223 224 225 226 227
cd LXReorderableCollectionViewFlowLayout
git am ../../patches/lxreorderablecollectionviewflowlayout/*.patch
if [ $? -ne 0 ]; then
git am --abort
info "Applying the patches failed, aborting git-am"
exit 1
fi
cd ..
else
cd LXReorderableCollectionViewFlowLayout && git pull --rebase && cd ..
fi
Felix Paul Kühne's avatar
Felix Paul Kühne committed
228
if ! [ -e upnpx ]; then
229 230 231
git clone git://github.com/fkuehne/upnpx.git
else
cd upnpx && git pull --rebase && cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
232
fi
233
if ! [ -e WhiteRaccoon ]; then
234
git clone git://github.com/fkuehne/WhiteRaccoon.git
235 236
else
cd WhiteRaccoon && git pull --rebase && cd ..
237
fi
238 239
if ! [ -e CocoaHTTPServer ]; then
git clone git://github.com/robbiehanson/CocoaHTTPServer.git
240 241 242 243 244 245 246 247
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 ..
248 249
else
cd CocoaHTTPServer && git pull --rebase && cd ..
250
fi
251
if ! [ -e Dropbox ]; then
Felix Paul Kühne's avatar
Felix Paul Kühne committed
252
DROPBOXSDKVERSION=1.3.9
253 254 255 256 257 258
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
259 260
if ! [ -e InAppSettingsKit ]; then
git clone git://github.com/futuretap/InAppSettingsKit.git
261 262
else
cd WhiteRaccoon && git pull --rebase && cd ..
263
fi
264
fi
265

Felix Paul Kühne's avatar
Felix Paul Kühne committed
266 267
info "Setup 'External' folders"

268
if [ "$PLATFORM" = "iphonesimulator" ]; then
269
    xcbuilddir="build/${CONFIGURATION}-iphonesimulator"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
270
else
271
    xcbuilddir="build/${CONFIGURATION}-iphoneos"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
272 273 274
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
275
upnpx_build="${aspen_root_dir}/ImportedSources/upnpx/projects/xcode4/upnpx/${xcbuilddir}"
Carola Nitz's avatar
Carola Nitz committed
276
gtl_build="${aspen_root_dir}/ImportedSources/GDrive/${xcbuilddir}"
277 278
plcrashreporter_build="${aspen_root_dir}/ImportedSources/PLCrashReporter/${xcbuilddir}"
quincykit_build="${aspen_root_dir}/ImportedSources/QuincyKit/client/iOS/QuincyLib/${xcbuilddir}"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
279 280 281 282 283

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
284
ln -sf ${upnpx_build} External/upnpx
Carola Nitz's avatar
Carola Nitz committed
285
ln -sf ${gtl_build} External/gtl
286 287
ln -sf ${plcrashreporter_build} External/PLCrashReporter
ln -sf ${quincykit_build} External/QuincyKit
Felix Paul Kühne's avatar
Felix Paul Kühne committed
288 289 290 291 292 293 294 295 296

#
# Build time
#

info "Building"

spushd ImportedSources

297 298
spushd VLCKit
echo `pwd`
Felix Paul Kühne's avatar
Felix Paul Kühne committed
299 300 301 302
args=""
if [ "$VERBOSE" = "yes" ]; then
    args="${args} -v"
fi
303
if [ "$PLATFORM" = "iphonesimulator" ]; then
304 305
    args="${args} -s"
fi
306 307
if [ "$NONETWORK" = "yes" ]; then
    args="${args} -n"
308
fi
309 310 311 312
if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
    args="${args} -l"
fi
./buildMobileVLCKit.sh ${args} -k "${SDK}"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
313 314 315 316 317
buildxcodeproj MobileVLCKit "Aggregate static plugins"
buildxcodeproj MobileVLCKit "MobileVLCKit"
spopd

spushd MediaLibraryKit
Felix Paul Kühne's avatar
Felix Paul Kühne committed
318 319
rm -f External/MobileVLCKit
ln -sf ${framework_build} External/MobileVLCKit
320
buildxcodeproj MediaLibraryKit
Felix Paul Kühne's avatar
Felix Paul Kühne committed
321 322
spopd

Felix Paul Kühne's avatar
Felix Paul Kühne committed
323 324 325 326
spushd upnpx/projects/xcode4/upnpx
buildxcodeproj upnpx
spopd

327 328 329 330
spushd GDrive
buildxcodeproj GTL "GTLTouchStaticLib"
spopd

331 332 333 334 335 336 337 338 339 340 341 342
spushd PLCrashReporter
if [ "$PLATFORM" = "iphonesimulator" ]; then
    buildxcodeproj CrashReporter "CrashReporter-iOS-Simulator"
else
    buildxcodeproj CrashReporter "CrashReporter-iOS-Device"
fi
spopd

spushd QuincyKit/client/iOS/QuincyLib
buildxcodeproj QuincyLib
spopd

Felix Paul Kühne's avatar
Felix Paul Kühne committed
343 344 345 346
spopd # ImportedSources


# Build the Aspen Project now
347
buildxcodeproj "VLC for iOS" "vlc-ios"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
348 349

info "Build completed"