Skip to content

Commit

Permalink
openjdk21: fix build for clang 16 (#25879)
Browse files Browse the repository at this point in the history
  • Loading branch information
breun authored Sep 22, 2024
1 parent 9c921e4 commit ac5d8b9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
24 changes: 14 additions & 10 deletions java/openjdk21/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@

PortSystem 1.0

name openjdk21
set feature 21
name openjdk${feature}
# See https://openjdk-sources.osci.io/openjdk21/ for the version and build number that matches the latest '-ga' version
version 21.0.4
version ${feature}.0.4
set build 7
revision 0
revision 1
categories java devel
supported_archs x86_64 arm64
license GPL-2+
maintainers {breun.nl:nils @breun} openmaintainer
description OpenJDK 21
long_description JDK 21 builds of OpenJDK, the Open-Source implementation \
description OpenJDK ${feature} (Long Term Support)
long_description JDK ${feature} builds of OpenJDK, the Open-Source implementation \
of the Java Platform, Standard Edition, and related projects.
homepage https://openjdk.org/projects/jdk/21/
master_sites https://openjdk-sources.osci.io/openjdk21/
homepage https://openjdk.org/projects/jdk/${feature}/
master_sites https://openjdk-sources.osci.io/openjdk${feature}/
distname openjdk-${version}-ga
use_xz yes
worksrcdir jdk-${version}+${build}
Expand All @@ -41,6 +42,9 @@ pre-patch {
reinplace "s|xmacosx|xwindows|g" ${worksrcpath}/make/autoconf/lib-freetype.m4
}

# Temporary workaround for clang 16: https://trac.macports.org/ticket/70819
patchfiles JDK-8340341-clang-16-workaround.patch

set tpath ${prefix}/Library/Java
use_xcode yes
use_configure yes
Expand Down Expand Up @@ -146,7 +150,7 @@ test.cmd ${bundle_dir}/Home/bin/java
test.target --version

set jvms /Library/Java/JavaVirtualMachines
set jdk ${jvms}/jdk-21-macports.jdk
set jdk ${jvms}/jdk-${feature}-macports.jdk

destroot {
xinstall -m 755 -d ${destroot}${prefix}${jdk}
Expand All @@ -170,5 +174,5 @@ export JAVA_HOME=${jdk}/Contents/Home
"

livecheck.type regex
livecheck.url https://openjdk-sources.osci.io/openjdk21/
livecheck.regex openjdk-(21\.\[0-9.\]+)-ga
livecheck.url ${master_sites}
livecheck.regex openjdk-(${feature}\.\[0-9.\]+)-ga
14 changes: 14 additions & 0 deletions java/openjdk21/files/JDK-8340341-clang-16-workaround.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- make/hotspot/lib/JvmOverrideFiles.gmk.orig 2024-06-04 18:47:50
+++ make/hotspot/lib/JvmOverrideFiles.gmk 2024-09-22 23:45:41
@@ -89,6 +89,11 @@
# for the clang bug was still needed.
BUILD_LIBJVM_loopTransform.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)

+ # See JDK-8340341
+ ifeq "$(firstword $(subst ., ,$(CXX_VERSION_NUMBER)))" "16"
+ BUILD_LIBJVM_stackMapTable.cpp_CXXFLAGS := "-O1"
+ endif
+
# The following files are compiled at various optimization
# levels due to optimization issues encountered at the
# default level. The Clang compiler issues a compile

0 comments on commit ac5d8b9

Please sign in to comment.