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

set -e

7
PLATFORM=iphoneos
8
SDK=`xcrun --sdk iphoneos --show-sdk-version`
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

Felix Paul Kühne's avatar
Felix Paul Kühne committed
15
TESTEDVLCKITHASH=c6d5d8c3665
Felix Paul Kühne's avatar
Felix Paul Kühne committed
16
TESTEDMEDIALIBRARYKITHASH=f166d94d6
Felix Paul Kühne's avatar
Felix Paul Kühne committed
17
18
19
20

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

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
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})"

Felix Paul Kühne's avatar
Felix Paul Kühne committed
59
60
61
62
63
    local architectures=""
    if [ "$PLATFORM" = "iphonesimulator" ]; then
        architectures="i386 x86_64"
    else
        architectures="armv7 armv7s arm64"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
64
65
66
67
    fi

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

74
75
76
77
78
79
80
81
82
buildxcworkspace()
{
    local target="$2"
    if [ "x$target" = "x" ]; then
    target="$1"
    fi

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

Felix Paul Kühne's avatar
Felix Paul Kühne committed
83
84
85
86
87
    local architectures=""
    if [ "$PLATFORM" = "iphonesimulator" ]; then
        architectures="i386 x86_64"
    else
        architectures="armv7 armv7s arm64"
88
89
90
    fi

    xcodebuild -workspace "$1.xcworkspace" \
91
    -scheme "Pods-vlc-ios" \
92
    -sdk $PLATFORM$SDK \
Felix Paul Kühne's avatar
Felix Paul Kühne committed
93
94
    -configuration ${CONFIGURATION} \
    ARCHS="${architectures}" \
95
96
97
    IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
}

98
while getopts "hvsdnluk:" OPTION
Felix Paul Kühne's avatar
Felix Paul Kühne committed
99
100
101
102
103
104
105
106
107
108
do
     case $OPTION in
         h)
             usage
             exit 1
             ;;
         v)
             VERBOSE=yes
             ;;
         s)
109
             PLATFORM=iphonesimulator
Felix Paul Kühne's avatar
Felix Paul Kühne committed
110
111
112
             ;;
         d)  CONFIGURATION="Debug"
             ;;
113
114
115
         n)
             NONETWORK=yes
             ;;
116
117
118
         l)
             SKIPLIBVLCCOMPILATION=yes
             ;;
Felix Paul Kühne's avatar
Felix Paul Kühne committed
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
         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
149
150
151
rm -rf External
mkdir -p External

Felix Paul Kühne's avatar
Felix Paul Kühne committed
152
153
spushd ImportedSources

154
if [ "$NONETWORK" != "yes" ]; then
Felix Paul Kühne's avatar
Felix Paul Kühne committed
155
if ! [ -e MediaLibraryKit ]; then
156
git clone git://git.videolan.org/MediaLibraryKit.git
157
cd MediaLibraryKit
158
git checkout -B localAspenBranch ${TESTEDMEDIALIBRARYKITHASH}
159
160
161
162
163
git branch --set-upstream-to=origin/master localAspenBranch
cd ..
else
cd MediaLibraryKit
git reset --hard ${TESTEDMEDIALIBRARYKITHASH}
164
cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
165
166
167
fi
if ! [ -e VLCKit ]; then
git clone git://git.videolan.org/vlc-bindings/VLCKit.git
168
cd VLCKit
Felix Paul Kühne's avatar
Felix Paul Kühne committed
169
git reset --hard ${TESTEDVLCKITHASH}
170
171
172
173
cd ..
else
cd VLCKit
git reset --hard ${TESTEDVLCKITHASH}
174
cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
175
fi
176
177
if ! [ -e GDrive ]; then
svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/Source GDrive
178
cd GDrive && patch -p0 < ../../patches/gdrive/upgrade-default-target.patch && cd ..
179
180
else
cd GDrive && svn up && cd ..
181
fi
Carola's avatar
Carola committed
182
if ! [ -e LXReorderableCollectionViewFlowLayout ]; then
183
git clone git://github.com/fkuehne/LXReorderableCollectionViewFlowLayout.git
Carola's avatar
Carola committed
184
185
186
else
cd LXReorderableCollectionViewFlowLayout && git pull --rebase && cd ..
fi
187
if ! [ -e WhiteRaccoon ]; then
188
git clone git://github.com/fkuehne/WhiteRaccoon.git
189
190
else
cd WhiteRaccoon && git pull --rebase && cd ..
191
fi
192
if ! [ -e CocoaHTTPServer ]; then
193
git clone git://github.com/fkuehne/CocoaHTTPServer.git
194
195
else
cd CocoaHTTPServer && git pull --rebase && cd ..
196
fi
Felix Paul Kühne's avatar
Felix Paul Kühne committed
197
198
199
200
201
202
203
204
if ! [ -e Dropbox ]; then
DROPBOXSDKVERSION=1.3.13
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
Felix Paul Kühne's avatar
Felix Paul Kühne committed
205
206
207
208
209
if ! [ -e OneDrive ]; then
git clone git://github.com/liveservices/LiveSDK-for-iOS.git OneDrive
else
cd OneDrive && git pull --rebase && cd ..
fi
210
fi
211

