Skip to content
Snippets Groups Projects
Commit 7f3ed83d authored by Jazzzny's avatar Jazzzny
Browse files

Add jdk17 patches

parent b89a42fc
Branches
Tags
No related merge requests found
name: Compile OpenJDK with jdk-macos-legacy patches
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
name: Build OpenJDK versions
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Clone OpenJDK
run: |
git clone https://github.com/openjdk/jdk17u.git --depth 1 --branch jdk-17.0.12+2
cd jdk17u
- name: Apply patches
run: |
git apply ../jdk-macos-legacy/patches/17/10.8.patch
git apply ../jdk-macos-legacy/patches/17/awtwindow.patch
git apply ../jdk-macos-legacy/patches/17/remove_disconnectx.patch
git apply ../jdk-macos-legacy/patches/17/remove_metal_backend.patch
- name: Run patch scripts
run: |
bash ../jdk-macos-legacy/patches/17/remove_metal_backend.sh .
.DS_Store
\ No newline at end of file
...@@ -19,7 +19,7 @@ Builds of the OpenJDK are compiled from release tags on a regular basis. These b ...@@ -19,7 +19,7 @@ Builds of the OpenJDK are compiled from release tags on a regular basis. These b
2. Apply the patch files (located in the patches/`version number` folders) to the OpenJDK source code for the version you want to build 2. Apply the patch files (located in the patches/`version number` folders) to the OpenJDK source code for the version you want to build
3. Run any shell scripts in the patches/`version number` folder. All scripts have the following syntax: 3. Run any shell scripts in the patches/`version number` folder. All scripts have the following syntax:
```shell ```shell
./script.sh /path/to/openjdk/source ./script.sh /path/to/openjdk/source/folder
``` ```
4. Follow the build instructions for OpenJDK 4. Follow the build instructions for OpenJDK
......
diff --git a/make/autoconf/flags.m4 b/make/autoconf/flags.m4
index 1dbcbe05ed6..9ee8990b118 100644
--- a/make/autoconf/flags.m4
+++ b/make/autoconf/flags.m4
@@ -136,7 +136,7 @@ AC_DEFUN([FLAGS_SETUP_MACOSX_VERSION],
if test "x$OPENJDK_TARGET_CPU_ARCH" = xaarch64; then
MACOSX_VERSION_MIN=11.00.00
else
- MACOSX_VERSION_MIN=10.12.0
+ MACOSX_VERSION_MIN=10.8.0
fi
MACOSX_VERSION_MIN_NODOTS=${MACOSX_VERSION_MIN//\./}
diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js
index 4ee43abe774..a1492ea80f9 100644
--- a/make/conf/jib-profiles.js
+++ b/make/conf/jib-profiles.js
@@ -446,7 +446,7 @@ var getJibProfilesProfiles = function (input, common, data) {
target_cpu: "x64",
dependencies: ["devkit", "gtest", "pandoc"],
configure_args: concat(common.configure_args_64bit, "--with-zlib=system",
- "--with-macosx-version-max=10.12.00",
+ "--with-macosx-version-max=10.8.00",
"--enable-compatible-cds-alignment",
// Use system SetFile instead of the one in the devkit as the
// devkit one may not work on Catalina.
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m
index 150e82c6965..965760b3646 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m
@@ -1104,10 +1104,12 @@ + (AWTWindow *) lastKeyWindow {
{
JNI_COCOA_ENTER(env);
[ThreadUtilities performOnMainThreadWaiting:NO block:^(){
- if (allowAutomaticTabbing) {
- [NSWindow setAllowsAutomaticWindowTabbing:YES];
- } else {
- [NSWindow setAllowsAutomaticWindowTabbing:NO];
+ if ([NSWindow respondsToSelector:@selector(setAllowsAutomaticWindowTabbing:)]) {
+ if (allowAutomaticTabbing) {
+ [NSWindow setAllowsAutomaticWindowTabbing:YES];
+ } else {
+ [NSWindow setAllowsAutomaticWindowTabbing:NO];
+ }
}
}];
JNI_COCOA_EXIT(env);
diff --git a/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c b/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c
index 902a816419d..553126950fa 100644
--- a/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c
+++ b/src/java.base/unix/native/libnio/ch/DatagramChannelImpl.c
@@ -50,28 +50,21 @@ Java_sun_nio_ch_DatagramChannelImpl_disconnect0(JNIEnv *env, jclass clazz,
jint fd = fdval(env, fdo);
int rv;
-#if defined(__APPLE__)
- // On macOS systems we use disconnectx
- rv = disconnectx(fd, SAE_ASSOCID_ANY, SAE_CONNID_ANY);
-#else
+
SOCKETADDRESS sa;
- memset(&sa, 0, sizeof(sa));
- #if defined(_ALLBSD_SOURCE)
- sa.sa.sa_family = isIPv6 ? AF_INET6 : AF_INET;
- #else
- sa.sa.sa_family = AF_UNSPEC;
- #endif
socklen_t len = isIPv6 ? sizeof(struct sockaddr_in6) :
sizeof(struct sockaddr_in);
+
+ memset(&sa, 0, sizeof(sa));
+#if defined(_ALLBSD_SOURCE)
+ sa.sa.sa_family = isIPv6 ? AF_INET6 : AF_INET;
+#else
+ sa.sa.sa_family = AF_UNSPEC;
+#endif
rv = connect(fd, &sa.sa, len);
#endif
-#if defined(_ALLBSD_SOURCE) && !defined(__APPLE__)
- // On _ALLBSD_SOURCE except __APPLE__ we consider EADDRNOTAVAIL
- // error to be OK and ignore it. __APPLE__ systems are excluded
- // in this check since for __APPLE__ systems, unlike other BSD systems,
- // we issue a "disconnectx" call (a few lines above),
- // which isn't expected to return this error code.
+#if defined(_ALLBSD_SOURCE)
if (rv < 0 && errno == EADDRNOTAVAIL)
rv = errno = 0;
#elif defined(_AIX)
diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk
index 3bbff03638b..1acf6528992 100644
--- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk
+++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk
@@ -161,7 +161,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBAWT, \
LIBS_macosx := -lmlib_image \
-framework Cocoa \
-framework OpenGL \
- -framework Metal \
-framework JavaRuntimeSupport \
-framework ApplicationServices \
-framework AudioToolbox, \
@@ -736,8 +735,7 @@ ifeq ($(ENABLE_HEADLESS_ONLY), false)
-framework ApplicationServices \
-framework Foundation \
-framework Security \
- -framework Cocoa \
- -framework Metal
+ -framework Cocoa
else ifeq ($(call isTargetOs, windows), true)
LIBSPLASHSCREEN_LIBS += kernel32.lib user32.lib gdi32.lib delayimp.lib $(WIN_JAVA_LIB) jvm.lib
else
@@ -798,7 +796,6 @@ ifeq ($(call isTargetOs, macosx), true)
libawt_lwawt/awt \
libawt_lwawt/font \
libawt_lwawt/java2d/opengl \
- libawt_lwawt/java2d/metal \
include \
common/awt/debug \
common/java2d/opengl \
@@ -834,7 +831,6 @@ ifeq ($(call isTargetOs, macosx), true)
-framework AudioToolbox \
-framework Carbon \
-framework Cocoa \
- -framework Metal \
-framework Security \
-framework ExceptionHandling \
-framework JavaRuntimeSupport \
@@ -870,31 +866,6 @@ else
endif
ifeq ($(call isTargetOs, macosx), true)
- SHADERS_SRC := $(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/shaders.metal
- SHADERS_SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/native/java.desktop/libosxui
- SHADERS_AIR := $(SHADERS_SUPPORT_DIR)/shaders.air
- SHADERS_LIB := $(INSTALL_LIBRARIES_HERE)/shaders.metallib
-
- $(eval $(call SetupExecute, metal_shaders, \
- INFO := Running metal on $(notdir $(SHADERS_SRC)) (for libosxui.dylib), \
- DEPS := $(SHADERS_SRC), \
- OUTPUT_FILE := $(SHADERS_AIR), \
- SUPPORT_DIR := $(SHADERS_SUPPORT_DIR), \
- COMMAND := $(METAL) -c -std=osx-metal2.0 \
- -mmacosx-version-min=$(MACOSX_METAL_VERSION_MIN) \
- -o $(SHADERS_AIR) $(SHADERS_SRC), \
- ))
-
- $(eval $(call SetupExecute, metallib_shaders, \
- INFO := Running metallib on $(notdir $(SHADERS_AIR)) (for libosxui.dylib), \
- DEPS := $(SHADERS_AIR), \
- OUTPUT_FILE := $(SHADERS_LIB), \
- SUPPORT_DIR := $(SHADERS_SUPPORT_DIR), \
- COMMAND := $(METALLIB) -o $(SHADERS_LIB) $(SHADERS_AIR), \
- ))
-
- TARGETS += $(SHADERS_LIB)
-
$(eval $(call SetupJdkLibrary, BUILD_LIBOSXUI, \
NAME := osxui, \
OPTIMIZATION := LOW, \
@@ -909,7 +880,6 @@ ifeq ($(call isTargetOs, macosx), true)
-L$(INSTALL_LIBRARIES_HERE), \
LIBS := -lawt -losxapp -lawt_lwawt \
-framework Cocoa \
- -framework Metal \
-framework Carbon \
-framework ApplicationServices \
-framework JavaRuntimeSupport \
@@ -917,7 +887,6 @@ ifeq ($(call isTargetOs, macosx), true)
))
TARGETS += $(BUILD_LIBOSXUI)
- $(BUILD_LIBOSXUI): $(SHADERS_LIB)
$(BUILD_LIBOSXUI): $(BUILD_LIBAWT)
diff --git a/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java b/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java
index 64117b8999e..301b1dbee1f 100644
--- a/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java
+++ b/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java
@@ -89,7 +89,6 @@ public final class MTLGraphicsConfig extends CGraphicsConfig
private final Object disposerReferent = new Object();
private final int maxTextureSize;
- private static native boolean isMetalFrameworkAvailable();
private static native boolean tryLoadMetalLibrary(int displayID, String shaderLib);
private static native long getMTLConfigInfo(int displayID, String mtlShadersLib);
@@ -100,7 +99,7 @@ public final class MTLGraphicsConfig extends CGraphicsConfig
private static native int nativeGetMaxTextureSize();
static {
- mtlAvailable = isMetalFrameworkAvailable();
+ mtlAvailable = false;
}
private MTLGraphicsConfig(CGraphicsDevice device,
diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTSurfaceLayers.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTSurfaceLayers.m
index 1cc4abfaaad..2af0689c044 100644
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTSurfaceLayers.m
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTSurfaceLayers.m
@@ -29,7 +29,6 @@
#import "JNIUtilities.h"
#import <QuartzCore/CATransaction.h>
-#import <QuartzCore/CAMetalLayer.h>
@implementation AWTSurfaceLayers
@@ -71,8 +70,7 @@ - (void) setLayer:(CALayer *)newLayer {
// Updates back buffer size of the layer if it's an OpenGL/Metal layer
// including all OpenGL/Metal sublayers
+ (void) repaintLayersRecursively:(CALayer*)aLayer {
- if ([aLayer isKindOfClass:[CAOpenGLLayer class]] ||
- [aLayer isKindOfClass:[CAMetalLayer class]]) {
+ if ([aLayer isKindOfClass:[CAOpenGLLayer class]]) {
[aLayer setNeedsDisplay];
}
for(CALayer *child in aLayer.sublayers) {
# syntax: [remove-metal-backend.sh] [path-to-openjdk-repo]
if [ $# -ne 1 ]; then
echo "Usage: remove-metal-backend.sh [path-to-openjdk-repo]"
exit 1
fi
REPO_PATH=$1
if [ ! -d $REPO_PATH ]; then
echo "Error: $REPO_PATH is not a directory"
exit 1
fi
rm -rf $REPO_PATH/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment