From 64002319c56a5f3bcf8a6664ac5d66520933c69e Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Mon, 22 Apr 2013 17:10:23 -0600 Subject: [PATCH] use Android directory layout when accessing class library code Per https://github.com/ReadyTalk/avian/issues/53, Avian should build against a standard AOSP checkout, which means we should look for subprojects in the directories the repo utility would place them. --- README.md | 58 +++++++++++++++++++++++++++++++------------------------ makefile | 32 +++++++++++++++--------------- 2 files changed, 49 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index b4d47e1183..1aba5f6f69 100644 --- a/README.md +++ b/README.md @@ -354,38 +354,46 @@ can also build with the Android class library on some platforms (currently Linux works and OS X mostly works). 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 && (mv makefile.in Makefile.in || true) \ - && CFLAGS=-fPIC bash configure && make) - $ (cd icu4c && CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure --enable-static \ - && make) + cd .. + mkdir -p android/system android/external + cd android + git clone https://android.googlesource.com/platform/bionic + git clone https://android.googlesource.com/platform/system/core \ + system/core + git clone https://android.googlesource.com/platform/external/expat \ + external/expat + git clone https://android.googlesource.com/platform/external/fdlibm \ + external/fdlibm + git clone https://android.googlesource.com/platform/external/icu4c \ + external/icu4c + git clone https://android.googlesource.com/platform/libnativehelper + git clone https://android.googlesource.com/platform/external/openssl \ + external/openssl + git clone https://android.googlesource.com/platform/external/zlib \ + external/zlib + git clone git://git.openssl.org/openssl.git openssl-upstream + git clone https://github.com/dicej/android-libcore64 libcore + (cd external/expat && CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure \ + --enable-static && make) + (cd external/fdlibm && (mv makefile.in Makefile.in || true) \ + && CFLAGS=-fPIC bash configure && make) + (cd external/icu4c && CFLAGS=-fPIC CXXFLAGS=-fPIC ./configure \ + --enable-static && make) NB: use 'CC="gcc -fPIC" ./Configure darwin64-x86_64-cc' when building for x86_64 OS X instead of 'CC="gcc -fPIC" ./config': - $ (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 + (cd openssl-upstream && git checkout OpenSSL_1_0_1e \ + && (for x in ../external/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. +https://android.googlesource.com/platform/libcore repository, since +the former has patches to provide better support for non-Linux platforms. 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 diff --git a/makefile b/makefile index fda2b32132..93415db230 100755 --- a/makefile +++ b/makefile @@ -157,12 +157,12 @@ ifneq ($(android),) classpath-cflags = -DBOOT_JAVAHOME android-cflags := -I$(luni-native) \ -I$(android)/libnativehelper/include/nativehelper \ - -I$(android)/core/include \ - -I$(android)/zlib \ - -I$(android)/icu4c/i18n \ - -I$(android)/icu4c/common \ - -I$(android)/expat \ - -I$(android)/openssl/include \ + -I$(android)/system/core/include \ + -I$(android)/external/zlib \ + -I$(android)/external/icu4c/i18n \ + -I$(android)/external/icu4c/common \ + -I$(android)/external/expat \ + -I$(android)/external/openssl/include \ -I$(android)/libcore/include \ -I$(build)/android-src/external/fdlibm \ -I$(build)/android-src \ @@ -188,21 +188,21 @@ ifneq ($(android),) $(luni-native)/AsynchronousSocketCloseMonitor.cpp \ $(luni-native)/NetworkUtilities.cpp luni-cpps := $(filter-out $(blacklist),$(luni-cpps)) - icu-libs := $(android)/icu4c/lib/sicuin.a \ - $(android)/icu4c/lib/sicuuc.a \ - $(android)/icu4c/lib/sicudt.a + icu-libs := $(android)/external/icu4c/lib/sicuin.a \ + $(android)/external/icu4c/lib/sicuuc.a \ + $(android)/external/icu4c/lib/sicudt.a platform-lflags := -lgdi32 else android-cflags += -fPIC -DHAVE_SYS_UIO_H - icu-libs := $(android)/icu4c/lib/libicui18n.a \ - $(android)/icu4c/lib/libicuuc.a \ - $(android)/icu4c/lib/libicudata.a + icu-libs := $(android)/external/icu4c/lib/libicui18n.a \ + $(android)/external/icu4c/lib/libicuuc.a \ + $(android)/external/icu4c/lib/libicudata.a endif classpath-lflags := \ $(icu-libs) \ - $(android)/fdlibm/libfdm.a \ - $(android)/expat/.libs/libexpat.a \ + $(android)/external/fdlibm/libfdm.a \ + $(android)/external/expat/.libs/libexpat.a \ $(android)/openssl-upstream/libssl.a \ $(android)/openssl-upstream/libcrypto.a \ $(platform-lflags) \ @@ -1475,8 +1475,8 @@ $(build)/android.dep: $(luni-javas) $(dalvik-javas) $(xml-javas) @mkdir -p $(build)/android @mkdir -p $(build)/android-src/external/fdlibm @mkdir -p $(build)/android-src/libexpat - cp $(android)/fdlibm/fdlibm.h $(build)/android-src/external/fdlibm/ - cp $(android)/expat/lib/expat*.h $(build)/android-src/libexpat/ + cp $(android)/external/fdlibm/fdlibm.h $(build)/android-src/external/fdlibm/ + cp $(android)/external/expat/lib/expat*.h $(build)/android-src/libexpat/ cp -a $(luni-java)/* $(dalvik-java)/* $(xml-java)/* $(build)/android-src/ sed -i -e 's/return ordinal - o.ordinal;/return ordinal - o.ordinal();/' \ $(build)/android-src/java/lang/Enum.java