diff --git a/classpath/java-lang.cpp b/classpath/java-lang.cpp index 6a33a7b7c1..4cafd5e6cc 100644 --- a/classpath/java-lang.cpp +++ b/classpath/java-lang.cpp @@ -54,7 +54,9 @@ # include "signal.h" # include "sys/time.h" # include "sys/types.h" +# ifndef __ANDROID__ # include "sys/sysctl.h" +# endif # include "sys/utsname.h" # include "sys/wait.h" diff --git a/makefile b/makefile index fe83a35381..f6c474c0dc 100755 --- a/makefile +++ b/makefile @@ -353,6 +353,21 @@ ifeq ($(platform),freebsd) "-I$(JAVA_HOME)/include/freebsd" -I$(src) -pthread cflags = $(build-cflags) endif +ifeq ($(platform),android) + asm = arm + pointer-size = 4 + no-psabi = -Wno-psabi + toolchain = $(ANDROID_NDK)/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86/ + cflags = -std=gnu++0x -I$(ANDROID_NDK)/platforms/android-5/arch-arm/usr/include \ + -I$(toolchain)/lib/gcc/arm-linux-androideabi/4.7/include $(common-cflags) + cflags += -marm $(no-psabi) + + cxx = $(toolchain)/bin/arm-linux-androideabi-g++ + cc = $(toolchain)/bin/arm-linux-androideabi-gcc + ar = $(toolchain)/bin/arm-linux-androideabi-ar + ranlib = $(toolchain)/bin/arm-linux-androideabi-ranlib + strip = $(toolchain)/bin/arm-linux-androideabi-strip +endif ifeq ($(platform),darwin) target-format = macho diff --git a/src/posix.cpp b/src/posix.cpp index da575eb8a4..c033956ad5 100644 --- a/src/posix.cpp +++ b/src/posix.cpp @@ -12,10 +12,21 @@ # define __STDC_CONSTANT_MACROS #endif +#include "sys/types.h" #ifdef __APPLE__ # include "CoreFoundation/CoreFoundation.h" # include "sys/ucontext.h" # undef assert +#elif defined __ANDROID__ +# include /* for sigcontext */ +# include /* for stack_t */ +typedef struct ucontext { + unsigned long uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + struct sigcontext uc_mcontext; + unsigned long uc_sigmask; +} ucontext_t; #else # if defined __FreeBSD__ # include "limits.h" @@ -24,7 +35,7 @@ #endif #include "sys/mman.h" -#include "sys/types.h" + #include "sys/stat.h" #include "sys/time.h" #include "time.h" @@ -37,10 +48,10 @@ #include "stdint.h" #include "dirent.h" #include "sched.h" - #include "arch.h" #include "system.h" + #define ACQUIRE(x) MutexResource MAKE_NAME(mutexResource_) (x) using namespace vm;