Merge pull request #191 from bigfatbrowncat/avian-droid

Android classpath support in Windows
This commit is contained in:
Joel Dice 2014-03-12 16:38:37 -06:00
commit 70b5ea6838
3 changed files with 17 additions and 17 deletions

2
.gitignore vendored
View File

@ -10,3 +10,5 @@ bin
*.pdb *.pdb
*.swp *.swp
/*.sublime-* /*.sublime-*
workspace/
src/.cproject

View File

@ -179,6 +179,7 @@ ifneq ($(android),)
-DOS_SHARED_LIB_FORMAT_STR="\"$(so-prefix)%s$(so-suffix)\"" \ -DOS_SHARED_LIB_FORMAT_STR="\"$(so-prefix)%s$(so-suffix)\"" \
-DJNI_JARJAR_PREFIX= \ -DJNI_JARJAR_PREFIX= \
-D__DARWIN_UNIX03=1 \ -D__DARWIN_UNIX03=1 \
-D__PROVIDE_FIXMES \
-g3 \ -g3 \
-Werror -Werror
@ -189,28 +190,22 @@ ifneq ($(android),)
$(libnativehelper-native)/toStringArray.cpp $(libnativehelper-native)/toStringArray.cpp
crypto-native := $(android)/libcore/crypto/src/main/native crypto-native := $(android)/libcore/crypto/src/main/native
crypto-cpps := $(crypto-native)/org_conscrypt_NativeCrypto.cpp
ifeq ($(platform),windows) ifeq ($(platform),windows)
crypto-cpps := $(crypto-native)/org_conscrypt_NativeCrypto.cpp
android-cflags += -D__STDC_CONSTANT_MACROS android-cflags += -D__STDC_CONSTANT_MACROS
ifneq ($(arch),i386)
android-cflags += -fPIC
endif
blacklist = $(luni-native)/java_io_Console.cpp \ blacklist = $(luni-native)/java_io_Console.cpp \
$(luni-native)/java_lang_ProcessManager.cpp \ $(luni-native)/java_lang_ProcessManager.cpp \
$(luni-native)/libcore_io_OsConstants.cpp \
$(luni-native)/libcore_io_Posix.cpp \
$(luni-native)/libcore_io_AsynchronousCloseMonitor.cpp \
$(luni-native)/libcore_net_RawSocket.cpp \ $(luni-native)/libcore_net_RawSocket.cpp \
$(luni-native)/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp \ $(luni-native)/org_apache_harmony_xnet_provider_jsse_NativeCrypto.cpp \
$(luni-native)/AsynchronousSocketCloseMonitor.cpp \
$(luni-native)/NetworkUtilities.cpp
luni-cpps := $(filter-out $(blacklist),$(luni-cpps)) luni-cpps := $(filter-out $(blacklist),$(luni-cpps))
icu-libs := $(android)/external/icu4c/lib/sicuin.a \ icu-libs := $(android)/external/icu4c/lib/sicuin.a \
$(android)/external/icu4c/lib/sicuuc.a \ $(android)/external/icu4c/lib/sicuuc.a \
$(android)/external/icu4c/lib/sicudt.a $(android)/external/icu4c/lib/sicudt.a
platform-lflags := -lgdi32 platform-lflags := -lgdi32
else else
crypto-cpps := $(crypto-native)/org_conscrypt_NativeCrypto.cpp
android-cflags += -fPIC -DHAVE_SYS_UIO_H android-cflags += -fPIC -DHAVE_SYS_UIO_H
icu-libs := $(android)/external/icu4c/lib/libicui18n.a \ icu-libs := $(android)/external/icu4c/lib/libicui18n.a \
$(android)/external/icu4c/lib/libicuuc.a \ $(android)/external/icu4c/lib/libicuuc.a \
@ -781,10 +776,10 @@ ifeq ($(platform),windows)
endif endif
cxx = x86_64-w64-mingw32-g++ $(mflag) cxx = x86_64-w64-mingw32-g++ $(mflag)
cc = x86_64-w64-mingw32-gcc $(mflag) cc = x86_64-w64-mingw32-gcc $(mflag)
dlltool = x86_64-w64-mingw32-dlltool dlltool = dlltool
ar = x86_64-w64-mingw32-ar ar = ar
ranlib = x86_64-w64-mingw32-ranlib ranlib = ranlib
strip = x86_64-w64-mingw32-strip strip = strip
inc = "$(win64)/include" inc = "$(win64)/include"
lib = "$(win64)/lib" lib = "$(win64)/lib"
else else
@ -1599,6 +1594,8 @@ $(build)/android.dep: $(luni-javas) $(libdvm-javas) $(crypto-javas) \
$(xml-java)/* $(build)/android-src/ $(xml-java)/* $(build)/android-src/
sed -i -e 's/return ordinal - o.ordinal;/return ordinal - o.ordinal();/' \ sed -i -e 's/return ordinal - o.ordinal;/return ordinal - o.ordinal();/' \
$(build)/android-src/java/lang/Enum.java $(build)/android-src/java/lang/Enum.java
# sed makes this file read-only which in turn breaks re-builds; so marking it as writable
chmod +w $(build)/android-src/java/lang/Enum.java
find $(build)/android-src -name '*.java' > $(build)/android.txt find $(build)/android-src -name '*.java' > $(build)/android.txt
$(javac) -Xmaxerrs 1000 -d $(build)/android -sourcepath $(luni-java) \ $(javac) -Xmaxerrs 1000 -d $(build)/android -sourcepath $(luni-java) \
@$(build)/android.txt @$(build)/android.txt

View File

@ -23,6 +23,10 @@ extern "C" int JNI_OnLoad(JavaVM*, void*);
#include "avian/classpath-common.h" #include "avian/classpath-common.h"
#include "avian/process.h" #include "avian/process.h"
#ifdef PLATFORM_WINDOWS
const char* getErrnoDescription(int err); // This function is defined in mingw-extensions.cpp
#endif
using namespace vm; using namespace vm;
extern "C" AVIAN_EXPORT int64_t JNICALL extern "C" AVIAN_EXPORT int64_t JNICALL
@ -875,7 +879,7 @@ extern "C" const char*
jniStrError(int error, char* buffer, size_t length) jniStrError(int error, char* buffer, size_t length)
{ {
#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS
const char* s = strerror(error); const char* s = getErrnoDescription(error);
if (strlen(s) < length) { if (strlen(s) < length) {
strncpy(buffer, s, length); strncpy(buffer, s, length);
return buffer; return buffer;
@ -2332,9 +2336,6 @@ Avian_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8
void register_java_io_Console(_JNIEnv*) { } void register_java_io_Console(_JNIEnv*) { }
void register_java_lang_ProcessManager(_JNIEnv*) { } void register_java_lang_ProcessManager(_JNIEnv*) { }
void register_libcore_io_OsConstants(_JNIEnv*) { }
void register_libcore_io_AsynchronousCloseMonitor(_JNIEnv*) { }
void register_libcore_io_Posix(_JNIEnv*) { }
void register_libcore_net_RawSocket(_JNIEnv*) { } void register_libcore_net_RawSocket(_JNIEnv*) { }
void register_org_apache_harmony_xnet_provider_jsse_NativeCrypto(_JNIEnv*) { } void register_org_apache_harmony_xnet_provider_jsse_NativeCrypto(_JNIEnv*) { }