diff --git a/buildjdk.sh b/buildjdk.sh index 215b025..67e1b6b 100755 --- a/buildjdk.sh +++ b/buildjdk.sh @@ -61,8 +61,15 @@ ln -s -f $CUPS_DIR/cups $ANDROID_INCLUDE/ cd openjdk # Apply patches -git reset --hard -git apply --reject --whitespace=fix ../patches/jdk8u_android.diff || echo "git apply failed" +if [ "$BUILD_IOS" != "1" ]; then + git reset --hard + git apply --reject --whitespace=fix ../patches/jdk8u_android.diff || echo "git apply failed (universal patch set)" + if [ "$TARGET_JDK" == "arm" ] then + #TODO: make separate aarch32 patch set + else + git apply --reject --whitespace=fix ../patches/jdk8u_android_main.diff || echo "git apply failed (main non-universal patch set)" + fi +fi # --with-extra-cxxflags="$CXXFLAGS -Dchar16_t=uint16_t -Dchar32_t=uint32_t" \ # --with-extra-cflags="$CPPFLAGS" \ diff --git a/patches/jdk8u_android.diff b/patches/jdk8u_android.diff index c806229..ffc152e 100644 --- a/patches/jdk8u_android.diff +++ b/patches/jdk8u_android.diff @@ -2174,25 +2174,6 @@ index 2d3880b363..77eb2ac3fd 100644 // no precompiled headers #include "classfile/classLoader.hpp" #include "classfile/systemDictionary.hpp" -@@ -93,11 +95,17 @@ - # include - # include - # include --# include - # include -+#ifndef __ANDROID__ - # include -+#endif - # include -+#if !defined(__ANDROID__) -+# include - # include -+#else -+# include -+#endif - # include - # include - # include @@ -105,6 +113,10 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC @@ -2359,18 +2340,6 @@ index 2d3880b363..77eb2ac3fd 100644 strncpy(saved_jvm_path, buf, MAXPATHLEN); } -@@ -2977,7 +3048,11 @@ extern "C" JNIEXPORT int fork1() { return fork(); } - // Handle request to load libnuma symbol version 1.1 (API v1). If it fails - // load symbol from base version instead. - void* os::Linux::libnuma_dlsym(void* handle, const char *name) { -+#ifndef __ANDROID__ - void *f = dlvsym(handle, name, "libnuma_1.1"); -+#else -+ void *f = NULL; -+#endif - if (f == NULL) { - f = dlsym(handle, name); - } @@ -2987,7 +3062,11 @@ void* os::Linux::libnuma_dlsym(void* handle, const char *name) { // Handle request to load libnuma symbol version 1.2 (API v2) only. // Return NULL if the symbol is not defined in this particular version. @@ -2477,18 +2446,6 @@ index 2d3880b363..77eb2ac3fd 100644 // create binary file, rewriting existing file if required int os::create_binary_file(const char* path, bool rewrite_existing) { int oflags = O_WRONLY | O_CREAT; -@@ -5867,7 +5978,11 @@ bool os::is_thread_cpu_time_supported() { - // Linux doesn't yet have a (official) notion of processor sets, - // so just return the system wide load average. - int os::loadavg(double loadavg[], int nelem) { -+#ifdef __ANDROID__ -+ return -1; -+#else - return ::getloadavg(loadavg, nelem); -+#endif // !__ANDROID__ - } - - void os::pause() { diff --git a/hotspot/src/os/linux/vm/os_perf_linux.cpp b/hotspot/src/os/linux/vm/os_perf_linux.cpp index 0d1f75810a..087166c545 100644 --- a/hotspot/src/os/linux/vm/os_perf_linux.cpp diff --git a/patches/jdk8u_android_main.diff b/patches/jdk8u_android_main.diff new file mode 100644 index 0000000..3aedd84 --- /dev/null +++ b/patches/jdk8u_android_main.diff @@ -0,0 +1,47 @@ +diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp +index 2d3880b363..77eb2ac3fd 100644 +--- a/hotspot/src/os/linux/vm/os_linux.cpp ++++ b/hotspot/src/os/linux/vm/os_linux.cpp +@@ -93,11 +95,17 @@ + # include + # include + # include +-# include + # include ++#ifndef __ANDROID__ + # include ++#endif + # include ++#if !defined(__ANDROID__) ++# include + # include ++#else ++# include ++#endif + # include + # include + # include +@@ -2977,7 +3048,11 @@ extern "C" JNIEXPORT int fork1() { return fork(); } + // Handle request to load libnuma symbol version 1.1 (API v1). If it fails + // load symbol from base version instead. + void* os::Linux::libnuma_dlsym(void* handle, const char *name) { ++#ifndef __ANDROID__ + void *f = dlvsym(handle, name, "libnuma_1.1"); ++#else ++ void *f = NULL; ++#endif + if (f == NULL) { + f = dlsym(handle, name); + } +@@ -5867,7 +5978,11 @@ bool os::is_thread_cpu_time_supported() { + // Linux doesn't yet have a (official) notion of processor sets, + // so just return the system wide load average. + int os::loadavg(double loadavg[], int nelem) { ++#ifdef __ANDROID__ ++ return -1; ++#else + return ::getloadavg(loadavg, nelem); ++#endif // !__ANDROID__ + } + + void os::pause() { \ No newline at end of file