development/OpenJDK11: Added (open implementation of JDK 11).

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Lenard Spencer 2022-04-02 08:13:47 +07:00 committed by Willy Sudiarto Raharjo
parent be960eafde
commit f7414e3de2
No known key found for this signature in database
GPG key ID: 3F617144D7238786
5 changed files with 323 additions and 0 deletions

View file

@ -0,0 +1,245 @@
#!/bin/bash
# Slackware build script for OpenJDK11
# 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=OpenJDK11
VERSION=${VERSION:-11.0.14.1}
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=""
BSARCH="i686"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
BSARCH="x86_64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf jdk11u-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 OpenJDK10 binary to bootstrap
# (thanks to BLFS for the binary packages):
rm -rf $TMP/OpenJDK-10.0.2+13-$BSARCH-bin
tar xvf $CWD/OpenJDK-10.0.2+13-$BSARCH-bin.tar.xz
export BOOT_JAVA=$TMP/OpenJDK-10.0.2+13-$BSARCH-bin
# Unpack the jtreg package to run the tests:
if [ "${TESTS:-no}" = "yes" ]; then
rm -rf $TMP/jtreg{,-reports}
tar xvf $CWD/jtreg-4.2.0-tip.tar.gz
JTREG="--with-jtreg=$TMP/jtreg"
else
JTREG=""
fi
cd jdk11u-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, OpenJDK11 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/jdk11u-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
# fix Japanese folder (remove symlink):
( cd $PKG/usr/man
rm ja
mv ja_JP.UTF-8 ja )
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 \
$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/jdk11.sh << EOF
export JAVA_HOME=/usr/lib${LIBDIRSUFFIX}/java
export PATH=\${PATH}:\${JAVA_HOME}/bin
EOF
cat > $PKG/etc/profile.d/jdk11.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

View file

@ -0,0 +1,18 @@
PRGNAM="OpenJDK11"
VERSION="11.0.14.1"
HOMEPAGE="https://openjdk.java.net/"
DOWNLOAD="https://github.com/openjdk/jdk11u/archive/jdk-11.0.14.1-ga.tar.gz \
https://anduin.linuxfromscratch.org/BLFS/OpenJDK/OpenJDK-10.0.2/OpenJDK-10.0.2+13-i686-bin.tar.xz \
https://anduin.linuxfromscratch.org/BLFS/OpenJDK/OpenJDK-16.0.2/jtreg-4.2.0-tip.tar.gz"
MD5SUM="9e357196b0a0d50e4955882bfa97a2f9 \
d66af9a4303ce9d0c93c92945048e361 \
11818f2ae4be19d2c7ae6501be60ee98"
DOWNLOAD_x86_64="https://github.com/openjdk/jdk11u/archive/jdk-11.0.14.1-ga.tar.gz \
https://anduin.linuxfromscratch.org/BLFS/OpenJDK/OpenJDK-10.0.2/OpenJDK-10.0.2+13-x86_64-bin.tar.xz \
https://anduin.linuxfromscratch.org/BLFS/OpenJDK/OpenJDK-16.0.2/jtreg-4.2.0-tip.tar.gz"
MD5SUM_x86_64="9e357196b0a0d50e4955882bfa97a2f9 \
a550f9e2aa1e8437346bb52a7b36052e \
11818f2ae4be19d2c7ae6501be60ee98"
REQUIRES=""
MAINTAINER="Lenard Spencer"
EMAIL="lenardrspencer@gmail.com"

View file

@ -0,0 +1,32 @@
OpenJDK11 is an open source implementation of version 11 (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=<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 it 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 20 to 30 failures and about 30 to 40 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.

View file

@ -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

View 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------------------------------------------------------|
OpenJDK11: OpenJDK11 (open implementation of JDK 11)
OpenJDK11:
OpenJDK11: OpenJDK11 is an open source implementation of version 11 of the
OpenJDK11: Java Development Kit, Standard Edition. It includes tools for
OpenJDK11: developing, testing, and running programs written in Java.
OpenJDK11:
OpenJDK11:
OpenJDK11:
OpenJDK11:
OpenJDK11: homepage: https://OpenJDK.java.net/
OpenJDK11: