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

Rafaël Carré's avatar
Rafaël Carré committed
3
4
5
6
7
# 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.

8
9
set -e

Rafaël Carré's avatar
Rafaël Carré committed
10
# 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
32
    REL=$(grep -o '^r[0-9]*' $ANDROID_NDK/RELEASE.TXT 2>/dev/null|cut -b2-)
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
Sébastien Toque's avatar
Sébastien Toque committed
43
TESTED_HASH=defdb5a9e1
44
if [ ! -d "vlc" ]; then
45
    echo "VLC source not found, cloning"
46
    git clone git://git.videolan.org/vlc.git vlc
Philipp Dreimann's avatar
Philipp Dreimann committed
47
    cd vlc
48
    git checkout -B android ${TESTED_HASH}
49
50
    echo "Applying the patches"
    git am ../patches/*.patch
51
else
52
    echo "VLC source found"
53
    cd vlc
54
55
56
57
58
59
60
    if ! git cat-file -e ${TESTED_HASH}; then
        cat << EOF
***
*** Error: Your vlc checkout does not contain the latest tested commit ***
***

Please update your source with something like:
ivoire's avatar
ivoire committed
61
62

cd vlc
63
64
65
66
67
68
69
70
71
72
73
git reset --hard origin
git pull origin master
git checkout -B android ${TESTED_HASH}
git am ../patches/*

*** : This will delete any changes you made to the current branch ***

EOF
        exit 1
    fi
fi
ivoire's avatar
ivoire committed
74
75

echo "Building the contribs"
76
77
mkdir -p contrib/android
cd contrib/android
78
../bootstrap --host=arm-linux-androideabi --disable-disc --disable-sout --enable-small \
Rafaël Carré's avatar
Rafaël Carré committed
79
80
81
82
83
84
85
86
    --disable-sdl \
    --disable-SDL_image \
    --disable-fontconfig \
    --disable-zvbi \
    --disable-kate \
    --disable-caca \
    --disable-gettext \
    --disable-mpcdec \
87
    --disable-upnp \
88
    --disable-gme \
89
90
    --disable-tremor \
    --disable-vorbis \
91
    --disable-sidplay2 \
Sébastien Toque's avatar
Sébastien Toque committed
92
93
    --disable-samplerate \
    --enable-iconv
Rafaël Carré's avatar
Rafaël Carré committed
94
echo EXTRA_CFLAGS=-g >> config.mak
Rafaël Carré's avatar
Rafaël Carré committed
95

96
# TODO: mpeg2, theora
97

98
99
100
101
102
103
if test -z "${NO_NEON}" -o -n "${TEGRA2}"; then
    # assumes armv7-a
    echo "EXTRA_CFLAGS += -mthumb" >> config.mak
    echo "NOTHUMB := -marm" >> config.mak
fi

Rafaël Carré's avatar
Rafaël Carré committed
104
105
make fetch
make
ivoire's avatar
ivoire committed
106
107
108

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

109
if test ! -s "../configure" ; then
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
110
    echo "Bootstraping"
Sébastien Toque's avatar
Sébastien Toque committed
111
    ../bootstrap
Rafaël Carré's avatar
Rafaël Carré committed
112
fi
ivoire's avatar
ivoire committed
113
114

echo "Configuring"
115
../../configure.sh
ivoire's avatar
ivoire committed
116

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
117
echo "Building"
ivoire's avatar
ivoire committed
118
make
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
119

Rafaël Carré's avatar
Rafaël Carré committed
120
121
122

# 2/ VLC android UI and specific code

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
123
124
echo "Building Android"
cd ../../
Rafaël Carré's avatar
Rafaël Carré committed
125

126
export ANDROID_SYS_HEADERS_GINGERBREAD=${PWD}/android-headers-gingerbread
127
export ANDROID_SYS_HEADERS_HC=${PWD}/android-headers-hc
128
export ANDROID_SYS_HEADERS_ICS=${PWD}/android-headers-ics
Rafaël Carré's avatar
Rafaël Carré committed
129
130

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

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
133
make distclean
134
make