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

set -e

PLATFORM=OS
SDK=iphoneos6.1
SDK_MIN=5.1
VERBOSE=no
11
CONFIGURATION="Release"
12
TESTEDHASH=0d987c72d
13
TESTEDVLCKITHASH=353bbbe1b
14
TESTEDMEDIALIBRARYKITHASH=8c4465a21
Felix Paul Kühne's avatar
Felix Paul Kühne committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112

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
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" \
               -sdk $SDK \
               -configuration ${CONFIGURATION} ${extra} \
               IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
}

while getopts "hvsdk:" OPTION
do
     case $OPTION in
         h)
             usage
             exit 1
             ;;
         v)
             VERBOSE=yes
             ;;
         s)
             PLATFORM=Simulator
             SDK=iphonesimulator6.1
             ;;
         d)  CONFIGURATION="Debug"
             ;;
         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
113 114 115
rm -rf External
mkdir -p External

Felix Paul Kühne's avatar
Felix Paul Kühne committed
116 117 118
spushd ImportedSources

if ! [ -e vlc ]; then
119
git clone git://git.videolan.org/vlc/vlc-2.1.git vlc
Felix Paul Kühne's avatar
Felix Paul Kühne committed
120 121
info "Applying patches to vlc.git"
cd vlc
122
git checkout -B localAspenBranch ${TESTEDHASH}
Felix Paul Kühne's avatar
Felix Paul Kühne committed
123 124 125 126 127 128 129 130 131
git am ../../patches/*.patch
if [ $? -ne 0 ]; then
git am --abort
info "Applying the patches failed, aborting git-am"
exit 1
fi
cd ..
fi
if ! [ -e MediaLibraryKit ]; then
132
git clone git://git.videolan.org/MediaLibraryKit.git
133
cd MediaLibraryKit
134
git checkout -B localAspenBranch ${TESTEDMEDIALIBRARYKITHASH}
135
cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
136 137 138
fi
if ! [ -e VLCKit ]; then
git clone git://git.videolan.org/vlc-bindings/VLCKit.git
139
cd VLCKit
140
git checkout -B localAspenBranch ${TESTEDVLCKITHASH}
141
cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
142 143
fi
if ! [ -e OBSlider ]; then
144
git clone git://github.com/ole/OBSlider.git
Felix Paul Kühne's avatar
Felix Paul Kühne committed
145
fi
Felix Paul Kühne's avatar
Felix Paul Kühne committed
146 147
if ! [ -e GHSidebarNav ]; then
git clone git://github.com/gresrun/GHSidebarNav.git
148 149 150 151 152 153 154 155
cd GHSidebarNav
git am ../../patches/ghsidebarnav/*.patch
if [ $? -ne 0 ]; then
git am --abort
info "Applying the patches failed, aborting git-am"
exit 1
fi
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 159 160 161
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
162 163
cd upnpx && patch -p1 < ${aspen_root_dir}/patches/upnpx/duration-selector-failure.patch
cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
164
fi
165
if ! [ -e WhiteRaccoon ]; then
166
git clone git://github.com/fkuehne/WhiteRaccoon.git
167
fi
168 169
if ! [ -e AQGridView ]; then
git clone git://github.com/AlanQuatermain/AQGridView.git
170 171 172 173 174 175
cd AQGridView
git am ../../patches/aqgridview/*.patch
if [ $? -ne 0 ]; then
git am --abort
info "Applying the patches failed, aborting git-am"
exit 1
176
fi
177 178
cd ..
fi
179 180
if ! [ -e CocoaHTTPServer ]; then
git clone git://github.com/robbiehanson/CocoaHTTPServer.git
181 182 183 184 185 186 187 188
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 ..
189
fi
190 191 192 193 194 195 196 197
if ! [ -e Dropbox ]; then
DROPBOXSDKVERSION=1.3.4
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
198 199
if ! [ -e InAppSettingsKit ]; then
git clone git://github.com/futuretap/InAppSettingsKit.git
200 201 202 203 204 205 206 207
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 ..
208
fi
209

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

if [ "$PLATFORM" = "Simulator" ]; then
213
    xcbuilddir="build/${CONFIGURATION}-iphonesimulator"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
214
else
215
    xcbuilddir="build/${CONFIGURATION}-iphoneos"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
216 217 218
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
219
upnpx_build="${aspen_root_dir}/ImportedSources/upnpx/projects/xcode4/upnpx/${xcbuilddir}"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
220

Felix Paul Kühne's avatar
Felix Paul Kühne committed
221 222 223 224 225
spushd MediaLibraryKit
rm -f External/MobileVLCKit
ln -sf ${framework_build} External/MobileVLCKit
spopd

Felix Paul Kühne's avatar
Felix Paul Kühne committed
226 227 228 229
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
230
ln -sf ${upnpx_build} External/upnpx
Felix Paul Kühne's avatar
Felix Paul Kühne committed
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245

#
# Build time
#

info "Building"

spushd ImportedSources

spushd vlc/extras/package/ios
info "Building vlc"
args=""
if [ "$VERBOSE" = "yes" ]; then
    args="${args} -v"
fi
246 247 248 249 250 251 252
if [ "$PLATFORM" = "Simulator" ]; then
    args="${args} -s"
    ./build.sh ${args} -k "${SDK}"
else
    ./build.sh -a armv7 ${args} -k "${SDK}" && ./build.sh -a armv7s ${args} -k "${SDK}"
fi

Felix Paul Kühne's avatar
Felix Paul Kühne committed
253 254 255 256 257 258 259 260
spopd

spushd VLCKit
buildxcodeproj MobileVLCKit "Aggregate static plugins"
buildxcodeproj MobileVLCKit "MobileVLCKit"
spopd

spushd MediaLibraryKit
261
buildxcodeproj MediaLibraryKit
Felix Paul Kühne's avatar
Felix Paul Kühne committed
262 263
spopd

Felix Paul Kühne's avatar
Felix Paul Kühne committed
264 265 266 267
spushd upnpx/projects/xcode4/upnpx
buildxcodeproj upnpx
spopd

Felix Paul Kühne's avatar
Felix Paul Kühne committed
268 269 270 271
spopd # ImportedSources


# Build the Aspen Project now
272
buildxcodeproj "VLC for iOS" "vlc-ios"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
273 274

info "Build completed"