compile.sh 3.03 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
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
cat << EOF
Edward Wang's avatar
Edward Wang committed
10
If you plan to use a device without NEON (e.g. the emulator), you need a build without NEON:
11
$ export NO_NEON=1
Edward Wang's avatar
Edward Wang committed
12
Make sure it is set throughout the entire process.
13

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

ivoire's avatar
ivoire 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
ivoire's avatar
ivoire committed
27

28
29
if [ -z "$NO_NDK_V7" ]; then
    # try to detect NDK version
30
    REL=$(grep -e "r[78]" $ANDROID_NDK/RELEASE.TXT)
31
    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
Rafaël Carré's avatar
Rafaël Carré committed
41
TESTED_HASH=5069692bfb
42
if [ ! -d "vlc" ]; then
43
    echo "VLC source not found, cloning"
44
45
    git clone git://git.videolan.org/vlc.git vlc
    git checkout -B android ${TESTED_HASH}
46
else
47
    echo "VLC source found, updating"
48
    cd vlc
49
    git fetch origin
50
51
    if git branch | grep -q '.*android$'; then
        echo "Android branch found, merging"
Rafaël Carré's avatar
Rafaël Carré committed
52
53
        git merge ${TESTED_HASH}
    else
54
        echo "Creating android branch"
Rafaël Carré's avatar
Rafaël Carré committed
55
56
        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"
65
66
mkdir -p contrib/android
cd contrib/android
67
../bootstrap --host=arm-linux-androideabi --disable-disc --disable-sout --enable-small \
Rafaël Carré's avatar
Rafaël Carré committed
68
69
70
71
72
73
74
75
76
77
78
    --disable-sdl \
    --disable-SDL_image \
    --disable-fontconfig \
    --disable-ass \
    --disable-freetyp2 \
    --disable-fribidi \
    --disable-zvbi \
    --disable-kate \
    --disable-caca \
    --disable-gettext \
    --disable-mpcdec \
79
    --disable-upnp \
80
    --disable-gme \
81
82
    --disable-tremor \
    --disable-vorbis \
83
84
    --disable-sidplay2 \
    --disable-samplerate
Rafaël Carré's avatar
Rafaël Carré committed
85

86
87
# TODO: mpeg2, dts, theora

88
89
90
91
92
93
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
94
95
make fetch
make
ivoire's avatar
ivoire committed
96
97
98

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

99
if test ! -s "../configure" ; then
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
100
    echo "Bootstraping"
Sébastien Toque's avatar
Sébastien Toque committed
101
    ../bootstrap
Rafaël Carré's avatar
Rafaël Carré committed
102
fi
ivoire's avatar
ivoire committed
103
104

echo "Configuring"
105
../../configure.sh
ivoire's avatar
ivoire committed
106

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
107
echo "Building"
ivoire's avatar
ivoire committed
108
make
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
109

Rafaël Carré's avatar
Rafaël Carré committed
110
111
112

# 2/ VLC android UI and specific code

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
113
114
echo "Building Android"
cd ../../
Rafaël Carré's avatar
Rafaël Carré committed
115

116
117
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
118
119

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

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
122
make distclean
123
make