compileVLCforiOS.sh 4.48 KB
Newer Older
Felix Paul Kühne's avatar
Felix Paul Kühne committed
1 2
#!/bin/sh
# Copyright (C) Pierre d'Herbemont, 2010
Felix Paul Kühne's avatar
Felix Paul Kühne committed
3
# Copyright (C) Felix Paul Kühne, 2012-2015
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`
Felix Paul Kühne's avatar
Felix Paul Kühne committed
9
SDK_MIN=7.0
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=da580de6
Felix Paul Kühne's avatar
Felix Paul Kühne committed
16
TESTEDMEDIALIBRARYKITHASH=e5ca039f
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
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"
}

50 51 52 53 54 55 56 57 58
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
59 60 61 62 63
    local architectures=""
    if [ "$PLATFORM" = "iphonesimulator" ]; then
        architectures="i386 x86_64"
    else
        architectures="armv7 armv7s arm64"
64 65 66
    fi

    xcodebuild -workspace "$1.xcworkspace" \
67
    -scheme "Pods-vlc-ios" \
68
    -sdk $PLATFORM$SDK \
Felix Paul Kühne's avatar
Felix Paul Kühne committed
69 70
    -configuration ${CONFIGURATION} \
    ARCHS="${architectures}" \
71 72 73
    IPHONEOS_DEPLOYMENT_TARGET=${SDK_MIN} > ${out}
}

74
while getopts "hvsdnluk:" OPTION
Felix Paul Kühne's avatar
Felix Paul Kühne committed
75 76 77 78 79 80 81 82 83 84
do
     case $OPTION in
         h)
             usage
             exit 1
             ;;
         v)
             VERBOSE=yes
             ;;
         s)
85
             PLATFORM=iphonesimulator
Felix Paul Kühne's avatar
Felix Paul Kühne committed
86 87 88
             ;;
         d)  CONFIGURATION="Debug"
             ;;
89 90 91
         n)
             NONETWORK=yes
             ;;
92 93 94
         l)
             SKIPLIBVLCCOMPILATION=yes
             ;;
Felix Paul Kühne's avatar
Felix Paul Kühne committed
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

info "Preparing build dirs"

mkdir -p ImportedSources

spushd ImportedSources

122
if [ "$NONETWORK" != "yes" ]; then
Felix Paul Kühne's avatar
Felix Paul Kühne committed
123
if ! [ -e MediaLibraryKit ]; then
Felix Paul Kühne's avatar
Felix Paul Kühne committed
124
git clone http://code.videolan.org/videolan/MediaLibraryKit.git
125
cd MediaLibraryKit
126
# git reset --hard ${TESTEDMEDIALIBRARYKITHASH}
127 128 129
cd ..
else
cd MediaLibraryKit
130
git pull --rebase
131
# git reset --hard ${TESTEDMEDIALIBRARYKITHASH}
132
cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
133 134
fi
if ! [ -e VLCKit ]; then
Felix Paul Kühne's avatar
Felix Paul Kühne committed
135
git clone http://code.videolan.org/videolan/VLCKit.git
136
cd VLCKit
137
# git reset --hard ${TESTEDVLCKITHASH}
138 139 140
cd ..
else
cd VLCKit
141
git pull --rebase
142
# git reset --hard ${TESTEDVLCKITHASH}
143
cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
144
fi
145 146
if ! [ -e GDrive ]; then
svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/Source GDrive
147
cd GDrive
148
patch -p0 < ../../patches/gdrive/fix-target.patch
149
cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
150
cd GDrive/HTTPFetcher && patch -p0 < ../../../patches/gdrive/httpfetcher-compilation-fix.diff && cd ../..
151 152
else
cd GDrive && svn up && cd ..
153
fi
154
if ! [ -e LXReorderableCollectionViewFlowLayout ]; then
155
git clone git://github.com/fkuehne/LXReorderableCollectionViewFlowLayout.git
156 157 158
else
cd LXReorderableCollectionViewFlowLayout && git pull --rebase && cd ..
fi
159
if ! [ -e WhiteRaccoon ]; then
160
git clone git://github.com/fkuehne/WhiteRaccoon.git
161 162
else
cd WhiteRaccoon && git pull --rebase && cd ..
163
fi
164
if ! [ -e CocoaHTTPServer ]; then
165
git clone git://github.com/fkuehne/CocoaHTTPServer.git
166 167
else
cd CocoaHTTPServer && git pull --rebase && cd ..
168
fi
Felix Paul Kühne's avatar
Felix Paul Kühne committed
169 170
if ! [ -e Dropbox ]; then
DROPBOXSDKVERSION=1.3.13
171
curl -L -O https://www.dropbox.com/static/developers/dropbox-ios-sdk-${DROPBOXSDKVERSION}.zip
Felix Paul Kühne's avatar
Felix Paul Kühne committed
172 173 174 175 176
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
177 178
if ! [ -e OneDrive ]; then
git clone git://github.com/liveservices/LiveSDK-for-iOS.git OneDrive
Felix Paul Kühne's avatar
Felix Paul Kühne committed
179
cd OneDrive && git am ../../patches/onedrive/*.patch && cd ..
Felix Paul Kühne's avatar
Felix Paul Kühne committed
180 181 182
else
cd OneDrive && git pull --rebase && cd ..
fi
183
fi
184

Felix Paul Kühne's avatar
Felix Paul Kühne committed
185 186 187 188 189 190 191 192 193 194
spopd #ImportedSources

#
# Build time
#

info "Building"

spushd ImportedSources

195 196
spushd VLCKit
echo `pwd`
Felix Paul Kühne's avatar
Felix Paul Kühne committed
197 198 199 200
args=""
if [ "$VERBOSE" = "yes" ]; then
    args="${args} -v"
fi
201 202
if [ "$NONETWORK" = "yes" ]; then
    args="${args} -n"
203
fi
204 205 206 207
if [ "$SKIPLIBVLCCOMPILATION" = "yes" ]; then
    args="${args} -l"
fi
./buildMobileVLCKit.sh ${args} -k "${SDK}"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
208 209
spopd

Felix Paul Kühne's avatar
Felix Paul Kühne committed
210 211
spopd # ImportedSources

212 213 214
#install pods
info "installing pods"
pod install
Felix Paul Kühne's avatar
Felix Paul Kühne committed
215

Felix Paul Kühne's avatar
Felix Paul Kühne committed
216
# Build the VLC for iOS workspace now
Felix Paul Kühne's avatar
Felix Paul Kühne committed
217
buildxcworkspace "VLC for iOS" "VLC for iOS"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
218 219

info "Build completed"