Skip to content

Commit

Permalink
backport openjdk21
Browse files Browse the repository at this point in the history
  • Loading branch information
hadfl committed Dec 18, 2024
1 parent a72ece8 commit 4ae823a
Show file tree
Hide file tree
Showing 46 changed files with 25,351 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/meta/omnios-build-tools.p5m
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ depend fmri=pkg://$(PKGPUBLISHER)/library/security/openssl-3 type=require
depend fmri=pkg://$(PKGPUBLISHER)/library/zlib type=require
depend fmri=pkg://$(PKGPUBLISHER)/network/rsync type=require
depend fmri=pkg://$(PKGPUBLISHER)/runtime/java/openjdk17 type=require
depend fmri=pkg://$(PKGPUBLISHER)/runtime/java/openjdk21 type=require
depend fmri=pkg://$(PKGPUBLISHER)/runtime/perl type=require
depend fmri=pkg://$(PKGPUBLISHER)/runtime/python-27 type=require
depend fmri=pkg://$(PKGPUBLISHER)/runtime/python-311 type=require
Expand Down
142 changes: 142 additions & 0 deletions build/openjdk21/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#!/usr/bin/bash
#
# {{{ CDDL HEADER
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
# }}}
#
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.

. ../../lib/build.sh

PROG=openjdk
VER=21.0.5+11
PKG=runtime/java/openjdk21
SUMMARY="openjdk ${VER%%.*}"
DESC="Open-source implementation of the twenty-first edition of the "
DESC+="Java SE Platform"

# The full jdk version string is:
# feature.interim.update.patch.extra1.extra2.extra3-pre+build-opt
# We pass 'opt' explicitly to configure (see below) and currently don't parse
# the 'extra' values out of the version string.
if [[ $VER =~ ^([0-9]+)(\.([0-9]+))?(\.([0-9]+))?(\.([0-9]+))?\+([0-9]+)$ ]]
then
V_FEATURE=${BASH_REMATCH[1]}
V_INTERIM=${BASH_REMATCH[3]}
V_UPDATE=${BASH_REMATCH[5]}
V_PATCH=${BASH_REMATCH[7]}
V_BUILD=${BASH_REMATCH[8]}
else
logerr "Could not parse openjdk version $VER"
fi

# check ooce/fonts/liberation for current version
LIBERATIONFONTSVER=2.1.5
SKIP_LICENCES="SILv1.1"

set_arch 64

set_builddir "jdk${V_FEATURE}u-jdk-${VER//+/-}"

BMI_EXPECTED=1
SKIP_RTIME_CHECK=1
NO_SONAME_EXPECTED=1

BUILD_DEPENDS_IPS="
system/header/header-audio
runtime/java/openjdk21
ooce/library/fontconfig
ooce/library/freetype2
ooce/print/cups
"

RUN_DEPENDS_IPS="runtime/java/jexec"

VERHUMAN="jdk${V_FEATURE}u${V_UPDATE}${V_PATCH:+.}$V_PATCH-b$V_BUILD"
IVER="$V_FEATURE.$V_INTERIM"

IROOT=usr/jdk/instances
IFULL=$IROOT/$PROG$IVER

OOCEPREFIX=/opt/ooce

XFORM_ARGS="
-DVER=$V_FEATURE
-DIVER=$IVER
-DIROOT=$IROOT
-DIFULL=$IFULL
-DLFVER=$LIBERATIONFONTSVER
"

# The JDK build framework does not use the -j option to make.
NO_PARALLEL_MAKE=1

