compile.sh 2.83 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 \
49
    --disable-sidplay2
Rafaël Carré's avatar
Rafaël Carré committed
50 51 52

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

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

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

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

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

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

# 2/ VLC android UI and specific code

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

Rafaël Carré's avatar
Rafaël Carré committed
74 75 76 77 78
# 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.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98

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

99 100
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
101 102

export ANDROID_LIBS=${PWD}/android-libs
103
export VLC_BUILD_DIR=vlc/android
Rafaël Carré's avatar
Rafaël Carré committed
104

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
105
make distclean
106
make