28 |
# Remove build artifacts by default |
# Remove build artifacts by default |
29 |
%bcond_with artifacts |
%bcond_with artifacts |
30 |
|
|
31 |
|
# Build a fresh libjvm.so for use in a copy of the bootstrap JDK |
32 |
|
%bcond_without fresh_libjvm |
33 |
|
# Define whether to use the bootstrap JDK directly or with a fresh libjvm.so |
34 |
|
%if %{with fresh_libjvm} |
35 |
|
%global build_hotspot_first 1 |
36 |
|
%else |
37 |
|
%global build_hotspot_first 0 |
38 |
|
%endif |
39 |
|
|
40 |
# The -g flag says to use strip -g instead of full strip on DSOs or EXEs. |
# The -g flag says to use strip -g instead of full strip on DSOs or EXEs. |
41 |
# This fixes detailed NMT and other tools which need minimal debug info. |
# This fixes detailed NMT and other tools which need minimal debug info. |
42 |
# See: https://bugzilla.redhat.com/show_bug.cgi?id=1520879 |
# See: https://bugzilla.redhat.com/show_bug.cgi?id=1520879 |
103 |
# Set of architectures for which we build fastdebug builds |
# Set of architectures for which we build fastdebug builds |
104 |
%global fastdebug_arches x86_64 ppc64le aarch64 |
%global fastdebug_arches x86_64 ppc64le aarch64 |
105 |
# Set of architectures with a Just-In-Time (JIT) compiler |
# Set of architectures with a Just-In-Time (JIT) compiler |
106 |
%global jit_arches %{debug_arches} |
%global jit_arches %{aarch64} %{power64} sparcv9 sparc64 x86_64 |
107 |
# Set of architectures which use the Zero assembler port (!jit_arches) |
# Set of architectures which use the Zero assembler port (!jit_arches) |
108 |
%global zero_arches %{arm} ppc s390 s390x |
%global zero_arches %{arm} %{ix86} ppc s390 s390x |
109 |
# Set of architectures which run a full bootstrap cycle |
# Set of architectures which run a full bootstrap cycle |
110 |
%global bootstrap_arches %{jit_arches} %{zero_arches} |
%global bootstrap_arches %{jit_arches} %{zero_arches} |
111 |
# Set of architectures which support SystemTap tapsets |
# Set of architectures which support SystemTap tapsets |
116 |
# See https://bugzilla.redhat.com/show_bug.cgi?id=513605 |
# See https://bugzilla.redhat.com/show_bug.cgi?id=513605 |
117 |
# MetaspaceShared::generate_vtable_methods is not implemented for the PPC JIT |
# MetaspaceShared::generate_vtable_methods is not implemented for the PPC JIT |
118 |
%global share_arches %{ix86} x86_64 sparcv9 sparc64 %{aarch64} |
%global share_arches %{ix86} x86_64 sparcv9 sparc64 %{aarch64} |
119 |
|
# Set of architectures which support JFR |
120 |
%global jfr_arches %{jit_arches} |
%global jfr_arches %{jit_arches} |
121 |
|
|
122 |
|
# Set of architectures where we verify backtraces with gdb (ideally all) |
123 |
|
# Temporarily disable check on x86, x86_64, ppc64le and s390x as gdb crashes |
124 |
|
# ../../gdb/objfiles.h:510: internal-error: sect_index_data not initialized |
125 |
|
# A problem internal to GDB has been detected, |
126 |
|
# further debugging may prove unreliable. |
127 |
|
# See https://bugzilla.redhat.com/show_bug.cgi?id=2041970 |
128 |
|
%global gdb_arches sparcv9 sparc64 %{aarch64} %{arm} ppc s390 |
129 |
# Set of architectures for which alt-java has SSB mitigation |
# Set of architectures for which alt-java has SSB mitigation |
130 |
%global ssbd_arches x86_64 |
%global ssbd_arches x86_64 |
131 |
|
|
163 |
%global fastdebug_build %{nil} |
%global fastdebug_build %{nil} |
164 |
%endif |
%endif |
165 |
|
|
166 |
# If you disable both builds, then the build fails |
# If you disable all builds, then the build fails |
167 |
# Build and test slowdebug first as it provides the best diagnostics |
# Build and test slowdebug first as it provides the best diagnostics |
168 |
%global build_loop %{slowdebug_build} %{fastdebug_build} %{normal_build} |
%global build_loop %{slowdebug_build} %{fastdebug_build} %{normal_build} |
169 |
|
|
176 |
%global bootstrap_targets images |
%global bootstrap_targets images |
177 |
%global release_targets images docs-zip |
%global release_targets images docs-zip |
178 |
%global debug_targets images |
%global debug_targets images |
179 |
|
# Target to use to just build HotSpot |
180 |
|
%global hotspot_target hotspot |
181 |
|
|
182 |
|
# JDK to use for bootstrapping |
183 |
|
# Use OpenJDK 7 where available (on RHEL) to avoid |
184 |
|
# having to use the rhel-7.x-java-unsafe-candidate hack |
185 |
|
# Change this for bootstrapping |
186 |
|
##global buildjdkver 1.7.0 |
187 |
|
%global buildjdkver 1.8.0 |
188 |
|
%global bootjdk /usr/lib/jvm/java-%{buildjdkver}-openjdk |
189 |
|
|
190 |
# Disable LTO as this causes build failures at the moment. |
# Disable LTO as this causes build failures at the moment. |
191 |
# See RHBZ#1861401 |
# See RHBZ#1861401 |
324 |
%global updatever %(VERSION=%{whole_update}; echo ${VERSION##*u}) |
%global updatever %(VERSION=%{whole_update}; echo ${VERSION##*u}) |
325 |
# eg jdk8u60-b27 -> b27 |
# eg jdk8u60-b27 -> b27 |
326 |
%global buildver %(VERSION=%{version_tag}; echo ${VERSION##*-}) |
%global buildver %(VERSION=%{version_tag}; echo ${VERSION##*-}) |
327 |
%global rpmrelease 1 |
%global rpmrelease 2 |
328 |
# Define milestone (EA for pre-releases, GA ("fcs") for releases) |
# Define milestone (EA for pre-releases, GA ("fcs") for releases) |
329 |
# Release will be (where N is usually a number starting at 1): |
# Release will be (where N is usually a number starting at 1): |
330 |
# - 0.N%%{?extraver}%%{?dist} for EA releases, |
# - 0.N%%{?extraver}%%{?dist} for EA releases, |
817 |
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libnio.so |
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libnio.so |
818 |
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libnpt.so |
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libnpt.so |
819 |
%ifarch %{sa_arches} |
%ifarch %{sa_arches} |
820 |
|
%ifnarch %{zero_arches} |
821 |
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libsaproc.so |
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libsaproc.so |
822 |
%endif |
%endif |
823 |
|
%endif |
824 |
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libsctp.so |
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libsctp.so |
825 |
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libsunec.so |
%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libsunec.so |
826 |
#%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libsystemconf.so |
#%{_jvmdir}/%{jredir -- %{?1}}/lib/%{archinstall}/libsystemconf.so |
957 |
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/jconsole.jar |
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/jconsole.jar |
958 |
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/orb.idl |
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/orb.idl |
959 |
%ifarch %{sa_arches} |
%ifarch %{sa_arches} |
960 |
|
%ifnarch %{zero_arches} |
961 |
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/sa-jdi.jar |
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/sa-jdi.jar |
962 |
%endif |
%endif |
963 |
|
%endif |
964 |
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/dt.jar |
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/dt.jar |
965 |
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/jexec |
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/jexec |
966 |
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/tools.jar |
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/tools.jar |
1340 |
# JDK-8218811: replace open by os::open in hotspot coding |
# JDK-8218811: replace open by os::open in hotspot coding |
1341 |
# This fixes a GCC 10 build issue |
# This fixes a GCC 10 build issue |
1342 |
Patch111: jdk8218811-perfMemory_linux.patch |
Patch111: jdk8218811-perfMemory_linux.patch |
1343 |
# Similar for GCC 11 |
# JDK-8281098, PR3836: Extra compiler flags not passed to adlc build |
1344 |
Patch112: %{name}-gcc11.patch |
Patch112: jdk8281098-pr3836-pass_compiler_flags_to_adlc.patch |
1345 |
|
|
1346 |
############################################# |
############################################# |
1347 |
# |
# |
1386 |
Patch204: jdk8042159-allow_using_system_installed_lcms2-jdk.patch |
Patch204: jdk8042159-allow_using_system_installed_lcms2-jdk.patch |
1387 |
# JDK-8195607, PR3776, RH1760437: sun/security/pkcs11/Secmod/TestNssDbSqlite.java failed with "NSS initialization failed" on NSS 3.34.1 |
# JDK-8195607, PR3776, RH1760437: sun/security/pkcs11/Secmod/TestNssDbSqlite.java failed with "NSS initialization failed" on NSS 3.34.1 |
1388 |
Patch580: jdk8195607-pr3776-rh1760437-nss_sqlite_db_config.patch |
Patch580: jdk8195607-pr3776-rh1760437-nss_sqlite_db_config.patch |
1389 |
|
# JDK-8257794: Zero: assert(istate->_stack_limit == istate->_thread->last_Java_sp() + 1) failed: wrong on Linux/x86_32 |
1390 |
|
Patch581: jdk8257794-remove_broken_assert.patch |
1391 |
|
|
1392 |
############################################# |
############################################# |
1393 |
# |
# |
1463 |
BuildRequires: x11-proto-devel |
BuildRequires: x11-proto-devel |
1464 |
BuildRequires: zip |
BuildRequires: zip |
1465 |
BuildRequires: unzip |
BuildRequires: unzip |
1466 |
BuildRequires: java-1.8.0-openjdk-devel |
BuildRequires: java-%{buildjdkver}-openjdk-devel |
1467 |
# Zero-assembler build requirement |
# Zero-assembler build requirement |
1468 |
%ifnarch %{jit_arches} |
%ifarch %{zero_arches} |
1469 |
BuildRequires: libffi-devel |
BuildRequires: libffi-devel |
1470 |
%endif |
%endif |
1471 |
# 2021c required as of JDK-8260356 in April CPU |
# 2021c required as of JDK-8260356 in April CPU |
1472 |
BuildRequires: tzdata-java >= 2021c |
BuildRequires: tzdata-java >= 2021c |
1473 |
# Earlier versions have a bug in tree vectorization on PPC |
# Earlier versions have a bug in tree vectorization on PPC |
1474 |
BuildRequires: gcc >= 4.8.3-8 |
BuildRequires: gcc >= 4.8.3-8 |
1475 |
|
BuildRequires: rootcerts-java |
1476 |
%if %{with_systemtap} |
%if %{with_systemtap} |
1477 |
BuildRequires: systemtap-sdt-devel |
BuildRequires: systemtap-sdt-devel |
1478 |
%endif |
%endif |
1820 |
%patch111 |
%patch111 |
1821 |
%patch112 |
%patch112 |
1822 |
%patch580 |
%patch580 |
1823 |
|
%patch581 |
1824 |
# RPM-only fixes |
# RPM-only fixes |
1825 |
%patch539 |
%patch539 |
1826 |
%patch600 |
%patch600 |
1843 |
cp -r tapset tapset%{fastdebug_suffix} |
cp -r tapset tapset%{fastdebug_suffix} |
1844 |
%endif |
%endif |
1845 |
|
|
1846 |
|
echo "DEBUG" |
1847 |
|
echo "DEBUG" |
1848 |
|
ls /usr/lib/jvm/java-1.8.0-openjdk/jre/lib/security/ |
1849 |
|
echo "DEBUG" |
1850 |
|
echo "DEBUG" |
1851 |
for suffix in %{build_loop} ; do |
for suffix in %{build_loop} ; do |
1852 |
for file in "tapset"$suffix/*.in; do |
for file in "tapset"$suffix/*.in; do |
1853 |
OUTPUT_FILE=`echo $file | sed -e "s:\.stp\.in$:-%{version}-%{release}.%{_arch}.stp:g"` |
OUTPUT_FILE=`echo $file | sed -e "s:\.stp\.in$:-%{version}-%{release}.%{_arch}.stp:g"` |
1925 |
|
|
1926 |
function buildjdk() { |
function buildjdk() { |
1927 |
local outputdir=${1} |
local outputdir=${1} |
1928 |
local installdir=${2} |
local buildjdk=${2} |
1929 |
local buildjdk=${3} |
local maketargets="${3}" |
1930 |
local maketargets=${4} |
local debuglevel=${4} |
|
local debuglevel=${5} |
|
1931 |
|
|
1932 |
local top_srcdir_abs_path=$(pwd)/%{top_level_dir_name} |
local top_srcdir_abs_path=$(pwd)/%{top_level_dir_name} |
1933 |
# Variable used in hs_err hook on build failures |
# Variable used in hs_err hook on build failures |
1937 |
${buildjdk}/bin/java -version |
${buildjdk}/bin/java -version |
1938 |
echo "Building 8u%{updatever}-%{buildver}, milestone %{milestone}" |
echo "Building 8u%{updatever}-%{buildver}, milestone %{milestone}" |
1939 |
|
|
1940 |
mkdir -p ${outputdir} ${installdir} |
mkdir -p ${outputdir} |
1941 |
pushd ${outputdir} |
pushd ${outputdir} |
1942 |
|
|
1943 |
bash ${top_srcdir_abs_path}/configure \ |
bash ${top_srcdir_abs_path}/configure \ |
1946 |
%else |
%else |
1947 |
--disable-jfr \ |
--disable-jfr \ |
1948 |
%endif |
%endif |
1949 |
%ifnarch %{jit_arches} |
%ifarch %{zero_arches} |
1950 |
--with-jvm-variants=zero \ |
--with-jvm-variants=zero \ |
1951 |
%endif |
%endif |
1952 |
--with-native-debug-symbols=internal \ |
--with-native-debug-symbols=internal \ |
1981 |
SCTP_WERROR= \ |
SCTP_WERROR= \ |
1982 |
${maketargets} || ( pwd; find ${top_srcdir_abs_path} ${top_builddir_abs_path} -name "hs_err_pid*.log" | xargs cat && false ) |
${maketargets} || ( pwd; find ${top_srcdir_abs_path} ${top_builddir_abs_path} -name "hs_err_pid*.log" | xargs cat && false ) |
1983 |
|
|
1984 |
# the build (erroneously) removes read permissions from some jars |
popd |
1985 |
# this is a regression in OpenJDK 7 (our compiler): |
} |
1986 |
# http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1437 |
function installjdk() { |
1987 |
find images/%{jdkimage} -iname '*.jar' -exec chmod ugo+r {} \; |
local outputdir=${1} |
1988 |
chmod ugo+r images/%{jdkimage}/lib/ct.sym |
local installdir=${2} |
1989 |
|
local imagepath=${installdir}/images/%{jdkimage} |
|
# remove redundant *diz and *debuginfo files |
|
|
find images/%{jdkimage} -iname '*.diz' -exec rm -v {} \; |
|
|
find images/%{jdkimage} -iname '*.debuginfo' -exec rm -v {} \; |
|
|
|
|
|
# Build screws up permissions on binaries |
|
|
# https://bugs.openjdk.java.net/browse/JDK-8173610 |
|
|
find images/%{jdkimage} -iname '*.so' -exec chmod +x {} \; |
|
|
find images/%{jdkimage}/bin/ -exec chmod +x {} \; |
|
|
|
|
|
popd >& /dev/null |
|
1990 |
|
|
1991 |
echo "Installing build from ${outputdir} to ${installdir}..." |
echo "Installing build from ${outputdir} to ${installdir}..." |
1992 |
|
mkdir -p ${installdir} |
1993 |
echo "Installing images..." |
echo "Installing images..." |
1994 |
mv ${outputdir}/images ${installdir} |
mv ${outputdir}/images ${installdir} |
1995 |
if [ -d ${outputdir}/bundles ] ; then |
if [ -d ${outputdir}/bundles ] ; then |
2005 |
echo "Removing output directory..."; |
echo "Removing output directory..."; |
2006 |
rm -rf ${outputdir} |
rm -rf ${outputdir} |
2007 |
%endif |
%endif |
2008 |
|
|
2009 |
|
if [ -d ${imagepath} ] ; then |
2010 |
|
# the build (erroneously) removes read permissions from some jars |
2011 |
|
# this is a regression in OpenJDK 7 (our compiler): |
2012 |
|
# http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1437 |
2013 |
|
find ${imagepath} -iname '*.jar' -exec chmod ugo+r {} \; |
2014 |
|
chmod ugo+r ${imagepath}/lib/ct.sym |
2015 |
|
|
2016 |
|
# remove redundant *diz and *debuginfo files |
2017 |
|
find ${imagepath} -iname '*.diz' -exec rm -v {} \; |
2018 |
|
find ${imagepath} -iname '*.debuginfo' -exec rm -v {} \; |
2019 |
|
|
2020 |
|
# Build screws up permissions on binaries |
2021 |
|
# https://bugs.openjdk.java.net/browse/JDK-8173610 |
2022 |
|
find ${imagepath} -iname '*.so' -exec chmod +x {} \; |
2023 |
|
find ${imagepath}/bin/ -exec chmod +x {} \; |
2024 |
|
fi |
2025 |
} |
} |
2026 |
|
|
2027 |
|
%if %{build_hotspot_first} |
2028 |
|
# Build a fresh libjvm.so first and use it to bootstrap |
2029 |
|
cp -LR --preserve=mode,timestamps %{bootjdk} newboot |
2030 |
|
systemjdk=$(pwd)/newboot |
2031 |
|
buildjdk build/newboot ${systemjdk} %{hotspot_target} "release" "bundled" |
2032 |
|
mv build/newboot/hotspot/dist/jre/lib/%{archinstall}/server/libjvm.so newboot/jre/lib/%{archinstall}/server |
2033 |
|
%else |
2034 |
|
systemjdk=%{bootjdk} |
2035 |
|
%endif |
2036 |
|
|
2037 |
for suffix in %{build_loop} ; do |
for suffix in %{build_loop} ; do |
2038 |
if [ "x$suffix" = "x" ] ; then |
if [ "x$suffix" = "x" ] ; then |
2039 |
debugbuild=release |
debugbuild=release |
2042 |
debugbuild=`echo $suffix | sed "s/-//g"` |
debugbuild=`echo $suffix | sed "s/-//g"` |
2043 |
fi |
fi |
2044 |
|
|
|
systemjdk=/usr/lib/jvm/java-openjdk |
|
2045 |
builddir=%{buildoutputdir -- $suffix} |
builddir=%{buildoutputdir -- $suffix} |
2046 |
bootbuilddir=boot${builddir} |
bootbuilddir=boot${builddir} |
2047 |
installdir=%{installoutputdir -- $suffix} |
installdir=%{installoutputdir -- $suffix} |
2059 |
fi |
fi |
2060 |
|
|
2061 |
if ${run_bootstrap} ; then |
if ${run_bootstrap} ; then |
2062 |
buildjdk ${bootbuilddir} ${bootinstalldir} ${systemjdk} "%{bootstrap_targets}" ${debugbuild} |
buildjdk ${bootbuilddir} ${systemjdk} "%{bootstrap_targets}" ${debugbuild} |
2063 |
buildjdk ${builddir} ${installdir} $(pwd)/${bootinstalldir}/images/%{jdkimage} "${maketargets}" ${debugbuild} |
installjdk ${bootbuilddir} ${bootinstalldir} |
2064 |
|
buildjdk ${builddir} $(pwd)/${bootinstalldir}/images/%{jdkimage} "${maketargets}" ${debugbuild} |
2065 |
|
installjdk ${builddir} ${installdir} |
2066 |
%{!?with_artifacts:rm -rf ${bootinstalldir}} |
%{!?with_artifacts:rm -rf ${bootinstalldir}} |
2067 |
else |
else |
2068 |
buildjdk ${builddir} ${installdir} ${systemjdk} "${maketargets}" ${debugbuild} |
buildjdk ${builddir} ${systemjdk} "${maketargets}" ${debugbuild} |
2069 |
|
installjdk ${builddir} ${installdir} |
2070 |
fi |
fi |
2071 |
|
|
2072 |
# Install nss.cfg right away as we will be using the JRE above |
# Install nss.cfg right away as we will be using the JRE above |
2187 |
run -version |
run -version |
2188 |
EOF |
EOF |
2189 |
|
|
2190 |
|
%ifarch %{gdb_arches} |
2191 |
grep 'JavaCallWrapper::JavaCallWrapper' gdb.out |
grep 'JavaCallWrapper::JavaCallWrapper' gdb.out |
2192 |
|
%endif |
2193 |
|
|
2194 |
# Check src.zip has all sources. See RHBZ#1130490 |
# Check src.zip has all sources. See RHBZ#1130490 |
2195 |
jar -tf $JAVA_HOME/src.zip | grep 'sun.misc.Unsafe' |
jar -tf $JAVA_HOME/src.zip | grep 'sun.misc.Unsafe' |