compile.sh 3.29 KB
Newer Older
Rémi Duraffort's avatar
Rémi Duraffort committed
1 2
#! /bin/sh

Rafaël Carré's avatar
Rafaël Carré committed
3 4 5 6 7 8 9 10 11
# Read the Android HOWTO and setup all that stuff correctly.
# Get the Android SDK Platform 2.1, 2.2 and 2.3 API : version 7, 8 and (9 or 10)
# or modify numbers in configure.sh and vlc-android/default.properties.
# Create an AVD with this platform.

# XXX : important!
# If you plan to use the emulator, you need a build without neon
# export NO_NEON=1
# make sure it is set for both the contribs bootstrap next and the configure.sh later.
Rémi Duraffort's avatar
Rémi Duraffort committed
12 13

if [ -z "$ANDROID_NDK" -o -z "$ANDROID_SDK" ]; then
Rafaël Carré's avatar
Rafaël Carré committed
14 15 16 17
   echo "You must define ANDROID_NDK and ANDROID_SDK before starting."
   echo "They must point to your NDK and SDK directories."
   exit 1
fi
Rémi Duraffort's avatar
Rémi Duraffort committed
18

Rafaël Carré's avatar
Rafaël Carré committed
19
# 1/ libvlc, libvlccore and its plugins
20

21 22
if [ ! -d "vlc" ]; then
	echo "VLC source not found, cloning"
Rafaël Carré's avatar
Rafaël Carré committed
23
        git clone git://git.videolan.org/vlc/vlc-1.2.git vlc
24 25 26
else
	echo "VLC source found, pulling from remote master"
	pushd vlc > /dev/null
Rafaël Carré's avatar
Rafaël Carré committed
27
	git pull origin master
28 29
	popd > /dev/null
fi
Rémi Duraffort's avatar
Rémi Duraffort committed
30 31 32

echo "Applying the patches"
cd vlc
Rafaël Carré's avatar
Rafaël Carré committed
33
git am ../patches/*.patch || git am --abort
Rémi Duraffort's avatar
Rémi Duraffort committed
34 35

echo "Building the contribs"
Rafaël Carré's avatar
Rafaël Carré committed
36 37 38 39 40 41 42 43 44 45 46 47 48
mkdir contrib/android; cd contrib/android
../bootstrap --host=arm-linux-androideabi --disable-disc --disable-sout \
    --disable-sdl \
    --disable-SDL_image \
    --disable-fontconfig \
    --disable-ass \
    --disable-freetyp2 \
    --disable-fribidi \
    --disable-zvbi \
    --disable-kate \
    --disable-caca \
    --disable-gettext \
    --disable-mpcdec \
Edward Wang's avatar
Edward Wang committed
49 50
    --disable-sidplay2 \
    --disable-live555
Rafaël Carré's avatar
Rafaël Carré committed
51 52 53

make fetch
make
Rémi Duraffort's avatar
Rémi Duraffort committed
54 55 56

cd ../.. && mkdir -p android && cd android

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
57 58
if test ! -s "../configure"
then
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
59
    echo "Bootstraping"
Sébastien Toque's avatar
Sébastien Toque committed
60
    ../bootstrap
Rafaël Carré's avatar
Rafaël Carré committed
61
fi
Rémi Duraffort's avatar
Rémi Duraffort committed
62 63 64 65

echo "Configuring"
sh ../extras/package/android/configure.sh

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
66
echo "Building"
Rémi Duraffort's avatar
Rémi Duraffort committed
67
make
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
68

Rafaël Carré's avatar
Rafaël Carré committed
69 70 71

# 2/ VLC android UI and specific code

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
72 73
echo "Building Android"
cd ../../
Rafaël Carré's avatar
Rafaël Carré committed
74

Rafaël Carré's avatar
Rafaël Carré committed
75 76 77 78 79
# Using CyanogenMod headers instead of AOSP, since CyanogenMod
# has commit 1563f4aca88d354c502dba056d173cefc7c2ea7f,
# "Stagefright: Memcpy optimization on output port." (available
# upstream at https://www.codeaurora.org/gitweb/quic/la/?p=platform/frameworks/base.git;a=commit;h=052368f194c9fc180b9b0335b60114a2f1fb88d8),
# which adds some vtable entries needed on newer qualcomm devices.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99

cyanogen_headers() {
    dir=android-headers-$2/$1
    if [ ! -d $dir ]; then
        echo "Fetching $1 for $2"
        git clone -b $2 --depth=1 git://github.com/CyanogenMod/android_`echo $1|tr / _`.git $dir
    else
        echo "Updating $1 for $2"
        pushd $dir > /dev/null
        git pull origin $2
        popd > /dev/null
    fi
}

cyanogen_headers frameworks/base gingerbread
cyanogen_headers system/core gingerbread
cyanogen_headers frameworks/base ics
cyanogen_headers system/core ics
cyanogen_headers hardware/libhardware ics

100 101
export ANDROID_SYS_HEADERS_GINGERBREAD=${PWD}/android-headers-gingerbread
export ANDROID_SYS_HEADERS_ICS=${PWD}/android-headers-ics
Rafaël Carré's avatar
Rafaël Carré committed
102 103 104 105 106 107 108 109 110 111 112

echo "Fetching Android libraries for linking"
# Libraries from any froyo/gingerbread device/emulator should work
# fine, since the symbols used should be available on most of them.
if [ ! -f "update-cm-7.1.0.1-NS-signed.zip" ]; then
    curl -O http://mirror.sea.tdrevolution.net/cm/stable/gingerbread/update-cm-7.1.0.1-NS-signed.zip
    unzip update-cm-7.1.0.1-NS-signed.zip system/lib/\*
    mv system/lib android-libs
    rmdir system
fi
export ANDROID_LIBS=${PWD}/android-libs
113
export VLC_BUILD_DIR=vlc/android
Rafaël Carré's avatar
Rafaël Carré committed
114

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
115
make distclean
116
make