From d4a42c7a26f0066f80e23ec0d34af4f3682b234e Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Wed, 27 Feb 2013 10:03:17 -0700 Subject: [PATCH] add Android class library instructions to README.md --- README.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++---- makefile | 4 ++-- 2 files changed, 58 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bc9bfb55b3..1bea99be1e 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,8 @@ certain flags described below, all of which are optional. continuations={true,false} \ use-clang={true,false} \ openjdk= \ - openjdk-src= + openjdk-src= \ + android= * `platform` - the target platform * _default:_ output of $(uname -s | tr [:upper:] [:lower:]), @@ -156,8 +157,8 @@ Note that this does not currently affect cross compiles, only native builds. * _default:_ false - * `openjdk` - if set, use OpenJDK class library instead of the default -Avian class library. See "Building with the OpenJDK Class + * `openjdk` - if set, use the OpenJDK class library instead of the +default Avian class library. See "Building with the OpenJDK Class Library" below for details. * _default:_ not set @@ -168,6 +169,11 @@ sources found under the specified directory. See "Building with the OpenJDK Class Library" below for details. * _default:_ not set + * `android` - if set, use the Android class library instead of the +default Avian class library. See "Building with the Android Class +Library" below for details. + * _default:_ not set + These flags determine the name of the directory used for the build. The name always starts with _${platform}-${arch}_, and each non-default build option is appended to the name. For example, a debug build with @@ -235,6 +241,7 @@ Finally, build with the msvc flag set to the MSVC tool directory: $ make msvc="/cygdrive/c/Program Files/Microsoft Visual Studio 9.0/VC" + Building with the OpenJDK Class Library --------------------------------------- @@ -306,7 +313,7 @@ _Stand-alone build:_ $ apt-get install openjdk-7-jdk $ apt-get source openjdk-7-jdk $ apt-get build-dep openjdk-7-jdk - (cd openjdk-7-7~b147-2.0 && dpkg-buildpackage) + $ (cd openjdk-7-7~b147-2.0 && dpkg-buildpackage) $ make openjdk=/usr/lib/jvm/java-7-openjdk \ openjdk-src=$(pwd)/openjdk-7-7~b147-2.0/build/openjdk/jdk/src \ test @@ -339,6 +346,51 @@ Currently, only OpenJDK 7 is supported. Later versions might work, but have not yet been tested. +Building with the Android Class Library +--------------------------------------- + +As an alternative to both the Avian and OpenJDK class libaries, you +can also build with the Android Class Library on some platforms +(currently just Linux, but possibly others in the future). To build +this way, do the following, starting from the Avian directory: + + $ cd .. + $ mkdir android + $ git clone https://android.googlesource.com/platform/bionic + $ git clone https://android.googlesource.com/platform/system/core + $ git clone https://android.googlesource.com/platform/external/expat + $ git clone https://android.googlesource.com/platform/external/fdlibm + $ git clone https://android.googlesource.com/platform/external/icu4c + $ git clone https://android.googlesource.com/platform/libnativehelper + $ git clone https://android.googlesource.com/platform/external/openssl + $ git clone https://android.googlesource.com/platform/external/zlib + $ git clone git://git.openssl.org/openssl.git openssl-upstream + $ git clone https://github.com/dicej/android-libcore64 libcore + $ (cd expat && CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure --enable-static \ + && make) + $ (cd fdlibm && CFLAGS=-fPIC bash configure && make) + $ (cd icu4c && CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure --enable-static \ + && make) + $ (cd openssl-upstream && git checkout OpenSSL_1_0_1e \ + && (for x in ../openssl/patches/*.patch; do patch -p1 < $x; done) \ + && CC="gcc -fPIC" ./config && make) + $ cd ../avian + $ make android=$(pwd)/../android test + +Note that we use https://github.com/dicej/android-libcore64 above +instead of the upstream +https://android.googlesource.com/platform/libcore repository. This is +temporary until upstream has been patched with 64-bit support. + +Also note that we use the upstream OpenSSL repository and apply the +Android patches to it. This is because it is not clear how to build +the Android fork of OpenSSL directly without checking out and building +the entire platform. As of this writing, the patches apply cleanly +against OpenSSL 1.0.1e, so that's the tag we check out, but this may +change in the future when the Android fork rebases against a new +OpenSSL version. + + Installing ---------- diff --git a/makefile b/makefile index c0b82b48e7..64eae5ab4b 100755 --- a/makefile +++ b/makefile @@ -177,8 +177,8 @@ ifneq ($(android),) $(android)/icu4c/lib/libicudata.a \ $(android)/fdlibm/libfdm.a \ $(android)/expat/.libs/libexpat.a \ - $(android)/openssl-1.0.1e/libssl.a \ - $(android)/openssl-1.0.1e/libcrypto.a \ + $(android)/openssl-upstream/libssl.a \ + $(android)/openssl-upstream/libcrypto.a \ -lstdc++ luni-cpps := $(shell find $(luni-native) -name '*.cpp') classpath-objects = \