Felix Paul Kühne's avatar
Felix Paul Kühne committed
212
213
info "Setup 'External' folders"

214
if [ "$PLATFORM" = "iphonesimulator" ]; then
215
    xcbuilddir="build/${CONFIGURATION}-iphonesimulator"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
216
else
217
    xcbuilddir="build/${CONFIGURATION}-iphoneos"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
218
219
220
fi
framework_build="${aspen_root_dir}/ImportedSources/VLCKit/${xcbuilddir}"
mlkit_build="${aspen_root_dir}/ImportedSources/MediaLibraryKit/${xcbuilddir}"
Carola's avatar
Carola committed
221
gtl_build="${aspen_root_dir}/ImportedSources/GDrive/${xcbuilddir}"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
222
onedrive_build="${aspen_root_dir}/ImportedSources/OneDrive/src/${xcbuilddir}"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
223
224
225
226
227

spopd #ImportedSources

ln -sf ${framework_build} External/MobileVLCKit
ln -sf ${mlkit_build} External/MediaLibraryKit
Carola's avatar
Carola committed
228
ln -sf ${gtl_build} External/gtl
Felix Paul Kühne's avatar
Felix Paul Kühne committed
229
ln -sf ${onedrive_build} External/OneDrive
Felix Paul Kühne's avatar
Felix Paul Kühne committed
230
231
232
233
234
235
236
237
238

#
# Build time
#

info "Building"

spushd ImportedSources

239
240
spushd VLCKit
echo `pwd`
Felix Paul Kühne's avatar
Felix Paul Kühne committed
241
242
243
244
args=""
if [ "$VERBOSE" = "yes" ]; then
    args="${args} -v"
fi
245
if [ "$PLATFORM" = "iphonesimulator" ]; then
246
247
    args="${args} -s"
fi
248
249
if [ "$NONETWORK" = "yes" ]; then
    args="${args} -n"
250
fi
251
252
253
254
if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
    args="${args} -l"
fi
./buildMobileVLCKit.sh ${args} -k "${SDK}"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
255
256
257
258
259
buildxcodeproj MobileVLCKit "Aggregate static plugins"
buildxcodeproj MobileVLCKit "MobileVLCKit"
spopd

spushd MediaLibraryKit
Felix Paul Kühne's avatar
Felix Paul Kühne committed
260
261
rm -f External/MobileVLCKit
ln -sf ${framework_build} External/MobileVLCKit
262
buildxcodeproj MediaLibraryKit
Felix Paul Kühne's avatar
Felix Paul Kühne committed
263
264
spopd

265
266
267
268
spushd GDrive
buildxcodeproj GTL "GTLTouchStaticLib"
spopd

Felix Paul Kühne's avatar
Felix Paul Kühne committed
269
270
271
272
spushd OneDrive/src
buildxcodeproj LiveSDK "LiveSDK"
spopd

Felix Paul Kühne's avatar
Felix Paul Kühne committed
273
274
spopd # ImportedSources

275
276
277
#install pods
info "installing pods"
pod install
Felix Paul Kühne's avatar
Felix Paul Kühne committed
278
279

# Build the Aspen Project now
Felix Paul Kühne's avatar
Felix Paul Kühne committed
280
buildxcworkspace "VLC for iOS" "VLC for iOS"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
281
282

info "Build completed"