From 5b1b8affad1a74a3c89029409452ce6d048c35bc Mon Sep 17 00:00:00 2001 From: Lenard Spencer Date: Sat, 2 Apr 2022 10:36:57 +0700 Subject: development/OpenJDK17: Added (open implementation of JDK 17 LTS). Signed-off-by: Willy Sudiarto Raharjo --- development/OpenJDK17/OpenJDK17.SlackBuild | 245 +++++++++++++++++++++++++++++ development/OpenJDK17/OpenJDK17.info | 18 +++ development/OpenJDK17/README | 32 ++++ development/OpenJDK17/doinst.sh | 9 ++ development/OpenJDK17/slack-desc | 19 +++ 5 files changed, 323 insertions(+) create mode 100644 development/OpenJDK17/OpenJDK17.SlackBuild create mode 100644 development/OpenJDK17/OpenJDK17.info create mode 100644 development/OpenJDK17/README create mode 100644 development/OpenJDK17/doinst.sh create mode 100644 development/OpenJDK17/slack-desc (limited to 'development/OpenJDK17') diff --git a/development/OpenJDK17/OpenJDK17.SlackBuild b/development/OpenJDK17/OpenJDK17.SlackBuild new file mode 100644 index 000000000000..25857f9dabbe --- /dev/null +++ b/development/OpenJDK17/OpenJDK17.SlackBuild @@ -0,0 +1,245 @@ +#!/bin/bash + +# Slackware build script for OpenJDK17 LTS + +# Copyright 2021, 2022 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=OpenJDK17 +VERSION=${VERSION:-17.0.2} +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 the variable PRINT_PACKAGE_NAME is set, then this script will report what +# the name of the created package would be, and then exit. This information +# could be useful to other scripts. +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 jdk17u-jdk-$VERSION-ga +tar xvf $CWD/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 OpenJDK16 binary to bootstrap +if [ "$ARCH" = "x86_64" ]; then + export BSDIR="OpenJDK-16.0.2-ga-linux-x86_64-bin" + rm -rf $BSDIR + tar xvf $CWD/OpenJDK-16.0.2-ga-linux-x86_64-bin.tar.xz +else + export BSDIR="OpenJDK-16.0.2-ga-linux-i586-bin" + rm -rf $BSDIR + tar xvf $CWD/OpenJDK-16.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-6.1+1.tar.gz + JTREG="--with-jtreg=$TMP/jtreg" +else + JTREG="" +fi + +cd jdk17u-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 OpenJDK17 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-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 again BLFS): +if [ "$TESTS" = "yes" ]; then + export JT_JAVA=$(echo $TMP/jdk17u-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 + +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 + +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 Java ${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=Application;System; +EOF + +# Create /etc/profile.d scripts: +mkdir -p $PKG/etc/profile.d +cat > $PKG/etc/profile.d/jdk17.sh << EOF +export JAVA_HOME=/usr/lib${LIBDIRSUFFIX}/java +export PATH=\${PATH}:\${JAVA_HOME}/bin +EOF + +cat > $PKG/etc/profile.d/jdk17.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 diff --git a/development/OpenJDK17/OpenJDK17.info b/development/OpenJDK17/OpenJDK17.info new file mode 100644 index 000000000000..03a59d84357a --- /dev/null +++ b/development/OpenJDK17/OpenJDK17.info @@ -0,0 +1,18 @@ +PRGNAM="OpenJDK17" +VERSION="17.0.2" +HOMEPAGE="https://openjdk.java.net/" +DOWNLOAD="https://github.com/openjdk/jdk17u/archive/jdk-17.0.2-ga.tar.gz \ + http://www.lenardspencer.net/linux/slackbuilds/OpenJDK-bootstraps/OpenJDK-16.0.2-ga-linux-i586-bin.tar.xz \ + https://anduin.linuxfromscratch.org/BLFS/OpenJDK/OpenJDK-17.0.1/jtreg-6.1+1.tar.gz" +MD5SUM="94344312ee396394964f51933936f7aa \ + 064dd51497ce0602eab218c638d8bbf2 \ + 49e6bfa2506e96f461a01f9421a0961c" +DOWNLOAD_x86_64="https://github.com/openjdk/jdk17u/archive/jdk-17.0.2-ga.tar.gz \ + http://www.lenardspencer.net/linux/slackbuilds/OpenJDK-bootstraps/OpenJDK-16.0.2-ga-linux-x86_64-bin.tar.xz \ + https://anduin.linuxfromscratch.org/BLFS/OpenJDK/OpenJDK-17.0.1/jtreg-6.1+1.tar.gz" +MD5SUM_x86_64="94344312ee396394964f51933936f7aa \ + 76a6b4e0d8eb8ff6fdeb504e1f502d86 \ + 49e6bfa2506e96f461a01f9421a0961c" +REQUIRES="" +MAINTAINER="Lenard Spencer" +EMAIL="lenardrspencer@gmail.com" diff --git a/development/OpenJDK17/README b/development/OpenJDK17/README new file mode 100644 index 000000000000..d3c65f9fc018 --- /dev/null +++ b/development/OpenJDK17/README @@ -0,0 +1,32 @@ +OpenJDK17 is an open source implementation of version 17 (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. + +By default, the source package uses all available cores to build the +package, but this can be controlled by passing CORES= 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 30 to 40 failures and about a 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. + +MANY thanks to the BLFS community for maintaining 32-bit builds of the +later versions of OpenJDK we use for bootstrapping. diff --git a/development/OpenJDK17/doinst.sh b/development/OpenJDK17/doinst.sh new file mode 100644 index 000000000000..ee4d704d0429 --- /dev/null +++ b/development/OpenJDK17/doinst.sh @@ -0,0 +1,9 @@ + +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 + diff --git a/development/OpenJDK17/slack-desc b/development/OpenJDK17/slack-desc new file mode 100644 index 000000000000..be13b84bcc99 --- /dev/null +++ b/development/OpenJDK17/slack-desc @@ -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------------------------------------------------------| +OpenJDK17: OpenJDK17 (open implementation of JDK 17 LTS) +OpenJDK17: +OpenJDK17: OpenJDK17 is an open source implementation of version 17 (LTS) of +OpenJDK17: the Java Development Kit, Standard Edition. It includes tools for +OpenJDK17: developing, testing, and running programs written in Java. +OpenJDK17: +OpenJDK17: +OpenJDK17: +OpenJDK17: +OpenJDK17: homepage: https://OpenJDK.java.net/ +OpenJDK17: -- cgit v1.2.3