This repository has been archived by the owner on Aug 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
build-openjdk8.sh
115 lines (104 loc) · 3.3 KB
/
build-openjdk8.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
set -e
# Determine platform name. Currently supported:
#
# x86_64 => x64_linux
# aarch64 => aarch64_linux
#
platform_name() {
arch=$(uname -m)
case $arch in
x86_64)
echo "x64_linux"
;;
aarch64)
echo "aarch64_linux"
;;
*)
echo "Unsupported platform '$arch'" 1>&2
exit 1
;;
esac
}
UPDATE=342
BUILD=b07
NAME="openjdk-8u${UPDATE}-${BUILD}"
JRE_NAME="${NAME}-jre"
TARBALL_BASE_NAME="OpenJDK8U"
EA_SUFFIX=""
PLATFORM="$(platform_name)"
TARBALL_VERSION="8u${UPDATE}${BUILD}${EA_SUFFIX}"
PLATFORM_VERSION="${PLATFORM}_${TARBALL_VERSION}"
TARBALL_NAME="${TARBALL_BASE_NAME}-jdk_${PLATFORM_VERSION}"
TARBALL_NAME_JRE="${TARBALL_BASE_NAME}-jre_${PLATFORM_VERSION}"
SOURCE_NAME="${TARBALL_BASE_NAME}-sources_${TARBALL_VERSION}"
build() {
set -x
# On some systems the per user process limit is set too low
# by default (e.g. 1024). This may make the build fail on
# systems with many cores (e.g. 64). Raise the limit to 1/2
# of the maximum amount of threads allowed by the kernel.
if [ -e /proc/sys/kernel/threads-max ]; then
ulimit -u $(( $(cat /proc/sys/kernel/threads-max) / 2))
fi
rm -rf build
# Add patch to be able to build on EL 6
wget https://bugs.openjdk.java.net/secure/attachment/81610/JDK-8219879.export.patch
patch -p1 < JDK-8219879.export.patch
bash common/autoconf/autogen.sh
# Create a source tarball archive corresponding to the
# binary build
tar -c -z -f ../${SOURCE_NAME}.tar.gz --transform "s|^|${NAME}-sources/|" --exclude-vcs --exclude='**.patch*' --exclude='overall-build.log' .
MILESTONE="fcs"
if [ "${EA_SUFFIX}_" != "_" ]; then
MILESTONE="ea"
fi
for debug in release slowdebug; do
bash configure \
--with-boot-jdk="/usr/lib/jvm/java" \
--with-debug-level="$debug" \
--with-conf-name="$debug" \
--enable-unlimited-crypto \
--with-milestone="$MILESTONE" \
--with-native-debug-symbols=external \
--with-update-version=$UPDATE \
--with-build-number=$BUILD
target="bootcycle-images"
if [ "${debug}_" == "slowdebug_" ]; then
target="images"
fi
make LOG_LEVEL=debug CONF=$debug $target
# Package it up
pushd build/$debug/images
if [ "${debug}_" == "slowdebug_" ]; then
NAME="$NAME-$debug"
TARBALL_NAME="$TARBALL_NAME-$debug"
fi
# JDK package
mv j2sdk-image $NAME
cp src.zip $NAME
tar -c -f ${TARBALL_NAME}.tar --exclude='**.debuginfo' $NAME
gzip ${TARBALL_NAME}.tar
tar -c -f ${TARBALL_NAME}-debuginfo.tar $(find ${NAME}/ -name \*.debuginfo)
gzip ${TARBALL_NAME}-debuginfo.tar
rm $NAME/src.zip
mv $NAME j2sdk-image
# JRE package (release only)
if [ "${debug}_" == "release_" ]; then
mv j2re-image $JRE_NAME
tar -c -f ${TARBALL_NAME_JRE}.tar --exclude='**.debuginfo' $JRE_NAME
gzip ${TARBALL_NAME_JRE}.tar
tar -c -f ${TARBALL_NAME_JRE}-debuginfo.tar $(find ${JRE_NAME}/ -name \*.debuginfo)
gzip ${TARBALL_NAME_JRE}-debuginfo.tar
mv $JRE_NAME j2re-image
fi
popd
done
mv ../${SOURCE_NAME}.tar.gz build/
set +x
}
build 2>&1 | tee overall-build.log
ALL_ARTEFACTS="$NAME-$(platform_name)-all-artefacts.tar"
tar -c -f $ALL_ARTEFACTS $(find build -name \*.tar.gz) overall-build.log
gzip $ALL_ARTEFACTS
ls -lh *.tar.gz