build-vlc.sh 4.06 KB
Newer Older
1 2
#!/bin/sh

3 4 5
OSX_VERSION="10.7"
SDKROOT=`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$OSX_VERSION.sdk

6 7 8 9 10 11 12 13 14 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
set -e

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

OPTIONS
   -v       Be more verbose
   -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"
}

while getopts "hvsdk:" OPTION
do
     case $OPTION in
         h)
             usage
             exit 1
             ;;
         v)
             VERBOSE=yes
             ;;
         d)  CONFIGURATION="--enable-debug"
             ;;
         ?)
             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

66 67 68
export OSX_VERSION
export SDKROOT

69 70 71 72 73 74 75 76 77 78 79 80
# Get root dir
spushd .
npapi_root_dir=`pwd`
spopd

info $npapi_root_dir

info "Preparing build dirs"

spushd extras/macosx

if ! [ -e vlc ]; then
81
git clone git://git.videolan.org/vlc.git vlc
82 83 84 85 86 87 88 89
fi

spopd #extras/macosx

#
# Build time
#

90 91 92 93 94 95 96
info "Building tools"
spushd extras/macosx/vlc/extras/tools
if ! [ -e build ]; then
./bootstrap && make
fi
spopd

97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
info "Fetching contrib"

spushd extras/macosx/vlc/contrib

if ! [ -e 64bit-npapi ]; then
mkdir 64bit-npapi
cd 64bit-npapi
../bootstrap --build=x86_64-apple-darwin10
make prebuilt
fi

spopd

export CC="xcrun clang"
export CXX="xcrun clang++"
export OBJC="xcrun clang"
PREFIX="${npapi_root_dir}/extras/macosx/vlc/64bit_install_dir"

115
info "Configuring VLC"
116 117 118 119 120 121 122 123 124

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

spushd extras/macosx/vlc
if ! [ -e configure ]; then
    ./bootstrap > ${out}
fi
125 126
if ! [ -e 64bit-build ]; then
    mkdir 64bit-build
127
fi
128
cd 64bit-build
129 130 131 132 133 134 135 136 137 138 139
../configure \
        --build=x86_64-apple-darwin10 \
        --disable-lua --disable-httpd --disable-vlm --disable-sout \
        --disable-vcd --disable-dvdnav --disable-dvdread --disable-screen \
        --disable-macosx \
        --enable-merge-ffmpeg \
        --disable-growl \
        --enable-faad \
        --enable-flac \
        --enable-theora \
        --enable-shout \
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
140 141
        --disable-ncurses \
        --disable-twolame \
142 143 144 145
        --enable-realrtsp \
        --enable-libass \
        --enable-macosx-audio \
        --disable-macosx-eyetv \
146 147
        --disable-macosx-qtkit \
        --disable-macosx-avfoundation \
148
        --disable-macosx-quartztext \
149 150 151 152 153 154 155 156 157 158 159 160
        --enable-macosx-vout \
        --disable-skins2 \
        --disable-xcb \
        --disable-caca \
        --disable-sdl \
        --disable-samplerate \
        --disable-upnp \
        --disable-goom \
        --disable-macosx-dialog-provider \
        --disable-nls \
        --disable-sdl \
        --disable-sdl-image \
161
        --disable-macosx-vlc-app \
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
162
        --disable-dirac \
163 164
        --enable-coregraphicslayer-vout \
        --with-macosx-sdk=$SDKROOT \
165
        --with-macosx-version-min=10.6 \
166 167
        --prefix=${PREFIX} > ${out}

168
info "Compiling VLC"
169 170 171 172 173 174 175 176 177 178 179 180 181 182

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 ..

183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
find ${PREFIX}/lib/vlc/plugins -name *.dylib -type f -exec cp '{}' ${PREFIX}/lib/vlc/plugins \;

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
yuv
dummy
invert
sepia
wave
hqdn3d
headphone_channel_mixer
gaussianblur
gradfun
extract
colorthres
antiflicker
anaglyph
remap
250
bluray
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
251
x264
252 253 254 255 256 257
"

for i in ${blacklist}
do
    find ${PREFIX}/lib/vlc/plugins -name *$i* -type f -exec rm '{}' \;
done
258 259 260 261

spopd

info "Build completed"