Files
2026-04-24 02:09:16 +02:00

189 lines
7.1 KiB
Tcl

# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup github 1.0
set feature 11
name openjdk${feature}
# See https://github.com/openjdk/jdk11u/tags for the version and build number that matches the latest tag that ends with '-ga'
set openjdk_version ${feature}.0.31
set build 11
revision 0
github.setup openjdk jdk${feature}u ${openjdk_version}+${build} jdk-
github.tarball_from archive
version ${openjdk_version}
categories java devel
supported_archs x86_64 arm64
license GPL-2+
maintainers {breun @breun} openmaintainer
description OpenJDK ${feature} (Long Term Support)
long_description {*}${description} \
\n\nJDK ${feature} builds of OpenJDK, the Open-Source implementation \
of the Java Platform, Standard Edition, and related projects.
homepage https://openjdk.org/projects/jdk/${feature}/
checksums rmd160 47c8d67e7445a9f6ceae2f6a764f98a2ae610924 \
sha256 d409a47d58b5ab9deb344b185d48395b4cce8ab84ec4229aa4589b4f65ff59b4 \
size 116728518
depends_lib port:freetype \
port:libiconv
depends_build port:autoconf \
port:gmake \
port:bash \
port:openjdk${feature}-bootstrap
pre-patch {
reinplace "s|libffi.so.?|libffi.?.dylib|g" ${worksrcpath}/make/autoconf/lib-ffi.m4
reinplace "s|xmacosx|xwindows|g" ${worksrcpath}/make/autoconf/lib-freetype.m4
reinplace "s|assert|vmassert|g" ${worksrcpath}/src/hotspot/share/jfr/periodic/jfrNetworkUtilization.cpp
}
# Workaround for clang 16.0-16.1: https://trac.macports.org/ticket/70819
patchfiles JDK-8340341-clang-16-workaround.patch
set tpath ${prefix}/Library/Java
use_configure yes
configure.cmd ${prefix}/bin/bash configure
configure.pre_args --prefix=${tpath}
set bug_url "https://trac.macports.org/newticket?port=${name}"
# default configure args
configure.args --with-debug-level=release \
--with-native-debug-symbols=none \
--with-version-string=${version}+${build} \
--with-target-bits=64 \
--with-sysroot=`xcrun --sdk macosx --show-sdk-path` \
--with-extra-cflags="${configure.cflags}" \
--with-extra-cxxflags="${configure.cxxflags}" \
--with-extra-ldflags="${configure.ldflags}" \
--with-boot-jdk=/Library/Java/JavaVirtualMachines/openjdk${feature}-bootstrap/Contents/Home \
--with-freetype=system \
--with-freetype-include=${prefix}/include/freetype2 \
--with-freetype-lib=${prefix}/lib \
--disable-warnings-as-errors \
--disable-precompiled-headers \
--with-vendor-name="MacPorts" \
--with-vendor-url="https://www.macports.org" \
--with-vendor-bug-url="${bug_url}" \
--with-vendor-vm-bug-url="${bug_url}" \
--with-conf-name=openjdk${feature}
if {[option configure.ccache]} {
# replace MacPorts ccache integration into JDK
configure.ccache no
depends_build-append path:bin/ccache:ccache
configure.args-append --enable-ccache \
--with-ccache-dir=${ccache_dir}
}
variant release \
conflicts debug optimized \
description {OpenJDK with no debug information, all optimizations and no asserts} {
configure.args-append --with-debug-level=release
}
variant optimized \
conflicts debug release \
description {OpenJDK with no debug information, all optimizations, no asserts and HotSpot is 'optimized'} {
configure.args-append --with-debug-level=optimized
}
variant debug \
conflicts optimized release \
description {OpenJDK with debug information, all optimizations and all asserts} {
configure.args-append --with-debug-level=fastdebug
configure.args-delete --with-native-debug-symbols=none
}
variant client \
conflicts core minimal server zero \
description {JVM with normal interpreter, C1 and no C2 compiler} {
configure.args-append --with-jvm-variants=client
}
variant server \
conflicts client core minimal zero \
description {JVM with normal interpreter, and a tiered C1/C2 compiler} {
configure.args-append --with-jvm-variants=server
}
variant minimal \
conflicts client core server zero \
description {JVM with reduced form of normal interpreter having C1, no C2 compiler and optional features stripped out} {
configure.args-append --with-jvm-variants=minimal
}
variant core \
conflicts client minimal server zero \
description {JVM with normal interpreter only and no compiler} {
configure.args-append --with-jvm-variants=core
}
variant zero \
conflicts client core minimal server \
description {JVM with C++ based interpreter only, no compiler} {
configure.args-append --with-jvm-variants=zero \
--with-libffi=${prefix} \
--enable-libffi-bundling
depends_lib-append port:libffi
}
if {![variant_isset debug] && ![variant_isset optimized] && ![variant_isset release]} {
default_variants-append +release
}
if {![variant_isset client] && ![variant_isset core] && ![variant_isset minimal] && ![variant_isset server] && ![variant_isset zero]} {
if {${os.platform} eq "darwin" && ${os.major} < 16} {
default_variants-append +zero
} else {
default_variants-append +server
}
}
if {${configure.build_arch} eq "arm64"} {
configure.args-delete --with-target-bits=64
configure.args-append --openjdk-target=aarch64-apple-darwin
} elseif {${configure.build_arch} eq "x86_64"} {
configure.post_args
}
build.type gnu
build.target images
use_parallel_build no
set jdkn jdk-${version}.jdk
set bundle_dir build/openjdk${feature}/images/jdk-bundle/${jdkn}/Contents
test.run yes
test.cmd ${bundle_dir}/Home/bin/java
test.target --version
set pathb ${tpath}/JavaVirtualMachines/${name}
set jvms /Library/Java/JavaVirtualMachines
set jdk ${jvms}/${name}
destroot {
xinstall -m 755 -d ${destroot}${pathb}
copy ${worksrcpath}/${bundle_dir} ${destroot}${pathb}
# macOS Java tools expect to find Java virtual machines under /Library/Java/JavaVirtualMachines, so let's create a symlink there
xinstall -m 755 -d ${destroot}${jvms}
ln -s ${pathb} ${destroot}${jdk}
}
# macOS Java tools expect to find Java virtual machines under /Library/Java/JavaVirtualMachines, which is not under ${prefix}.
destroot.violate_mtree yes
post-destroot {
delete ${worksrcpath}
}
notes "
If you want to make ${name} the default JDK, add this to shell profile:
export JAVA_HOME=${jdk}/Contents/Home
"
livecheck.type regex
livecheck.url https://github.com/openjdk/jdk${feature}u/tags
livecheck.regex jdk-(\[0-9.\]+)-ga
livecheck.version ${version}