/
Portfile
169 lines (144 loc) · 6.31 KB
/
Portfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# -*- 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
name openjdk17
# See https://openjdk-sources.osci.io/openjdk17/ for the version and build number that matches the latest '-ga' version
version 17.0.11
set build 9
revision 1
categories java devel
supported_archs x86_64 arm64
license GPL-2+
maintainers {outlook.com:usersword123 @usersxx} openmaintainer
description OpenJDK 17
long_description JDK 17 builds of OpenJDK, the Open-Source implementation \
of the Java Platform, Standard Edition, and related projects.
homepage https://openjdk.org/projects/jdk/17/
master_sites https://openjdk-sources.osci.io/openjdk17/
distname openjdk-${version}-ga
use_xz yes
worksrcdir jdk-${version}+${build}
checksums rmd160 ddb86858821a2bd81ecf7067984dd6495337a093 \
sha256 d16068baa8124125fb3dffd6a18fbea01df3f01658cfe4fbfcc85e4d48ab2bbb \
size 65851368
depends_lib port:freetype \
port:libiconv
depends_build port:openjdk17-bootstrap \
port:autoconf \
port:gmake \
port:bash
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
}
set tpath ${prefix}/Library/Java
use_xcode yes
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-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/openjdk17-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=release
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]} {
default_variants-append +server
}
build.type gnu
build.target images
use_parallel_build no
set jdkn jdk-${version}.jdk
set bundle_dir build/release/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://openjdk-sources.osci.io/openjdk17/
livecheck.regex openjdk-(17\.\[0-9.\]+)-ga