-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuild-clutter-android.sh
More file actions
executable file
·129 lines (104 loc) · 3.97 KB
/
build-clutter-android.sh
File metadata and controls
executable file
·129 lines (104 loc) · 3.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Copyright © 2012, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU Lesser General Public License,
# version 2.1, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU Lesser General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St
# - Fifth Floor, Boston, MA 02110-1301 USA
set -ex
# Which target architecture (arm or x86).
ARCH=x86
# Which Android "API Level" to build for.
API_LEVEL=14
# Which version of the Android NDK toolchain to use (e.g. 4.6).
TOOLCHAIN_VERSION=4.6
# Where the Android NDK lives.
NDK_NAME=android-ndk-r8d
NDK_DIR=$HOME/$NDK_NAME
# Where the Android SDK lives.
SDK_NAME=android-sdk-linux
SDK_DIR=$HOME/$SDK_NAME
# Download the Android NDK if necessary.
if ! test -d $NDK_DIR; then
mkdir -p $NDK_DIR
pushd $NDK_DIR/..
wget http://dl.google.com/android/ndk/$NDK_NAME-linux-x86.tar.bz2 \
&& tar jxf $NDK_NAME-linux-x86.tar.bz2 \
&& rm $NDK_NAME-linux-x86.tar.bz2
popd
fi
# Download the Android SDK if necessary.
if ! test -d $SDK_DIR; then
mkdir -p $SDK_DIR
pushd $SDK_DIR/..
wget http://dl.google.com/android/android-sdk_r21-linux.tgz \
&& tar zxf android-sdk_r21-linux.tgz \
&& rm android-sdk_r21-linux.tgz
popd
fi
# Update the Android SDK if necessary.
#$SDK_DIR/tools/android update sdk -u --filter platform-tool,tool
#$SDK_DIR/tools/android update sdk -u --filter android-$API_LEVEL
# Toolchain name: the prefix of toolchain command names
# Toolchain arg: passed to make-standalon-toolchain.sh
# Toolchain dir: where we put the standalone toolchain
case $ARCH in
arm)
export TOOLCHAIN_NAME=arm-linux-androideabi
TOOLCHAIN_ARG=arm-linux-androideabi-$TOOLCHAIN_VERSION
;;
x86)
export TOOLCHAIN_NAME=i686-linux-android
TOOLCHAIN_ARG=x86-$TOOLCHAIN_VERSION
;;
esac
TOOLCHAIN_DIR=$PWD/toolchain-$ARCH-$TOOLCHAIN_VERSION
# Create the standalone toolchain.
$NDK_DIR/build/tools/make-standalone-toolchain.sh \
--toolchain=$TOOLCHAIN_ARG \
--platform=android-$API_LEVEL \
--install-dir=$TOOLCHAIN_DIR
# Set up patched version of jhbuild
JHB_PREFIX=$PWD/jhbuild/.local
if ! test -d jhbuild; then
git clone git://git.gnome.org/jhbuild
pushd jhbuild
patch -p1 -i ../modulesets/patches/jhbuild/disable-clean-la-files.patch
./autogen.sh --prefix=$JHB_PREFIX
make install
popd
fi
mkdir -p $JHB_PREFIX/share/aclocal
cp /usr/share/aclocal/gtk-doc.m4 $JHB_PREFIX/share/aclocal/
export PREFIX="$PWD/install-$ARCH-$API_LEVEL"
export CFLAGS=
export CC=$TOOLCHAIN_NAME-gcc
export CXX=$TOOLCHAIN_NAME-g++
export C_INCLUDE_PATH=$PREFIX/include
export CPLUS_INCLUDE_PATH=$PREFIX/include
export gl_cv_header_working_stdint_h=yes
# remove other langauges
export LINGUAS=C
# avoid picking up system libraries
export PKG_CONFIG_LIBDIR=/foo/bar
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
export ac_cv_path_GLIB_COMPILE_RESOURCES=/usr/bin/glib-compile-resources
export ac_cv_path_GLIB_COMPILE_SCHEMAS=/usr/bin/glib-compile-schemas
export ac_cv_path_GLIB_GENMARSHAL=/usr/bin/glib-genmarshal
export PATH="$TOOLCHAIN_DIR/bin:$NDK_DIR:$SDK_DIR/tools/:$SDK_DIR/platform-tools:$PATH"
export NDK_MODULE_PATH=$PWD
export PKG_CONFIG="pkg-config \
--define-variable=glib_genmarshal=/usr/bin/glib-genmarshal \
--define-variable=gobject_query=/usr/bin/gobject-query \
--define-variable=glib_mkenums=/usr/bin/glib-mkenums \
--define-variable=glib_compile_resources=/usr/bin/glib-compile-resources \
"
# Do it.
$JHB_PREFIX/bin/jhbuild -f jhbuildrc-android -m modulesets/clutter-android.modules ${*:-build glib}