build-vlc.sh 5.26 KB
Newer Older
1
#!/bin/sh
2
set -e
3

4 5 6 7 8 9
info()
{
    local green="\033[1;32m"
    local normal="\033[0m"
    echo "[${green}build${normal}] $1"
}
10

11
OSX_VERSION="10.9"
12 13 14
ARCH="x86_64"
MINIMAL_OSX_VERSION="10.6"
SDKROOT=`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_VERSION.sdk
15
UNSTABLE=no
16 17 18 19 20 21 22

usage()
{
cat << EOF
usage: $0 [-v] [-d]

OPTIONS
23
   -v            Be more verbose
24
   -u            Use unstable libvlc
25 26
   -k <sdk>      Use the specified sdk (default: $SDKROOT for $ARCH)
   -a <arch>     Use the specified arch (default: $ARCH)
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
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"
}

47
while getopts "hvua:k:" OPTION
48 49 50 51 52 53 54 55 56
do
     case $OPTION in
         h)
             usage
             exit 1
             ;;
         v)
             VERBOSE=yes
             ;;
57 58 59
         u)
             UNSTABLE=yes
             ;;
60 61 62 63 64
         a)
             ARCH=$OPTARG
             ;;
         k)
             SDKROOT=$OPTARG
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
             ;;
         ?)
             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

84 85 86 87
if [ "$ARCH" = "i686" ]; then
    MINIMAL_OSX_VERSION="10.5"
fi

88 89 90
export OSX_VERSION
export SDKROOT

91 92 93 94 95 96 97 98 99 100 101 102
# Get root dir
spushd .
npapi_root_dir=`pwd`
spopd

info $npapi_root_dir

info "Preparing build dirs"

spushd extras/macosx

if ! [ -e vlc ]; then
103
if [ "$UNSTABLE" = "yes" ]; then
104
git clone git://git.videolan.org/vlc.git vlc
105 106 107
else
git clone git://git.videolan.org/vlc/vlc-2.2.git vlc
fi
108 109 110 111 112 113 114 115
fi

spopd #extras/macosx

#
# Build time
#

116 117
export PATH="${npapi_root_dir}/extras/macosx/vlc/extras/tools/build/bin:${npapi_root_dir}/extras/macosx/contrib/${ARCH}-apple-darwin10/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"

118 119 120 121 122 123 124
info "Building tools"
spushd extras/macosx/vlc/extras/tools
if ! [ -e build ]; then
./bootstrap && make
fi
spopd

125 126 127 128
info "Fetching contrib"

spushd extras/macosx/vlc/contrib

129 130
if ! [ -e ${ARCH}-npapi ]; then
mkdir ${ARCH}-npapi
131
fi
132
cd ${ARCH}-npapi
133
../bootstrap --build=${ARCH}-apple-darwin10 \
134 135
 --disable-sout --disable-cddb --disable-bluray --disable-sdl \
 --disable-sparkle --disable-bghudappkit --disable-growl --disable-goom \
136 137
 --disable-SDL_image --disable-lua --disable-chromaprint \
 --disable-caca --disable-upnp --disable-vncserver \
138
 --disable-ncurses --disable-protobuf
139
make fetch
140 141
core_count=`sysctl -n machdep.cpu.core_count`
make .gettext && AUTOPOINT=true make -j $core_count
142 143 144 145 146 147

spopd

export CC="xcrun clang"
export CXX="xcrun clang++"
export OBJC="xcrun clang"
148
PREFIX="${npapi_root_dir}/extras/macosx/vlc/${ARCH}-install"
149

150
info "Configuring VLC"
151 152 153 154 155 156 157 158 159

if ! [ -e ${PREFIX} ]; then
    mkdir ${PREFIX}
fi

spushd extras/macosx/vlc
if ! [ -e configure ]; then
    ./bootstrap > ${out}
fi
160 161
if ! [ -e ${ARCH}-build ]; then
    mkdir ${ARCH}-build
162
fi
163 164 165 166 167 168 169

CONFIG_OPTIONS=""
if [ "$ARCH" = "i686" ]; then
    CONFIG_OPTIONS="--disable-vda"
    export LDFLAGS="-Wl,-read_only_relocs,suppress"
fi

170
cd ${ARCH}-build
171
../configure \
172
        --build=${ARCH}-apple-darwin10 \
173
        --disable-lua --disable-httpd --disable-vlm --disable-sout \
174
        --disable-vcd --enable-dvdnav --enable-dvdread --disable-screen \
175
        --disable-debug \
176
        --disable-macosx \
177 178
        --disable-notify \
        --disable-projectm \
179
        --disable-growl \
180
        --disable-faad \
181
        --disable-bluray \
182 183 184
        --enable-flac \
        --enable-theora \
        --enable-shout \
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
185 186
        --disable-ncurses \
        --disable-twolame \
187
        --enable-a52 \
188 189
        --enable-realrtsp \
        --enable-libass \
190 191
        --disable-macosx-avfoundation \
        --disable-macosx-dialog-provider \
192
        --disable-macosx-eyetv \
193
        --disable-macosx-qtkit \
194
        --disable-macosx-quartztext \
195
        --disable-macosx-vlc-app \
196 197 198 199 200 201 202 203
        --disable-skins2 \
        --disable-xcb \
        --disable-caca \
        --disable-sdl \
        --disable-samplerate \
        --disable-upnp \
        --disable-goom \
        --disable-nls \
204
        --disable-mad \
205 206
        --disable-sdl \
        --disable-sdl-image \
207
        --with-macosx-sdk=$SDKROOT \
208
        --with-macosx-version-min=${MINIMAL_OSX_VERSION} \
209
        ${CONFIG_OPTIONS} \
210 211
        --prefix=${PREFIX} > ${out}

212
info "Compiling VLC"
213 214 215 216 217 218 219 220 221 222 223 224 225 226

CORE_COUNT=`sysctl -n machdep.cpu.core_count`
let MAKE_JOBS=$CORE_COUNT+1

if [ "$VERBOSE" = "yes" ]; then
    make V=1 -j$MAKE_JOBS > ${out}
else
    make -j$MAKE_JOBS > ${out}
fi

info "Installing VLC"
make install > ${out}
cd ..

227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
info "Removing unneeded modules"
blacklist="
stats
access_bd
shm
access_imem
oldrc
real
hotkeys
gestures
sap
dynamicoverlay
rss
ball
magnify
audiobargraph_
clone
mosaic
osdmenu
puzzle
mediadirs
t140
ripple
motion
sharpen
grain
posterize
mirror
wall
scene
blendbench
psychedelic
alphamask
netsync
audioscrobbler
motiondetect
motionblur
export
smf
podcast
bluescreen
erase
stream_filter_record
speex_resampler
remoteosd
magnify
gradient
logger
visual
fb
aout_file
dummy
invert
sepia
wave
hqdn3d
headphone_channel_mixer
gaussianblur
gradfun
extract
colorthres
antiflicker
anaglyph
remap
"

for i in ${blacklist}
do
    find ${PREFIX}/lib/vlc/plugins -name *$i* -type f -exec rm '{}' \;
done
297 298 299 300

spopd

info "Build completed"