CONFIGURE_OPTS="
--with-version-string=$VER
--with-version-opt=omnios-$RELVER
--with-toolchain-type=gcc
--with-boot-jdk=/$IFULL
--enable-deprecated-ports=yes
--enable-headless-only
--disable-ccache
--with-native-debug-symbols=none
--disable-warnings-as-errors
--enable-unlimited-crypto
--disable-dtrace
--with-cacerts-file=/etc/ssl/java/cacerts
--x-includes=$OOCEPREFIX/include
--with-cups-include=$OOCEPREFIX/include
--with-freetype=bundled
--with-fontconfig-include=$OOCEPREFIX/include
DATE=$GNUBIN/date
"
CONFIGURE_OPTS[amd64]+="
--x-libraries=$OOCEPREFIX/lib/amd64
"
CONFIGURE_OPTS[amd64_WS]="
--with-extra-cflags=\"$CFLAGS ${CFLAGS[amd64]}\"
--with-extra-cxxflags=\"$CXXFLAGS ${CXXFLAGS[amd64]}\"
"

MAKE_ARGS="all"

make_install() {
logmsg "Installing openjdk to $DESTDIR"

logcmd mkdir -p $DESTDIR/$IFULL || logerr "--- mkdir failed"
logcmd rsync -a $TMPDIR/$BUILDDIR/images/jdk/ $DESTDIR/$IFULL/ \
|| logerr "--- rsync failed"

# Install liberation fonts to cover the 'core fonts' set
# See also patches/fontpath.patch
DDIR=$DESTDIR/$IFULL/lib/fonts
logcmd mkdir -p $DDIR || logerr "mkdir fonts"
logcmd cp $TMPDIR/$LFDIR/Liberation*.ttf $DDIR \
|| logerr "failed to copy fonts"
}

init
download_source $PROG "jdk-$VER"
patch_source

# Also download the liberation fonts archive. Fonts from here will be
# provided to satisfy the core fonts.
LFDIR=liberation-fonts-ttf-$LIBERATIONFONTSVER
BUILDDIR=$LFDIR download_source liberation-fonts $LFDIR

prep_build autoconf-like -oot
chmod +x $CONFIGURE_CMD
build -noctf
VER=${VER%%+*} DASHREV=$V_BUILD make_package
clean_up

# Vim hints
# vim:ts=4:sw=4:et:fdm=marker
53 changes: 53 additions & 0 deletions build/openjdk21/local.mog
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.

# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.

<transform file path=.*/src.zip$ -> drop>
<transform path=$(IFULL)/demo -> drop>

<transform file path=$(IFULL)/conf -> set preserve renamenew>
<transform file path=$(IFULL)/conf -> set overlay allow>

<transform file path=.*/cacerts$ -> drop>
link path=$(IFULL)/jre/lib/security/cacerts target=/etc/ssl/java/cacerts
link path=$(IFULL)/lib/security/cacerts target=/etc/ssl/java/cacerts

<transform file path=$(IFULL)/lib/[^/]+$ \
-> set pkg.depend.bypass-generate libjvm\.so>
<transform file path=$(IFULL)/lib/lible\.so$ \
-> add pkg.depend.bypass-generate libjava\.so>
# stop pulling in X11 stuff from omnios-extra
<transform file path=$(IFULL)/lib/libjawt\.so$ \
-> add pkg.depend.bypass-generate .*/lib[xX].*>

# Mediated binaries
<transform file path=$(IFULL)/bin/(.*) -> emit \
link path=usr/bin/%<1> target=../java/bin/%<1> \
mediator=openjdk mediator-version=$(VER)>

# Mediated man pages
<transform file path=$(IFULL)/man/man1/(.*) -> emit \
link path=usr/share/man/man1/%<1> target=../../../java/man/man1/%<1> \
mediator=openjdk mediator-version=$(VER)>

# Add mediated link for /usr/java
link path=usr/java target=jdk/openjdk$(IVER) \
mediator=openjdk mediator-version=$(VER)

link path=usr/jdk/openjdk$(IVER) target=instances/openjdk$(IVER)

license $(IFULL)/legal/java.base/LICENSE \
license="GPLv2/with Classpath Exception"

license ../liberation-fonts-ttf-$(LFVER)/LICENSE license=SILv1.1

<transform file path=$(IFULL)/conf -> set preserve renamenew>

Loading

0 comments on commit 4ae823a

Please sign in to comment.