From 51db0c8bd6642abae01976fe352aec77f23d9525 Mon Sep 17 00:00:00 2001 From: khanhduytran0 Date: Sun, 26 Feb 2023 08:31:03 +0700 Subject: [PATCH] Fix build and patch --- android-wrapped-clang | 2 +- android-wrapped-clang++ | 2 +- buildjdk.sh | 6 ++++++ clonejdk.sh | 7 ------- patches/jdk17u_android.diff | 25 ++++++++++++++++++------- patches/jdk17u_ios.diff | 19 ++----------------- 6 files changed, 28 insertions(+), 33 deletions(-) diff --git a/android-wrapped-clang b/android-wrapped-clang index 72fcad7..945a838 100755 --- a/android-wrapped-clang +++ b/android-wrapped-clang @@ -5,6 +5,6 @@ if [ "$1" = "--version" ]; then echo "This is free software; see the source for copying conditions. There is NO" echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." else - exec $thecc "${@/-fno-var-tracking-assignments/}" + exec $thecc -Wno-unknown-warning-option "${@/-fno-var-tracking-assignments/}" # exec $thecc "$theargs" fi diff --git a/android-wrapped-clang++ b/android-wrapped-clang++ index de82cfa..a83e473 100755 --- a/android-wrapped-clang++ +++ b/android-wrapped-clang++ @@ -6,6 +6,6 @@ if [ "$1" = "--version" ]; then echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." else # theargs= - exec $thecxx "${@/-fno-var-tracking-assignments/}" + exec $thecxx -Wno-unknown-warning-option "${@/-fno-var-tracking-assignments/}" # exec $thecxx "$theargs" fi diff --git a/buildjdk.sh b/buildjdk.sh index 2e39982..9f634cf 100755 --- a/buildjdk.sh +++ b/buildjdk.sh @@ -77,6 +77,12 @@ if [ "$BUILD_IOS" != "1" ]; then git apply --reject --whitespace=fix ../patches/jdk17u_android.diff || echo "git apply failed (Android patch set)" else git apply --reject --whitespace=fix ../patches/jdk17u_ios.diff || echo "git apply failed (iOS patch set)" + + # Hack: exclude building macOS stuff + desktop_mac=src/java.desktop/macosx + mv ${desktop_mac} ${desktop_mac}_NOTIOS + mkdir -p ${desktop_mac}/native + mv ${desktop_mac}_NOTIOS/native/libjsound ${desktop_mac}/native/ fi # rm -rf build diff --git a/clonejdk.sh b/clonejdk.sh index bdf73fd..70cb717 100755 --- a/clonejdk.sh +++ b/clonejdk.sh @@ -2,10 +2,3 @@ set -e git clone --depth 1 https://github.com/openjdk/jdk17u openjdk -if [ "$BUILD_IOS" == "1" ]; then - # Hack: exclude building macOS stuff - desktop_mac=openjdk/src/java.desktop/macosx - mv ${desktop_mac} ${desktop_mac}_NOTIOS - mkdir -p ${desktop_mac}/native - mv ${desktop_mac}_NOTIOS/native/libjsound ${desktop_mac}/native/ -fi diff --git a/patches/jdk17u_android.diff b/patches/jdk17u_android.diff index c4514c5..2c05d5e 100644 --- a/patches/jdk17u_android.diff +++ b/patches/jdk17u_android.diff @@ -463,6 +463,24 @@ index ae0c73dcb..e2c9a21f7 100644 // Loads .dll/.so and // in case of error it checks if .dll/.so was built for the // same architecture as Hotspot is running on +@@ -1863,6 +1901,7 @@ void * os::Linux::dll_load_in_vmthread(const char *filename, char *ebuf, + } + + const char* os::Linux::dll_path(void* lib) { ++#ifdef RTLD_DI_LINKMAP + struct link_map *lmap; + const char* l_path = NULL; + assert(lib != NULL, "dll_path parameter must not be NULL"); +@@ -1872,6 +1911,9 @@ const char* os::Linux::dll_path(void* lib) { + l_path = lmap->l_name; + } + return l_path; ++#else ++ return NULL; ++#endif + } + + static bool _print_ascii_file(const char* filename, outputStream* st, const char* hdr = NULL) { @@ -2538,6 +2576,19 @@ void os::jvm_path(char *buf, jint buflen) { CAST_FROM_FN_PTR(address, os::jvm_path), dli_fname, sizeof(dli_fname), NULL); @@ -2403,13 +2421,6 @@ index 9df8be1e6..12f9b4de3 100644 #endif if (err == -1) { throwUnixException(env, errno); -@@ -1330,4 +1378,4 @@ Java_sun_nio_fs_UnixNativeDispatcher_flistxattr(JNIEnv* env, jclass clazz, - if (res == (size_t)-1) - throwUnixException(env, errno); - return (jint)res; --} -\ No newline at end of file -+} diff --git a/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c b/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c index fbd6ce9d1..94d238f8e 100644 --- a/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c diff --git a/patches/jdk17u_ios.diff b/patches/jdk17u_ios.diff index faa8d3a..feece9b 100644 --- a/patches/jdk17u_ios.diff +++ b/patches/jdk17u_ios.diff @@ -214,14 +214,6 @@ diff --git a/make/modules/java.desktop/Lib.gmk b/make/modules/java.desktop/Lib.g index 22b07289a..c505e7e08 100644 --- a/make/modules/java.desktop/Lib.gmk +++ b/make/modules/java.desktop/Lib.gmk -@@ -55,6 +55,7 @@ ifeq ($(call isTargetOs, aix), false) - LIBJSOUND_TOOLCHAIN := TOOLCHAIN_LINK_CXX - endif - -+ # -framework AudioUnit - $(eval $(call SetupJdkLibrary, BUILD_LIBJSOUND, \ - NAME := jsound, \ - TOOLCHAIN := $(LIBJSOUND_TOOLCHAIN), \ @@ -69,7 +70,7 @@ ifeq ($(call isTargetOs, aix), false) LIBS_unix := -ljava -ljvm, \ LIBS_linux := $(ALSA_LIBS), \ @@ -275,7 +267,7 @@ index 96273fd0a..cb4e06a39 100644 -framework Cocoa \ -framework OpenGL \ -framework Metal \ -@@ -353,12 +353,12 @@ TARGETS += $(BUILD_LIBJAVAJPEG) +@@ -353,7 +353,7 @@ TARGETS += $(BUILD_LIBJAVAJPEG) ################################################################################ # Mac and Windows only use the native AWT lib, do not build libawt_headless @@ -284,12 +276,6 @@ index 96273fd0a..cb4e06a39 100644 LIBAWT_HEADLESS_EXTRA_SRC := \ common/font \ -- common/java2d \ - $(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \ -+ common/java2d \ - # - - LIBAWT_HEADLESS_EXCLUDES := medialib @@ -496,7 +496,7 @@ ifeq ($(call isTargetOs, windows), true) LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \ X11TextRenderer.c @@ -650,7 +636,7 @@ new file mode 100644 index 000000000..c7143a769 --- /dev/null +++ b/src/hotspot/os_cpu/bsd_aarch64/tcg-apple-jit.h -@@ -0,0 +1,86 @@ +@@ -0,0 +1,85 @@ +/* + * Apple Silicon APRR functions for JIT handling + * @@ -736,7 +722,6 @@ index 000000000..c7143a769 +#endif + +#endif /* define TCG_APPLE_JIT_H */ -+ diff --git a/src/java.base/macosx/native/libjava/OSXSCSchemaDefinitions.h b/src/java.base/macosx/native/libjava/OSXSCSchemaDefinitions.h new file mode 100644 index 000000000..122df59ec