Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reintroduce the OpenJDK build tool #11

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
45 changes: 45 additions & 0 deletions OracleSolaris_OpenJDK_Builder/README.md
@@ -0,0 +1,45 @@
# Oracle Solaris OpenJDK Builder

This project builds all OpenJDK versions from 9 till latest 17 for Solaris 11.4.

Note that this was done based on great job of Peter Tribble:
https://ptribble.blogspot.com/2021/12/keeping-java-alive-on-illumos.html

At this time only amd64 platform is expected to work (not SPARC).

You just need to have:
- Oracle Solaris 11.4 (at least S11.4.24) with installed system header files
- Mercurial
- Git
- JDK 8
- GCC 10 (for JDK-13 and above)
- Oracle Solaris Studio 12.4 (for JDK-9, JDK-10, JDK-11, and JDK-12)
- Internet access for OpenJDK repositories

Alternatively you can use your OpenJDK repository mirrors and set them via
environment variables JDK_REPO (for http://hg.openjdk.java.net/jdk-updates)
and JDK_GITHUB_REPO (for JDK_GITHUB_REPO=https://github.com/openjdk).
You will need both.


Example:

```
git clone https://github.com/oracle/oraclesolaris-contrib.git
cd oraclesolaris-contrib/OracleSolaris_OpenJDK_Builder/
./build-all.sh
Building Openjdk 9...
Building Openjdk 10...
Building Openjdk 11...
Building Openjdk 12...
Building Openjdk 13...
Building Openjdk 14...
Building Openjdk 16...
Building Openjdk 17...
```

--

After the build you should inspect build_dir/ for your OpenJDK binaries.

Your build log files will be available in logs/ directory.
19 changes: 19 additions & 0 deletions OracleSolaris_OpenJDK_Builder/build-all.sh
@@ -0,0 +1,19 @@
#!/bin/bash

WS="`pwd`"
LOG_DIR="$WS/logs"
rm -rf $LOG_DIR
mkdir -p $LOG_DIR

for VERSION in {9..18}; do
echo "Building Openjdk $VERSION..."
bash $WS/jdk-$VERSION.sh > $LOG_DIR/jdk-$VERSION.log 2>&1

# Check for expected sucesful build output.
tail -1 $LOG_DIR/jdk-$VERSION.log \
| grep "Finished building target \'bundles\' in configuration " > /dev/null
if [ $? -ne 0 ] ; then
echo "Build error. See: $LOG_DIR/jdk-$VERSION.log"
exit 1
fi
done
31 changes: 31 additions & 0 deletions OracleSolaris_OpenJDK_Builder/common.sh
@@ -0,0 +1,31 @@
WS="`pwd`"
BUILD_DIR="$WS/build_dir"

if [ $VERSION -lt 16 ]; then
SRC_DIR="jdk${VERSION}u"
else
SRC_DIR="jdk${VERSION}"
fi

if [ `uname -p` = 'sparc' ] ; then
JDK_PLATFORM="sparcv9"
else
JDK_PLATFORM="x86_64"
fi

STUDIO="/opt/solarisstudio12.4/bin"

GCC=/usr/gcc/10/bin/gcc
GXX=/usr/gcc/10/bin/g++

mkdir -p "$BUILD_DIR"
rm -rf "$BUILD_DIR"/$SRC_DIR
test -z $JDK_REPO && JDK_REPO=http://hg.openjdk.java.net/jdk-updates
test -z $JDK_GITHUB_REPO && JDK_GITHUB_REPO=https://github.com/openjdk

function apply_patch_series {
cat "$WS/patches-$VERSION/series" | while read patch args; do
echo $patch | grep ^\# > /dev/null && continue
gpatch --batch --forward --strip=1 $args -i "$WS/patches-$VERSION/$patch"
done
}
31 changes: 31 additions & 0 deletions OracleSolaris_OpenJDK_Builder/jdk-10.sh
@@ -0,0 +1,31 @@
set -xe

VERSION=10

. common.sh

# S11.4.21 have updated CUPS version which causes problem to old Studio compiler
function fix_cups_versioning {
test `uname -v | cut -d . -f 3` -lt 21 && return
gsed 's;_CUPS_NONNULL(...);_CUPS_NONNULL();' /usr/include/cups/versioning.h > my-cups-versioning.h
gsed -i 's;_CUPS_API_AVAILABLE(...);_CUPS_API_AVAILABLE();' my-cups-versioning.h
gsed -i 's;_CUPS_API_DEPRECATED(...);_CUPS_API_DEPRECATED();' my-cups-versioning.h
FILE=CUPSfuncs.c
for f in jdk/src/java.desktop/unix/native/common/awt/$FILE src/java.desktop/unix/native/common/awt/$FILE; do
[ ! -f "$f" ] || gsed -i "/#include <dlfcn.h>/a#include \"`pwd`/my-cups-versioning.h\"" "$f"
done
}

BOOT_JDK="$BUILD_DIR/jdk9u/build/solaris-$JDK_PLATFORM-normal-server-release/jdk"
PATH="$STUDIO:/usr/bin"

CONFIGURE_OPTIONS+=" --with-boot-jdk=$BOOT_JDK --disable-hotspot-gtest"

hg clone ${JDK_REPO}/$SRC_DIR "$BUILD_DIR"/$SRC_DIR
cd "$BUILD_DIR"/$SRC_DIR

fix_cups_versioning
apply_patch_series

PATH="$PATH" bash ./configure ${CONFIGURE_OPTIONS}
gmake bundles
18 changes: 18 additions & 0 deletions OracleSolaris_OpenJDK_Builder/jdk-11.sh
@@ -0,0 +1,18 @@
set -xe

VERSION=11

. common.sh

BOOT_JDK="$BUILD_DIR/jdk10u/build/solaris-$JDK_PLATFORM-normal-server-release/jdk"
PATH="$STUDIO:/usr/bin"

CONFIGURE_OPTIONS+=" --with-boot-jdk=$BOOT_JDK --disable-hotspot-gtest"

hg clone ${JDK_REPO}/$SRC_DIR "$BUILD_DIR"/$SRC_DIR
cd "$BUILD_DIR"/$SRC_DIR

apply_patch_series

PATH="$PATH" bash ./configure ${CONFIGURE_OPTIONS}
gmake bundles
24 changes: 24 additions & 0 deletions OracleSolaris_OpenJDK_Builder/jdk-12.sh
@@ -0,0 +1,24 @@
set -xe

VERSION=12

. common.sh

BOOT_JDK="$BUILD_DIR/jdk11u/build/solaris-$JDK_PLATFORM-normal-server-release/jdk"
PATH="$STUDIO:/usr/bin"

CONFIGURE_OPTIONS+=" --with-boot-jdk=$BOOT_JDK"

# OpenJDK 12 has some issues:
# - https://bugs.openjdk.java.net/browse/JDK-8211081
# - shenandoahgc doesn't build on Solaris i386 (and is not supported on sparc)
CONFIGURE_OPTIONS+=" --with-jvm-features=-shenandoahgc"
CONFIGURE_OPTIONS+=" --disable-warnings-as-errors --disable-hotspot-gtest"

hg clone ${JDK_REPO}/$SRC_DIR "$BUILD_DIR"/$SRC_DIR
cd "$BUILD_DIR"/$SRC_DIR

apply_patch_series

PATH="$PATH" bash ./configure ${CONFIGURE_OPTIONS}
gmake bundles
27 changes: 27 additions & 0 deletions OracleSolaris_OpenJDK_Builder/jdk-13.sh
@@ -0,0 +1,27 @@
set -xe

VERSION=13

. common.sh

BOOT_JDK="$BUILD_DIR/jdk12u/build/solaris-$JDK_PLATFORM-server-release/jdk"
PATH="/usr/bin:/usr/gnu/bin"

CONFIGURE_OPTIONS+=" --enable-unlimited-crypto"
CONFIGURE_OPTIONS+=" --with-boot-jdk=$BOOT_JDK"
CONFIGURE_OPTIONS+=" --with-native-debug-symbols=none"
CONFIGURE_OPTIONS+=" --with-toolchain-type=gcc"
CONFIGURE_OPTIONS+=" --disable-hotspot-gtest"
CONFIGURE_OPTIONS+=" --disable-dtrace"
CONFIGURE_OPTIONS+=" --disable-warnings-as-errors"
CONFIGURE_OPTIONS+=" AS=/usr/gnu/bin/as"
CONFIGURE_OPTIONS+=" CC=$GCC"
CONFIGURE_OPTIONS+=" CXX=$GXX"

hg clone ${JDK_REPO}/$SRC_DIR "$BUILD_DIR"/$SRC_DIR
cd "$BUILD_DIR"/$SRC_DIR

apply_patch_series

PATH="$PATH" bash ./configure ${CONFIGURE_OPTIONS}
gmake bundles
28 changes: 28 additions & 0 deletions OracleSolaris_OpenJDK_Builder/jdk-14.sh
@@ -0,0 +1,28 @@
set -xe

VERSION=14

. common.sh

BOOT_JDK="$BUILD_DIR/jdk13u/build/solaris-$JDK_PLATFORM-server-release/jdk"
PATH="/usr/bin:/usr/gnu/bin"

CONFIGURE_OPTIONS+=" --enable-unlimited-crypto"
CONFIGURE_OPTIONS+=" --enable-deprecated-ports=yes"
CONFIGURE_OPTIONS+=" --with-boot-jdk=$BOOT_JDK"
CONFIGURE_OPTIONS+=" --with-native-debug-symbols=none"
CONFIGURE_OPTIONS+=" --with-toolchain-type=gcc"
CONFIGURE_OPTIONS+=" --disable-hotspot-gtest"
CONFIGURE_OPTIONS+=" --disable-dtrace"
CONFIGURE_OPTIONS+=" --disable-warnings-as-errors"
CONFIGURE_OPTIONS+=" AS=/usr/gnu/bin/as"
CONFIGURE_OPTIONS+=" CC=$GCC"
CONFIGURE_OPTIONS+=" CXX=$GXX"

hg clone ${JDK_REPO}/$SRC_DIR "$BUILD_DIR"/$SRC_DIR
cd "$BUILD_DIR"/$SRC_DIR

apply_patch_series

PATH="$PATH" bash ./configure ${CONFIGURE_OPTIONS}
gmake bundles
28 changes: 28 additions & 0 deletions OracleSolaris_OpenJDK_Builder/jdk-15.sh
@@ -0,0 +1,28 @@
set -xe

VERSION=15

. common.sh

BOOT_JDK="$BUILD_DIR/jdk14u/build/solaris-$JDK_PLATFORM-server-release/jdk"
PATH="/usr/bin:/usr/gnu/bin"

CONFIGURE_OPTIONS+=" --enable-unlimited-crypto"
CONFIGURE_OPTIONS+=" --enable-deprecated-ports=yes"
CONFIGURE_OPTIONS+=" --with-boot-jdk=$BOOT_JDK"
CONFIGURE_OPTIONS+=" --with-native-debug-symbols=none"
CONFIGURE_OPTIONS+=" --with-toolchain-type=gcc"
CONFIGURE_OPTIONS+=" --disable-hotspot-gtest"
CONFIGURE_OPTIONS+=" --disable-dtrace"
CONFIGURE_OPTIONS+=" --disable-warnings-as-errors"
CONFIGURE_OPTIONS+=" AS=/usr/gnu/bin/as"
CONFIGURE_OPTIONS+=" CC=$GCC"
CONFIGURE_OPTIONS+=" CXX=$GXX"

hg clone ${JDK_REPO}/$SRC_DIR "$BUILD_DIR"/$SRC_DIR
cd "$BUILD_DIR"/$SRC_DIR

apply_patch_series

PATH="$PATH" bash ./configure ${CONFIGURE_OPTIONS}
gmake bundles
28 changes: 28 additions & 0 deletions OracleSolaris_OpenJDK_Builder/jdk-16.sh
@@ -0,0 +1,28 @@
set -xe

VERSION=16

. common.sh

BOOT_JDK="$BUILD_DIR/jdk15u/build/solaris-$JDK_PLATFORM-server-release/jdk"
PATH="/usr/bin:/usr/gnu/bin"

CONFIGURE_OPTIONS+=" --enable-unlimited-crypto"
CONFIGURE_OPTIONS+=" --enable-deprecated-ports=yes"
CONFIGURE_OPTIONS+=" --with-boot-jdk=$BOOT_JDK"
CONFIGURE_OPTIONS+=" --with-native-debug-symbols=none"
CONFIGURE_OPTIONS+=" --with-toolchain-type=gcc"
CONFIGURE_OPTIONS+=" --disable-hotspot-gtest"
CONFIGURE_OPTIONS+=" --disable-dtrace"
CONFIGURE_OPTIONS+=" --disable-warnings-as-errors"
CONFIGURE_OPTIONS+=" AS=/usr/gnu/bin/as"
CONFIGURE_OPTIONS+=" CC=$GCC"
CONFIGURE_OPTIONS+=" CXX=$GXX"

git clone ${JDK_GITHUB_REPO}/$SRC_DIR "$BUILD_DIR"/$SRC_DIR
cd "$BUILD_DIR"/$SRC_DIR

apply_patch_series

PATH="$PATH" bash ./configure ${CONFIGURE_OPTIONS}
gmake bundles
28 changes: 28 additions & 0 deletions OracleSolaris_OpenJDK_Builder/jdk-17.sh
@@ -0,0 +1,28 @@
set -xe

VERSION=17

. common.sh

BOOT_JDK="$BUILD_DIR/jdk16/build/solaris-$JDK_PLATFORM-server-release/jdk"
PATH="/usr/bin:/usr/gnu/bin"

CONFIGURE_OPTIONS+=" --enable-unlimited-crypto"
CONFIGURE_OPTIONS+=" --enable-deprecated-ports=yes"
CONFIGURE_OPTIONS+=" --with-boot-jdk=$BOOT_JDK"
CONFIGURE_OPTIONS+=" --with-native-debug-symbols=none"
CONFIGURE_OPTIONS+=" --with-toolchain-type=gcc"
CONFIGURE_OPTIONS+=" --disable-hotspot-gtest"
CONFIGURE_OPTIONS+=" --disable-dtrace"
CONFIGURE_OPTIONS+=" --disable-warnings-as-errors"
CONFIGURE_OPTIONS+=" AS=/usr/gnu/bin/as"
CONFIGURE_OPTIONS+=" CC=$GCC"
CONFIGURE_OPTIONS+=" CXX=$GXX"

git clone ${JDK_GITHUB_REPO}/$SRC_DIR "$BUILD_DIR"/$SRC_DIR
cd "$BUILD_DIR"/$SRC_DIR

apply_patch_series

PATH="$PATH" bash ./configure ${CONFIGURE_OPTIONS}
gmake bundles
28 changes: 28 additions & 0 deletions OracleSolaris_OpenJDK_Builder/jdk-18.sh
@@ -0,0 +1,28 @@
set -xe

VERSION=18

. common.sh

BOOT_JDK="$BUILD_DIR/jdk17/build/solaris-$JDK_PLATFORM-server-release/jdk"
PATH="/usr/bin:/usr/gnu/bin"

CONFIGURE_OPTIONS+=" --enable-unlimited-crypto"
CONFIGURE_OPTIONS+=" --enable-deprecated-ports=yes"
CONFIGURE_OPTIONS+=" --with-boot-jdk=$BOOT_JDK"
CONFIGURE_OPTIONS+=" --with-native-debug-symbols=none"
CONFIGURE_OPTIONS+=" --with-toolchain-type=gcc"
CONFIGURE_OPTIONS+=" --disable-hotspot-gtest"
CONFIGURE_OPTIONS+=" --disable-dtrace"
CONFIGURE_OPTIONS+=" --disable-warnings-as-errors"
CONFIGURE_OPTIONS+=" AS=/usr/gnu/bin/as"
CONFIGURE_OPTIONS+=" CC=$GCC"
CONFIGURE_OPTIONS+=" CXX=$GXX"

git clone ${JDK_GITHUB_REPO}/$SRC_DIR "$BUILD_DIR"/$SRC_DIR
cd "$BUILD_DIR"/$SRC_DIR

apply_patch_series

PATH="$PATH" bash ./configure ${CONFIGURE_OPTIONS}
gmake bundles
34 changes: 34 additions & 0 deletions OracleSolaris_OpenJDK_Builder/jdk-9.sh
@@ -0,0 +1,34 @@
set -xe

VERSION=9

. common.sh

# S11.4.21 have updated CUPS version which causes problem to old Studio compiler
function fix_cups_versioning {
test `uname -v | cut -d . -f 3` -lt 21 && return
gsed 's;_CUPS_NONNULL(...);_CUPS_NONNULL();' /usr/include/cups/versioning.h > my-cups-versioning.h
gsed -i 's;_CUPS_API_AVAILABLE(...);_CUPS_API_AVAILABLE();' my-cups-versioning.h
gsed -i 's;_CUPS_API_DEPRECATED(...);_CUPS_API_DEPRECATED();' my-cups-versioning.h
FILE=CUPSfuncs.c
for f in jdk/src/java.desktop/unix/native/common/awt/$FILE src/java.desktop/unix/native/common/awt/$FILE; do
[ ! -f "$f" ] || gsed -i "/#include <dlfcn.h>/a#include \"`pwd`/my-cups-versioning.h\"" "$f"
done
}

BOOT_JDK="/usr/jdk/instances/jdk1.8.0"
PATH="$STUDIO:/usr/bin"

CONFIGURE_OPTIONS+=" --with-boot-jdk=$BOOT_JDK --disable-hotspot-gtest"

hg clone ${JDK_REPO}/$SRC_DIR "$BUILD_DIR"/$SRC_DIR
cd "$BUILD_DIR"/$SRC_DIR

# JDK 9 uses script to download nested repositories
bash get_source.sh

fix_cups_versioning
apply_patch_series

PATH="$PATH" bash ./configure ${CONFIGURE_OPTIONS}
gmake bundles
11 changes: 11 additions & 0 deletions OracleSolaris_OpenJDK_Builder/patches-10/Solaris11-EM_486.patch
@@ -0,0 +1,11 @@
--- src/hotspot/os/solaris/os_solaris.cpp
+++ src/hotspot/os/solaris/os_solaris.cpp
@@ -1663,7 +1663,7 @@

static const arch_t arch_array[]={
{EM_386, EM_386, ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
- {EM_486, EM_386, ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
+ {EM_IAMCU, EM_386, ELFCLASS32, ELFDATA2LSB, (char*)"IA 32"},
{EM_IA_64, EM_IA_64, ELFCLASS64, ELFDATA2LSB, (char*)"IA 64"},
{EM_X86_64, EM_X86_64, ELFCLASS64, ELFDATA2LSB, (char*)"AMD 64"},
{EM_SPARC, EM_SPARC, ELFCLASS32, ELFDATA2MSB, (char*)"Sparc 32"},