Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tom #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions android-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export CXX=arm-linux-androideabi-g++
export C_INCLUDE_PATH=$PREFIX/include
export CPLUS_INCLUDE_PATH=$PREFIX/include

export ANDROID_SDK_DIR="$PWD/android-sdk-linux"
export ANDROID_NDK_DIR=`find $PWD/* -maxdepth 0 -type d -name 'android-ndk-r*'`
export ANDROID_SDK_DIR="$HOME/android-sdk-linux"
export ANDROID_NDK_DIR=`find $HOME -maxdepth 1 -type d -name 'android-ndk-*'`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some people may not want the Android SDK installed in their home directory, so I think this should be configurable if you want to specify a different location for the SDK and NDK.

export ANDROID_NDK_TOOLCHAIN="$PWD/toolchain"

export gl_cv_header_working_stdint_h=yes
Expand Down
126 changes: 99 additions & 27 deletions build-clutter-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,42 +16,114 @@

set -ex

# download Android NDK and create standalone toolchain
if ! test -d android-ndk-r8c; then
wget http://dl.google.com/android/ndk/android-ndk-r8c-linux-x86.tar.bz2
tar jxf android-ndk-r8c-linux-x86.tar.bz2
rm android-ndk-r8c-linux-x86.tar.bz2
pushd android-ndk-r8c
./build/tools/make-standalone-toolchain.sh --platform=android-14 --install-dir=../toolchain
popd
# 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The && isn't necassary here, since set -e is called at the beginning of the script.

popd
fi

JHB_PREFIX=$PWD/jhbuild/.local
# 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
# 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
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/

source ./android-env.sh
export PREFIX="$PWD/install-$ARCH-$API_LEVEL"

# start the build
$JHB_PREFIX/bin/jhbuild -f jhbuildrc-android build -q mx libsoup
export CFLAGS=
export CC=$TOOLCHAIN_NAME-gcc
export CXX=$TOOLCHAIN_NAME-g++

# download Android SDK
if ! test -d android-sdk-linux; then
wget http://dl.google.com/android/android-sdk_r21-linux.tgz
tar zxf android-sdk_r21-linux.tgz
rm android-sdk_r21-linux.tgz
fi
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 \
"

android update sdk -u --filter platform-tool,tool
android update sdk -u --filter android-14
# Do it.
$JHB_PREFIX/bin/jhbuild -f jhbuildrc-android -m modulesets/clutter-android.modules ${*:-build glib}
17 changes: 2 additions & 15 deletions jhbuildrc-android
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
moduleset = os.environ['PWD'] + '/modulesets/clutter-android.modules'
checkoutroot = os.environ['PWD'] + '/sources'
prefix = os.environ['PWD'] + '/install'

prefix = os.environ['PREFIX']
build_policy = 'updated'
use_lib64 = False

use_local_modulesets = True
partial_build = False
autogenargs = '--disable-shared --disable-gtk-doc --host=arm-linux-androideabi gl_cv_header_working_stdint_h=yes --disable-introspection '
autogenargs = '--disable-shared --disable-gtk-doc gl_cv_header_working_stdint_h=yes --disable-introspection --build=x86_64-unknown-linux-gnu --host=' + os.environ['TOOLCHAIN_NAME']
makeargs = '-j 4'


os.environ['ac_cv_path_GLIB_COMPILE_RESOURCES']='/usr/bin/glib-compile-resources'
os.environ['ac_cv_path_GLIB_COMPILE_SCHEMAS']='/usr/bin/glib-compile-schemas'
os.environ['ac_cv_path_GLIB_GENMARSHAL']='/usr/bin/glib-genmarshal'

os.environ['PATH'] += ':' + os.environ['PWD'] + '/toolchain/bin'
os.environ['CC'] = 'arm-linux-androideabi-gcc'

os.environ['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'
1 change: 0 additions & 1 deletion modulesets/clutter-android.modules
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
<dep package="gettext"/>
<dep package="libffi"/>
<dep package="iconv"/>
<dep package="zlib"/>
</dependencies>
</autotools>

Expand Down