compile.sh 2.78 KB
Newer Older
ivoire's avatar
ivoire committed
1
2
#! /bin/sh

3
4
set -e

Rafaël Carré's avatar
Rafaël Carré committed
5
6
7
8
9
10
# 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!
11
cat << EOF
Edward Wang's avatar
Edward Wang committed
12
If you plan to use a device without NEON (e.g. the emulator), you need a build without NEON:
13
$ export NO_NEON=1
Edward Wang's avatar
Edward Wang committed
14
Make sure it is set throughout the entire process.
15

Edward Wang's avatar
Edward Wang committed
16
The script will attempt to automatically detect if you have NDK v7, but you can override this.
17
18
19
20
21
22
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
23

ivoire's avatar
ivoire committed
24
if [ -z "$ANDROID_NDK" -o -z "$ANDROID_SDK" ]; then
Rafaël Carré's avatar
Rafaël Carré committed
25
26
27
28
   echo "You must define ANDROID_NDK and ANDROID_SDK before starting."
   echo "They must point to your NDK and SDK directories."
   exit 1
fi
ivoire's avatar
ivoire committed
29

30
31
if [ -z "$NO_NDK_V7" ]; then
    # try to detect NDK version
Rafaël Carré's avatar
Rafaël Carré committed
32
    REL=$(grep "r7" $ANDROID_NDK/RELEASE.TXT)
33
    if [ -z $REL ]; then
34
        export NO_NDK_V7=1
35
36
37
    fi
fi

38
39
40
41
# 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
42
# 1/ libvlc, libvlccore and its plugins
Rafaël Carré's avatar
Rafaël Carré committed
43
TESTED_HASH=5069692bfb
44
if [ ! -d "vlc" ]; then
45
    echo "VLC source not found, cloning"
46
47
    git clone git://git.videolan.org/vlc.git vlc
    git checkout -B android ${TESTED_HASH}
48
else
49
    echo "VLC source found, updating"
50
    cd vlc
51
    git fetch origin
52
    if git branch | grep -q '* android$'; then
Rafaël Carré's avatar
Rafaël Carré committed
53
54
55
56
        git merge ${TESTED_HASH}
    else
        git checkout -B android ${TESTED_HASH}
    fi
57
    cd -
58
fi
ivoire's avatar
ivoire committed
59
60
61

echo "Applying the patches"
cd vlc
Rafaël Carré's avatar
Rafaël Carré committed
62
git am ../patches/*.patch || git am --abort
ivoire's avatar
ivoire committed
63
64

echo "Building the contribs"
Rafaël Carré's avatar
Rafaël Carré committed
65
mkdir contrib/android; cd contrib/android
66
../bootstrap --host=arm-linux-androideabi --disable-disc --disable-sout --enable-small \
Rafaël Carré's avatar
Rafaël Carré committed
67
68
69
70
71
72
73
74
75
76
77
    --disable-sdl \
    --disable-SDL_image \
    --disable-fontconfig \
    --disable-ass \
    --disable-freetyp2 \
    --disable-fribidi \
    --disable-zvbi \
    --disable-kate \
    --disable-caca \
    --disable-gettext \
    --disable-mpcdec \
78
    --disable-upnp \
79
    --disable-gme \
80
81
    --disable-tremor \
    --disable-vorbis \
82
83
    --disable-sidplay2 \
    --disable-samplerate
Rafaël Carré's avatar
Rafaël Carré committed
84

85
86
# TODO: mpeg2, dts, theora

Rafaël Carré's avatar
Rafaël Carré committed
87
88
make fetch
make
ivoire's avatar
ivoire committed
89
90
91

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

92
if test ! -s "../configure" ; then
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
93
    echo "Bootstraping"
Sébastien Toque's avatar
Sébastien Toque committed
94
    ../bootstrap
Rafaël Carré's avatar
Rafaël Carré committed
95
fi
ivoire's avatar
ivoire committed
96
97

echo "Configuring"
98
../../configure.sh
ivoire's avatar
ivoire committed
99

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
100
echo "Building"
ivoire's avatar
ivoire committed
101
make
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
102

Rafaël Carré's avatar
Rafaël Carré committed
103
104
105

# 2/ VLC android UI and specific code

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
106
107
echo "Building Android"
cd ../../
Rafaël Carré's avatar
Rafaël Carré committed
108

109
110
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
111
112

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