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.
This commit is contained in:
Joel Dice 2013-04-22 17:10:23 -06:00
parent e9a8aa2e65
commit 64002319c5
2 changed files with 49 additions and 41 deletions

View File

@ -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

View File

@ -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