compile.sh 2.57 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
# 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!
9 10 11 12 13 14 15 16 17 18 19 20
cat << EOF
If you plan to use the emulator, you need a build without neon:
$ export NO_NEON=1
make sure it is set for ALL the process

The script will attempt to automatically detect if you have NDK v7, but you can override this
If you do not have NDK v7 or later:
export NO_NDK_V7=1
or if you are sure you have NDK v7:
export NO_NDK_V7=0

EOF
Edward Wang's avatar
Edward Wang committed
21

Rémi Duraffort's avatar
Rémi Duraffort committed
22
if [ -z "$ANDROID_NDK" -o -z "$ANDROID_SDK" ]; then
Rafaël Carré's avatar
Rafaël Carré committed
23 24 25 26
   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
27

28 29 30 31
if [ -z "$NO_NDK_V7" ]; then
    # try to detect NDK version
    REL=$(grep -iw "r7" $ANDROID_NDK/RELEASE.TXT)
    if [ -z $REL ]; then
32
        export NO_NDK_V7=1
33 34 35
    fi
fi

36 37 38 39
# Add the NDK toolchain to the PATH, needed both for contribs and for building
# stub libraries
export PATH=${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin:${PATH}

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

42
if [ ! -d "vlc" ]; then
43 44
    echo "VLC source not found, cloning"
    git clone git://git.videolan.org/vlc/vlc-2.0.git vlc
45
else
46 47 48 49
    echo "VLC source found, pulling from remote master"
    pushd vlc > /dev/null
    git pull origin master
    popd > /dev/null
50
fi
Rémi Duraffort's avatar
Rémi Duraffort committed
51 52 53

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

echo "Building the contribs"
Rafaël Carré's avatar
Rafaël Carré committed
57 58 59 60 61 62 63 64 65 66 67 68 69
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 \
70
    --disable-upnp \
71
    --disable-gme \
72 73
    --disable-tremor \
    --disable-vorbis \
74
    --disable-sidplay2
Rafaël Carré's avatar
Rafaël Carré committed
75

76 77
# TODO: mpeg2, dts, theora

Rafaël Carré's avatar
Rafaël Carré committed
78 79
make fetch
make
Rémi Duraffort's avatar
Rémi Duraffort committed
80 81 82

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

83
if test ! -s "../configure" ; then
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
84
    echo "Bootstraping"
Sébastien Toque's avatar
Sébastien Toque committed
85
    ../bootstrap
Rafaël Carré's avatar
Rafaël Carré committed
86
fi
Rémi Duraffort's avatar
Rémi Duraffort committed
87 88 89 90

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

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
91
echo "Building"
Rémi Duraffort's avatar
Rémi Duraffort committed
92
make
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
93

Rafaël Carré's avatar
Rafaël Carré committed
94 95 96

# 2/ VLC android UI and specific code

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
97 98
echo "Building Android"
cd ../../
Rafaël Carré's avatar
Rafaël Carré committed
99

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

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

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