compileVLCforiOS.sh 5.26 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

15
TESTEDVLCKITHASH=32c449e37b
Carola's avatar
Carola committed
16
TESTEDMEDIALIBRARYKITHASH=2d98d90aa
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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
buildxcworkspace()
{
    local target="$2"
    if [ "x$target" = "x" ]; then
    target="$1"
    fi

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

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

    xcodebuild -workspace "$1.xcworkspace" \
86
    -scheme "Pods-vlc-ios" \
87
88
89
90
91
    -sdk $PLATFORM$SDK \
    -configuration ${CONFIGURATION} ${extra} \
    IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
}

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

Felix Paul Kühne's avatar
Felix Paul Kühne committed
146
147
spushd ImportedSources

148
if [ "$NONETWORK" != "yes" ]; then
Felix Paul Kühne's avatar
Felix Paul Kühne committed
149
if ! [ -e MediaLibraryKit ]; then
150
git clone git://git.videolan.org/MediaLibraryKit.git
151
cd MediaLibraryKit
152
git checkout -B localAspenBranch ${TESTEDMEDIALIBRARYKITHASH}
153
154
155
156
157
git branch --set-upstream-to=origin/master localAspenBranch
cd ..
else
cd MediaLibraryKit
git reset --hard ${TESTEDMEDIALIBRARYKITHASH}
158
cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
159
160
161
fi
if ! [ -e VLCKit ]; then
git clone git://git.videolan.org/vlc-bindings/VLCKit.git
162
cd VLCKit
Felix Paul Kühne's avatar
Felix Paul Kühne committed
163
git reset --hard ${TESTEDVLCKITHASH}
164
165
166
167
cd ..
else
cd VLCKit
git reset --hard ${TESTEDVLCKITHASH}
168
cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
169
fi
170
171
if ! [ -e GDrive ]; then
svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/Source GDrive
172
cd GDrive && patch -p0 < ../../patches/gdrive/upgrade-default-target.patch && cd ..
173
174
else
cd GDrive && svn up && cd ..
175
fi
Carola's avatar
Carola committed
176
if ! [ -e LXReorderableCollectionViewFlowLayout ]; then
177
git clone git://github.com/fkuehne/LXReorderableCollectionViewFlowLayout.git
Carola's avatar
Carola committed
178
179
180
else
cd LXReorderableCollectionViewFlowLayout && git pull --rebase && cd ..
fi
181
if ! [ -e WhiteRaccoon ]; then
182
git clone git://github.com/fkuehne/WhiteRaccoon.git
183
184
else
cd WhiteRaccoon && git pull --rebase && cd ..
185
fi
186
if ! [ -e CocoaHTTPServer ]; then
187
git clone git://github.com/fkuehne/CocoaHTTPServer.git
188
189
else
cd CocoaHTTPServer && git pull --rebase && cd ..
190
fi
191
fi
192

Felix Paul Kühne's avatar
Felix Paul Kühne committed
193
194
info "Setup 'External' folders"

195
if [ "$PLATFORM" = "iphonesimulator" ]; then
196
    xcbuilddir="build/${CONFIGURATION}-iphonesimulator"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
197
else
198
    xcbuilddir="build/${CONFIGURATION}-iphoneos"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
199
200
201
fi
framework_build="${aspen_root_dir}/ImportedSources/VLCKit/${xcbuilddir}"
mlkit_build="${aspen_root_dir}/ImportedSources/MediaLibraryKit/${xcbuilddir}"
Carola's avatar
Carola committed
202
gtl_build="${aspen_root_dir}/ImportedSources/GDrive/${xcbuilddir}"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
203
204
205
206
207

spopd #ImportedSources

ln -sf ${framework_build} External/MobileVLCKit
ln -sf ${mlkit_build} External/MediaLibraryKit
Carola's avatar
Carola committed
208
ln -sf ${gtl_build} External/gtl
Felix Paul Kühne's avatar
Felix Paul Kühne committed
209
210
211
212
213
214
215
216
217

#
# Build time
#

info "Building"

spushd ImportedSources

218
219
spushd VLCKit
echo `pwd`
Felix Paul Kühne's avatar
Felix Paul Kühne committed
220
221
222
223
args=""
if [ "$VERBOSE" = "yes" ]; then
    args="${args} -v"
fi
224
if [ "$PLATFORM" = "iphonesimulator" ]; then
225
226
    args="${args} -s"
fi
227
228
if [ "$NONETWORK" = "yes" ]; then
    args="${args} -n"
229
fi
230
231
232
233
if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
    args="${args} -l"
fi
./buildMobileVLCKit.sh ${args} -k "${SDK}"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
234
235
236
237
238
buildxcodeproj MobileVLCKit "Aggregate static plugins"
buildxcodeproj MobileVLCKit "MobileVLCKit"
spopd

spushd MediaLibraryKit
Felix Paul Kühne's avatar
Felix Paul Kühne committed
239
240
rm -f External/MobileVLCKit
ln -sf ${framework_build} External/MobileVLCKit
241
buildxcodeproj MediaLibraryKit
Felix Paul Kühne's avatar
Felix Paul Kühne committed
242
243
spopd

244
245
246
247
spushd GDrive
buildxcodeproj GTL "GTLTouchStaticLib"
spopd

Felix Paul Kühne's avatar
Felix Paul Kühne committed
248
249
spopd # ImportedSources

250
251
252
#install pods
info "installing pods"
pod install
Felix Paul Kühne's avatar
Felix Paul Kühne committed
253
254

# Build the Aspen Project now
Felix Paul Kühne's avatar
Felix Paul Kühne committed
255
buildxcworkspace "VLC for iOS" "VLC for iOS"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
256
257

info "Build completed"