mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-20 19:41:34 +01:00
development/OpenJDK21: Added (Java Development Kit).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
parent
ae17f244fa
commit
189e0d4029
6 changed files with 342 additions and 0 deletions
253
development/OpenJDK21/OpenJDK21.SlackBuild
Normal file
253
development/OpenJDK21/OpenJDK21.SlackBuild
Normal file
|
@ -0,0 +1,253 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Slackware build script for OpenJDK21 LTS
|
||||
|
||||
# Copyright 2024 Lenard Spencer, Orlando, Florida, USA
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use of this script, with or without modification, is
|
||||
# permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of this script must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
cd $(dirname $0) ; CWD=$(pwd)
|
||||
|
||||
PRGNAM=OpenJDK21
|
||||
VERSION=${VERSION:-21.0.3}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_SBo}
|
||||
PKGTYPE=${PKGTYPE:-tgz}
|
||||
|
||||
if [ -z "$ARCH" ]; then
|
||||
case "$( uname -m )" in
|
||||
i?86) ARCH=i586 ;;
|
||||
arm*) ARCH=arm; echo "$ARCH is not supported, aborting."; exit 1 ;;
|
||||
*) ARCH=$( uname -m ) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
||||
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
TMP=${TMP:-/tmp/SBo}
|
||||
PKG=$TMP/package-$PRGNAM
|
||||
OUTPUT=${OUTPUT:-/tmp}
|
||||
|
||||
if [ "$ARCH" = "i586" ]; then
|
||||
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
||||
LIBDIRSUFFIX=""
|
||||
elif [ "$ARCH" = "x86_64" ]; then
|
||||
SLKCFLAGS="-O2 -fPIC"
|
||||
LIBDIRSUFFIX="64"
|
||||
else
|
||||
SLKCFLAGS="-O2"
|
||||
LIBDIRSUFFIX=""
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
rm -rf $PKG
|
||||
mkdir -p $TMP $PKG $OUTPUT
|
||||
cd $TMP
|
||||
rm -rf jdk21u-jdk-$VERSION-ga
|
||||
tar xvf $CWD/jdk21u-jdk-$VERSION-ga.tar.gz
|
||||
|
||||
# Building openjdk from source requires bootstrapping from either a
|
||||
# current or previous version of the (open)jdk binary installation.
|
||||
# Extract the OpenJDK20 binary to bootstrap
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
export BSDIR="OpenJDK-20.0.2-ga-linux-x86_64-bin"
|
||||
rm -rf $BSDIR
|
||||
tar xvf $CWD/OpenJDK-20.0.2-ga-linux-x86_64-bin.tar.xz
|
||||
else
|
||||
export BSDIR="OpenJDK-20.0.2-ga-linux-i586-bin"
|
||||
rm -rf $BSDIR
|
||||
tar xvf $CWD/OpenJDK-20.0.2-ga-linux-i586-bin.tar.xz
|
||||
fi
|
||||
|
||||
export BOOT_JAVA=$TMP/$BSDIR
|
||||
|
||||
# Unpack the jtreg package to run the tests:
|
||||
if [ "${TESTS:-no}" = "yes" ]; then
|
||||
rm -rf $TMP/jtreg{,-reports}
|
||||
tar xvf $CWD/jtreg-7.3.1+1.tar.gz
|
||||
JTREG="--with-jtreg=$TMP/jtreg"
|
||||
else
|
||||
JTREG=""
|
||||
fi
|
||||
|
||||
cd jdk21u-jdk-${VERSION}-ga
|
||||
echo "Setting permissions (this may take a while so be patient)"
|
||||
chown -R root:root .
|
||||
find -L . \
|
||||
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
|
||||
-o -perm 511 \) -exec chmod 755 {} \; -o \
|
||||
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
||||
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
||||
|
||||
unset JAVA_HOME # recommended by upstream
|
||||
|
||||
if [ "${USE_CCACHE:-no}" = "yes" ]; then
|
||||
USECCACHE="--enable-ccache"
|
||||
else
|
||||
USECCACHE=""
|
||||
fi
|
||||
|
||||
# By default, the OpenJDK21 build uses all available cpu cores.
|
||||
# We can override that here with the CORES= switch.
|
||||
if [ "${CORES:-""}" ]; then
|
||||
JVAL="$(echo $CORES | grep -o "[0-9]")" || true
|
||||
[ -n "$JVAL" ] && SJOBS="--with-jobs=$JVAL"
|
||||
TJOBS=$JVAL
|
||||
else
|
||||
SJOBS=""
|
||||
TJOBS="$(expr $(nproc) + 1)"
|
||||
fi
|
||||
|
||||
sh configure \
|
||||
--with-boot-jdk=${BOOT_JAVA} \
|
||||
--with-extra-cflags="$SLKCFLAGS" \
|
||||
--with-extra-cxxflags="$SLKCFLAGS" \
|
||||
--prefix=/usr \
|
||||
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
||||
--sysconfdir=/etc \
|
||||
--localstatedir=/var \
|
||||
--mandir=/usr/man \
|
||||
--docdir=/usr/doc/$PRGNAM-$VERSION \
|
||||
--with-giflib=system \
|
||||
--with-harfbuzz=system \
|
||||
--with-lcms=system \
|
||||
--with-libjpeg=system \
|
||||
--with-libpng=system \
|
||||
--with-zlib=system \
|
||||
--disable-precompiled-headers \
|
||||
--enable-libffi-bundling \
|
||||
--enable-unlimited-crypto \
|
||||
--disable-warnings-as-errors \
|
||||
--with-native-debug-symbols=none \
|
||||
$SJOBS \
|
||||
$USECCACHE \
|
||||
$JTREG \
|
||||
--build=$ARCH-slackware-linux
|
||||
|
||||
unset MAKEFLAGS # causes the build to fail if set
|
||||
make bootcycle-images
|
||||
|
||||
# Test the build using jtreg (thanks BLFS):
|
||||
if [ "$TESTS" = "yes" ]; then
|
||||
export JT_JAVA=$(echo $TMP/jdk21u-jdk-${VERSION}-ga/build/*/jdk)
|
||||
mkdir -p $TMP/jtreg-reports
|
||||
$TMP/jtreg/bin/jtreg -jdk:$JT_JAVA -automatic -ignore:quiet -v1 \
|
||||
-r:$TMP/jtreg-reports -avm -conc:$TJOBS test/jdk:tier1 test/langtools:tier1 \
|
||||
|| true
|
||||
unset JT_JAVA
|
||||
fi
|
||||
|
||||
# make install does not respect DESTDIR, so we must move the image:
|
||||
mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/java
|
||||
cp -a build/*/images/jdk/* $PKG/usr/lib$LIBDIRSUFFIX/java
|
||||
|
||||
for s in 16 24 32 48; do
|
||||
install -vDm644 src/java.desktop/unix/classes/sun/awt/X11/java-icon${s}.png \
|
||||
$PKG/usr/share/icons/hicolor/${s}x${s}/apps/java.png
|
||||
done
|
||||
# the 24x24 icon is missized, so we fix it here:
|
||||
cp $CWD/java.png $PKG/usr/share/icons/hicolor/24x24/apps
|
||||
|
||||
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
|
||||
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
||||
|
||||
# Create some necessary symlinks:
|
||||
( cd $PKG/usr/lib$LIBDIRSUFFIX
|
||||
ln -sf java $PRGNAM-$VERSION
|
||||
ln -sf java/lib/libjawt.so
|
||||
ln -sf java/lib/server/libjvm.so
|
||||
ln -sf java/lib/libjava.so
|
||||
ln -sf java/lib/libawt.so
|
||||
ln -sf java/lib/libawt_xawt.so
|
||||
ln -sf java/lib/libverify.so
|
||||
)
|
||||
|
||||
# Move man pages and compress:
|
||||
mv $PKG/usr/lib$LIBDIRSUFFIX/java/man $PKG/usr
|
||||
find $PKG/usr/man -type f -exec gzip -9 {} \;
|
||||
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
|
||||
|
||||
#Thanks AlienBOB for this part!
|
||||
# Generate a cacerts file from the certificates installed by ca-certificates
|
||||
# in Slackware - the "cacerts" in the OpenJDK sources may be outdated.
|
||||
# This requires 'trust' program from p11-kit:
|
||||
rm -f $PKG/usr/lib${LIBDIRSUFFIX}/java/lib/security/cacerts
|
||||
trust extract --format=java-cacerts --filter=ca-anchors --purpose=server-auth \
|
||||
$PKG/usr/lib${LIBDIRSUFFIX}/java/lib/security/cacerts
|
||||
|
||||
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cp -a \
|
||||
LICENSE ADDITIONAL_LICENSE_INFO ASSEMBLY_EXCEPTION README.md \
|
||||
$PKG/usr/doc/$PRGNAM-$VERSION
|
||||
( cd $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
ln -s ../../lib${LIBDIRSUFFIX}/$PRGNAM-$VERSION/legal
|
||||
ln -s ../../lib${LIBDIRSUFFIX}/$PRGNAM-$VERSION/release
|
||||
)
|
||||
|
||||
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
||||
|
||||
# Create desktop entries (Thanks BLFS):
|
||||
mkdir -p $PKG/usr/share/applications
|
||||
cat > $PKG/usr/share/applications/openjdk-java.desktop << EOF
|
||||
[Desktop Entry]
|
||||
Name=OpenJDK ${VERSION} Runtime
|
||||
Comment=OpenJDK Java ${VERSION} Runtime
|
||||
Exec=/usr/lib${LIBDIRSUFFIX}/java/bin/java -jar
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Icon=java
|
||||
MimeType=application/x-java-archive;application/java-archive;application/x-jar;
|
||||
NoDisplay=true
|
||||
EOF
|
||||
|
||||
cat > $PKG/usr/share/applications/openjdk-jconsole.desktop << EOF
|
||||
[Desktop Entry]
|
||||
Name=OpenJDK Java ${VERSION} Console
|
||||
Comment=OpenJDK ${VERSION} Console
|
||||
Keywords=java;console;monitoring
|
||||
Exec=/usr/lib${LIBDIRSUFFIX}/java/bin/jconsole
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Icon=java
|
||||
Categories=System;
|
||||
EOF
|
||||
|
||||
# Create /etc/profile.d scripts:
|
||||
mkdir -p $PKG/etc/profile.d
|
||||
cat > $PKG/etc/profile.d/jdk21.sh << EOF
|
||||
export JAVA_HOME=/usr/lib${LIBDIRSUFFIX}/java
|
||||
export PATH=\${PATH}:\${JAVA_HOME}/bin
|
||||
EOF
|
||||
|
||||
cat > $PKG/etc/profile.d/jdk21.csh << EOF
|
||||
setenv JAVA_HOME /usr/lib${LIBDIRSUFFIX}/java
|
||||
setenv PATH \${PATH}:\${JAVA_HOME}/bin
|
||||
EOF
|
||||
chmod 755 $PKG/etc/profile.d/*
|
||||
|
||||
mkdir -p $PKG/install
|
||||
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
||||
cat $CWD/slack-desc > $PKG/install/slack-desc
|
||||
|
||||
cd $PKG
|
||||
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
|
18
development/OpenJDK21/OpenJDK21.info
Normal file
18
development/OpenJDK21/OpenJDK21.info
Normal file
|
@ -0,0 +1,18 @@
|
|||
PRGNAM="OpenJDK21"
|
||||
VERSION="21.0.3"
|
||||
HOMEPAGE="https://openjdk.java.net/"
|
||||
DOWNLOAD="https://github.com/openjdk/jdk21u/archive/jdk-21.0.3-ga/jdk21u-jdk-21.0.3-ga.tar.gz \
|
||||
http://www.lenardspencer.net/linux/slackbuilds/OpenJDK-bootstraps/OpenJDK-20.0.2-ga-linux-i586-bin.tar.xz \
|
||||
https://anduin.linuxfromscratch.org/BLFS/OpenJDK/OpenJDK-21.0.2/jtreg-7.3.1+1.tar.gz"
|
||||
MD5SUM="d93fe3298131763cdc6c09702325e9ab \
|
||||
5003cd54ea62d4f10e2f1cfa6dfae890 \
|
||||
0038551ecaf37d0cd99832217f79e56d"
|
||||
DOWNLOAD_x86_64="https://github.com/openjdk/jdk21u/archive/jdk-21.0.3-ga/jdk21u-jdk-21.0.3-ga.tar.gz \
|
||||
http://www.lenardspencer.net/linux/slackbuilds/OpenJDK-bootstraps/OpenJDK-20.0.2-ga-linux-x86_64-bin.tar.xz \
|
||||
https://anduin.linuxfromscratch.org/BLFS/OpenJDK/OpenJDK-21.0.2/jtreg-7.3.1+1.tar.gz"
|
||||
MD5SUM_x86_64="d93fe3298131763cdc6c09702325e9ab \
|
||||
ac9a6afd411d7206c94d23a86d8b1cd3 \
|
||||
0038551ecaf37d0cd99832217f79e56d"
|
||||
REQUIRES=""
|
||||
MAINTAINER="Lenard Spencer"
|
||||
EMAIL="lenardrspencer@gmail.com"
|
37
development/OpenJDK21/README
Normal file
37
development/OpenJDK21/README
Normal file
|
@ -0,0 +1,37 @@
|
|||
OpenJDK21 is an open source implementation of version 21 (LTS) of the
|
||||
Java Development Kit, Standard Edition. It includes tools for
|
||||
developing, testing, and running programs written in Java.
|
||||
|
||||
This script builds the package from source using the packages listed
|
||||
in the .info file (the source tarball plus a binary of the prevous
|
||||
version to bootstrap from), so it is not necessary to have a jdk
|
||||
package installed to build this package. (See BIG FAT NOTE below.)
|
||||
|
||||
By default, the source package uses all available cores to build the
|
||||
package, but this can be controlled by passing CORES=<x> to the script.
|
||||
It is HIGHLY recommended to use all available cores as a single-core
|
||||
build can take quite a while, especially on slower machines.
|
||||
NOTE: The build normally fails with MAKEFLAGS set, but this script
|
||||
tempararily unsets so it can proceed.
|
||||
|
||||
The source is also able to use ccache to speed up rebuilds. To enable
|
||||
this, pass USE_CCACHE=yes to the script. NOTE: Some other SBo scripts
|
||||
recommend creating cc/c++/gcc/g++ symlinks to ccache in /usr/local/bin
|
||||
to use ccache, but this build fails on that, so make sure they are
|
||||
removed before running this script.
|
||||
|
||||
To test the build, pass TESTS=yes. This will unpack the jtreg package
|
||||
to run the tests. You should expect to see somewhere in the area of
|
||||
about 2 dozen failures and about 2 dozen errors. The reports will be
|
||||
saved in $TMP/jtreg-reports if you want to review them.
|
||||
|
||||
After installing this package you will need to logout/login to your
|
||||
machine as it will add new files to the /etc/profile.d folder.
|
||||
|
||||
NOTE: This needs almost 4 GB of storage to build, so if space on your
|
||||
/tmp is limited, you may want to adjust $TMP to another partition.
|
||||
|
||||
BIG FAT NOTE: If you have ANY JDK installed (jdk, zulu-openjdk,
|
||||
OpenJDK, etc.), you MUST first uninstall it, then logout/login to
|
||||
clear the JAVA_HOME folder from your $PATH in order to build this
|
||||
package, otherwise the build will fail.
|
15
development/OpenJDK21/doinst.sh
Normal file
15
development/OpenJDK21/doinst.sh
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
if [ -x /usr/bin/update-desktop-database ]; then
|
||||
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ -x /usr/bin/update-mime-database ]; then
|
||||
/usr/bin/update-mime-database usr/share/mime >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
|
||||
if [ -x /usr/bin/gtk-update-icon-cache ]; then
|
||||
/usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
|
BIN
development/OpenJDK21/java.png
Normal file
BIN
development/OpenJDK21/java.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
19
development/OpenJDK21/slack-desc
Normal file
19
development/OpenJDK21/slack-desc
Normal file
|
@ -0,0 +1,19 @@
|
|||
# HOW TO EDIT THIS FILE:
|
||||
# The "handy ruler" below makes it easier to edit a package description.
|
||||
# Line up the first '|' above the ':' following the base package name, and
|
||||
# the '|' on the right side marks the last column you can put a character in.
|
||||
# You must make exactly 11 lines for the formatting to be correct. It's also
|
||||
# customary to leave one space after the ':' except on otherwise blank lines.
|
||||
|
||||
|-----handy-ruler------------------------------------------------------|
|
||||
OpenJDK21: OpenJDK21 (open implementation of JDK 21 LTS)
|
||||
OpenJDK21:
|
||||
OpenJDK21: OpenJDK21 is an open source implementation of version 21 (LTS) of
|
||||
OpenJDK21: the Java Development Kit, Standard Edition. It includes tools for
|
||||
OpenJDK21: developing, testing, and running programs written in Java.
|
||||
OpenJDK21:
|
||||
OpenJDK21:
|
||||
OpenJDK21:
|
||||
OpenJDK21:
|
||||
OpenJDK21: homepage: https://OpenJDK.java.net/
|
||||
OpenJDK21:
|
Loading…
Reference in a new issue