Cherry-pick appropriate spec file changes from Fedora

* Restructure the build so a minimal initial build is then used for the final build (with docs)
  - This reduces pressure on the system JDK and ensures the JDK being built can do a full build
* Turn off bootstrapping for slow debug builds, which are particularly slow on ppc64le.
* Handle Fedora in distro conditionals that currently only pertain to RHEL.
* Replace tabs by sets of spaces to make rpmlint happy
  - Run OpenJDK normalizer script on the spec file to fix further rogue whitespace
* javadoc-zip gets its own provides next to plain javadoc ones
* Sync gdb test with java-1.8.0-openjdk and improve architecture restrictions.
* Introduce stapinstall variable to set SystemTap arch directory correctly (e.g. arm64 on aarch64)
  - Need to support noarch for creating source RPMs for non-scratch builds.
* Support a HotSpot-only build so a freshly built libjvm.so can then be used in the bootstrap JDK.
  - Replace -mstackrealign with -mincoming-stack-boundary=2 -mpreferred-stack-boundary=4 on x86_32 for stack alignment
  - Explicitly list JIT architectures rather than relying on those with slowdebug builds
  - Disable the serviceability agent on Zero architectures even when the architecture itself is supported

Related: RHEL-45216
This commit is contained in:
Andrew Hughes 2022-02-17 18:21:05 +00:00
parent 948cf4c720
commit c9d027baf9

View File

@ -21,6 +21,8 @@
%bcond_without release %bcond_without release
# Enable static library builds by default. # Enable static library builds by default.
%bcond_without staticlibs %bcond_without staticlibs
# Build a fresh libjvm.so for use in a copy of the bootstrap JDK
%bcond_without fresh_libjvm
# Workaround for stripping of debug symbols from static libraries # Workaround for stripping of debug symbols from static libraries
%if %{with staticlibs} %if %{with staticlibs}
@ -30,6 +32,13 @@
%global include_staticlibs 0 %global include_staticlibs 0
%endif %endif
# Define whether to use the bootstrap JDK directly or with a fresh libjvm.so
%if %{with fresh_libjvm}
%global build_hotspot_first 1
%else
%global build_hotspot_first 0
%endif
# 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.
# This fixes detailed NMT and other tools which need minimal debug info. # This fixes detailed NMT and other tools which need minimal debug info.
# See: https://bugzilla.redhat.com/show_bug.cgi?id=1520879 # See: https://bugzilla.redhat.com/show_bug.cgi?id=1520879
@ -99,17 +108,20 @@
%global ppc64be ppc64 ppc64p7 %global ppc64be ppc64 ppc64p7
# Set of architectures which support multiple ABIs # Set of architectures which support multiple ABIs
%global multilib_arches %{power64} sparc64 x86_64 %global multilib_arches %{power64} sparc64 x86_64
# Set of architectures for which we build debug builds # Set of architectures for which we build slowdebug builds
%global debug_arches %{ix86} x86_64 sparcv9 sparc64 %{aarch64} %{power64} s390x %global debug_arches %{ix86} x86_64 sparcv9 sparc64 %{aarch64} %{power64} s390x
# Set of architectures for which we build fastdebug builds
%global fastdebug_arches x86_64 ppc64le aarch64
# Set of architectures with a Just-In-Time (JIT) compiler # Set of architectures with a Just-In-Time (JIT) compiler
%global jit_arches %{debug_arches} %{arm} %global jit_arches %{arm} %{aarch64} %{ix86} %{power64} s390x sparcv9 sparc64 x86_64
# Set of architectures which use the Zero assembler port (!jit_arches)
%global zero_arches ppc s390
# Set of architectures which run a full bootstrap cycle # Set of architectures which run a full bootstrap cycle
%global bootstrap_arches %{jit_arches} %global bootstrap_arches %{jit_arches}
# Set of architectures which support SystemTap tapsets # Set of architectures which support SystemTap tapsets
%global systemtap_arches %{jit_arches} %global systemtap_arches %{jit_arches}
# Set of architectures with a Ahead-Of-Time (AOT) compiler # Set of architectures with a Ahead-Of-Time (AOT) compiler
%global aot_arches x86_64 %{aarch64} %global aot_arches x86_64 %{aarch64}
%global fastdebug_arches x86_64 ppc64le aarch64
# Set of architectures which support the serviceability agent # Set of architectures which support the serviceability agent
%global sa_arches %{ix86} x86_64 sparcv9 sparc64 %{aarch64} %{power64} %{arm} %global sa_arches %{ix86} x86_64 sparcv9 sparc64 %{aarch64} %{power64} %{arm}
# Set of architectures which support class data sharing # Set of architectures which support class data sharing
@ -124,6 +136,8 @@
%global ssbd_arches x86_64 %global ssbd_arches x86_64
# Set of architectures for which java has short vector math library (libjsvml.so) # Set of architectures for which java has short vector math library (libjsvml.so)
%global svml_arches x86_64 %global svml_arches x86_64
# Set of architectures where we verify backtraces with gdb
%global gdb_arches %{jit_arches} %{zero_arches}
# By default, we build a debug build during main build on JIT architectures # By default, we build a debug build during main build on JIT architectures
%if %{with slowdebug} %if %{with slowdebug}
@ -166,7 +180,7 @@
%global fastdebug_build %{nil} %global fastdebug_build %{nil}
%endif %endif
# If you disable both builds, then the build fails # If you disable all builds, then the build fails
# Build and test slowdebug first as it provides the best diagnostics # Build and test slowdebug first as it provides the best diagnostics
%global build_loop %{slowdebug_build} %{fastdebug_build} %{normal_build} %global build_loop %{slowdebug_build} %{fastdebug_build} %{normal_build}
@ -177,9 +191,9 @@
%endif %endif
%ifarch %{bootstrap_arches} %ifarch %{bootstrap_arches}
%global bootstrap_build 1 %global bootstrap_build true
%else %else
%global bootstrap_build 1 %global bootstrap_build false
%endif %endif
%if %{include_staticlibs} %if %{include_staticlibs}
@ -192,14 +206,19 @@
%global static_libs_target %{nil} %global static_libs_target %{nil}
%endif %endif
# RPM JDK builds keep the debug symbols internal, to be later stripped by RPM
%global debug_symbols internal
# unlike portables,the rpms have to use static_libs_target very dynamically # unlike portables,the rpms have to use static_libs_target very dynamically
%if %{bootstrap_build} %global bootstrap_targets images
%global release_targets bootcycle-images docs-zip
%else
%global release_targets images docs-zip %global release_targets images docs-zip
%endif
# No docs nor bootcycle for debug builds # No docs nor bootcycle for debug builds
%global debug_targets images %global debug_targets images
# Target to use to just build HotSpot
%global hotspot_target hotspot
# JDK to use for bootstrapping
%global bootjdk /usr/lib/jvm/java-%{buildjdkver}-openjdk
# Filter out flags from the optflags macro that cause problems with the OpenJDK build # Filter out flags from the optflags macro that cause problems with the OpenJDK build
@ -220,51 +239,63 @@
# In some cases, the arch used by the JDK does # In some cases, the arch used by the JDK does
# not match _arch. # not match _arch.
# Also, in some cases, the machine name used by SystemTap # Also, in some cases, the machine name used by SystemTap
# does not match that given by _build_cpu # does not match that given by _target_cpu
%ifarch x86_64 %ifarch x86_64
%global archinstall amd64 %global archinstall amd64
%global stapinstall x86_64
%endif %endif
%ifarch ppc %ifarch ppc
%global archinstall ppc %global archinstall ppc
%global stapinstall powerpc
%endif %endif
%ifarch %{ppc64be} %ifarch %{ppc64be}
%global archinstall ppc64 %global archinstall ppc64
%global stapinstall powerpc
%endif %endif
%ifarch %{ppc64le} %ifarch %{ppc64le}
%global archinstall ppc64le %global archinstall ppc64le
%global stapinstall powerpc
%endif %endif
%ifarch %{ix86} %ifarch %{ix86}
%global archinstall i686 %global archinstall i686
%global stapinstall i386
%endif %endif
%ifarch ia64 %ifarch ia64
%global archinstall ia64 %global archinstall ia64
%global stapinstall ia64
%endif %endif
%ifarch s390 %ifarch s390
%global archinstall s390 %global archinstall s390
%global stapinstall s390
%endif %endif
%ifarch s390x %ifarch s390x
%global archinstall s390x %global archinstall s390x
%global stapinstall s390
%endif %endif
%ifarch %{arm} %ifarch %{arm}
%global archinstall arm %global archinstall arm
%global stapinstall arm
%endif %endif
%ifarch %{aarch64} %ifarch %{aarch64}
%global archinstall aarch64 %global archinstall aarch64
%global stapinstall arm64
%endif %endif
# 32 bit sparc, optimized for v9 # 32 bit sparc, optimized for v9
%ifarch sparcv9 %ifarch sparcv9
%global archinstall sparc %global archinstall sparc
%global stapinstall %{_target_cpu}
%endif %endif
# 64 bit sparc # 64 bit sparc
%ifarch sparc64 %ifarch sparc64
%global archinstall sparcv9 %global archinstall sparcv9
%global stapinstall %{_target_cpu}
%endif %endif
%ifnarch %{jit_arches} # Need to support noarch for srpm build
%global archinstall %{_arch} %ifarch noarch
%global archinstall %{nil}
%global stapinstall %{nil}
%endif %endif
%ifarch %{systemtap_arches} %ifarch %{systemtap_arches}
%global with_systemtap 1 %global with_systemtap 1
%else %else
@ -303,7 +334,7 @@
%global top_level_dir_name %{origin} %global top_level_dir_name %{origin}
%global top_level_dir_name_backup %{top_level_dir_name}-backup %global top_level_dir_name_backup %{top_level_dir_name}-backup
%global buildver 8 %global buildver 8
%global rpmrelease 3 %global rpmrelease 4
# Priority must be 8 digits in total; up to openjdk 1.8, we were using 18..... so when we moved to 11, we had to add another digit # Priority must be 8 digits in total; up to openjdk 1.8, we were using 18..... so when we moved to 11, we had to add another digit
%if %is_system_jdk %if %is_system_jdk
# Using 10 digits may overflow the int used for priority, so we combine the patch and build versions # Using 10 digits may overflow the int used for priority, so we combine the patch and build versions
@ -421,10 +452,10 @@
# and 32 bit architectures we place the tapsets under the arch # and 32 bit architectures we place the tapsets under the arch
# specific dir (note that systemtap will only pickup the tapset # specific dir (note that systemtap will only pickup the tapset
# for the primary arch for now). Systemtap uses the machine name # for the primary arch for now). Systemtap uses the machine name
# aka build_cpu as architecture specific directory name. # aka target_cpu as architecture specific directory name.
%global tapsetroot /usr/share/systemtap %global tapsetroot /usr/share/systemtap
%global tapsetdirttapset %{tapsetroot}/tapset/ %global tapsetdirttapset %{tapsetroot}/tapset/
%global tapsetdir %{tapsetdirttapset}/%{_build_cpu} %global tapsetdir %{tapsetdirttapset}/%{stapinstall}
%endif %endif
# not-duplicated scriptlets for normal/debug packages # not-duplicated scriptlets for normal/debug packages
@ -520,7 +551,9 @@ alternatives \\
--slave %{_bindir}/jlink jlink %{sdkbindir -- %{?1}}/jlink \\ --slave %{_bindir}/jlink jlink %{sdkbindir -- %{?1}}/jlink \\
--slave %{_bindir}/jmod jmod %{sdkbindir -- %{?1}}/jmod \\ --slave %{_bindir}/jmod jmod %{sdkbindir -- %{?1}}/jmod \\
%ifarch %{sa_arches} %ifarch %{sa_arches}
%ifnarch %{zero_arches}
--slave %{_bindir}/jhsdb jhsdb %{sdkbindir -- %{?1}}/jhsdb \\ --slave %{_bindir}/jhsdb jhsdb %{sdkbindir -- %{?1}}/jhsdb \\
%endif
%endif %endif
--slave %{_bindir}/jar jar %{sdkbindir -- %{?1}}/jar \\ --slave %{_bindir}/jar jar %{sdkbindir -- %{?1}}/jar \\
--slave %{_bindir}/jarsigner jarsigner %{sdkbindir -- %{?1}}/jarsigner \\ --slave %{_bindir}/jarsigner jarsigner %{sdkbindir -- %{?1}}/jarsigner \\
@ -711,8 +744,10 @@ exit 0
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/librmi.so %{_jvmdir}/%{sdkdir -- %{?1}}/lib/librmi.so
# Some architectures don't have the serviceability agent # Some architectures don't have the serviceability agent
%ifarch %{sa_arches} %ifarch %{sa_arches}
%ifnarch %{zero_arches}
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/libsaproc.so %{_jvmdir}/%{sdkdir -- %{?1}}/lib/libsaproc.so
%endif %endif
%endif
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/libsctp.so %{_jvmdir}/%{sdkdir -- %{?1}}/lib/libsctp.so
%{_jvmdir}/%{sdkdir -- %{?1}}/lib/libsystemconf.so %{_jvmdir}/%{sdkdir -- %{?1}}/lib/libsystemconf.so
%ifarch %{svml_arches} %ifarch %{svml_arches}
@ -804,9 +839,11 @@ exit 0
%{_jvmdir}/%{sdkdir -- %{?1}}/bin/jimage %{_jvmdir}/%{sdkdir -- %{?1}}/bin/jimage
# Some architectures don't have the serviceability agent # Some architectures don't have the serviceability agent
%ifarch %{sa_arches} %ifarch %{sa_arches}
%ifnarch %{zero_arches}
%{_jvmdir}/%{sdkdir -- %{?1}}/bin/jhsdb %{_jvmdir}/%{sdkdir -- %{?1}}/bin/jhsdb
%{_mandir}/man1/jhsdb-%{uniquesuffix -- %{?1}}.1.gz %{_mandir}/man1/jhsdb-%{uniquesuffix -- %{?1}}.1.gz
%endif %endif
%endif
%{_jvmdir}/%{sdkdir -- %{?1}}/bin/jinfo %{_jvmdir}/%{sdkdir -- %{?1}}/bin/jinfo
%{_jvmdir}/%{sdkdir -- %{?1}}/bin/jlink %{_jvmdir}/%{sdkdir -- %{?1}}/bin/jlink
%{_jvmdir}/%{sdkdir -- %{?1}}/bin/jmap %{_jvmdir}/%{sdkdir -- %{?1}}/bin/jmap
@ -945,7 +982,8 @@ Requires: libXcomposite%{?_isa}
Requires: %{name}-headless%{?1}%{?_isa} = %{epoch}:%{version}-%{release} Requires: %{name}-headless%{?1}%{?_isa} = %{epoch}:%{version}-%{release}
OrderWithRequires: %{name}-headless%{?1}%{?_isa} = %{epoch}:%{version}-%{release} OrderWithRequires: %{name}-headless%{?1}%{?_isa} = %{epoch}:%{version}-%{release}
# for java-X-openjdk package's desktop binding # for java-X-openjdk package's desktop binding
%if 0%{?rhel} >= 8 # Where recommendations are available, recommend Gtk+ for the Swing look and feel
%if 0%{?rhel} >= 8 || 0%{?fedora} > 0
Recommends: gtk3%{?_isa} Recommends: gtk3%{?_isa}
%endif %endif
@ -986,8 +1024,11 @@ Requires: cups-libs
Requires(post): %{alternatives_requires} Requires(post): %{alternatives_requires}
# Postun requires alternatives to uninstall tool alternatives # Postun requires alternatives to uninstall tool alternatives
Requires(postun): %{alternatives_requires} Requires(postun): %{alternatives_requires}
# for optional support of kernel stream control, card reader and printing bindings # Where suggestions are available, recommend the sctp and pcsc libraries
# for optional support of kernel stream control and card reader
%if 0%{?rhel} >= 8 || 0%{?fedora} > 0
Suggests: lksctp-tools%{?_isa}, pcsc-lite-libs%{?_isa} Suggests: lksctp-tools%{?_isa}, pcsc-lite-libs%{?_isa}
%endif
# Standard JPackage base provides # Standard JPackage base provides
Provides: jre-%{javaver}-%{origin}-headless%{?1} = %{epoch}:%{version}-%{release} Provides: jre-%{javaver}-%{origin}-headless%{?1} = %{epoch}:%{version}-%{release}
@ -1062,10 +1103,10 @@ Requires(post): %{alternatives_requires}
Requires(postun): %{alternatives_requires} Requires(postun): %{alternatives_requires}
# Standard JPackage javadoc provides # Standard JPackage javadoc provides
Provides: java-%{javaver}-javadoc%{?1} = %{epoch}:%{version}-%{release} Provides: java-%{javaver}-javadoc%{?1}%{?2} = %{epoch}:%{version}-%{release}
Provides: java-%{javaver}-%{origin}-javadoc%{?1} = %{epoch}:%{version}-%{release} Provides: java-%{javaver}-%{origin}-javadoc%{?1}%{?2} = %{epoch}:%{version}-%{release}
%if %is_system_jdk %if %is_system_jdk
Provides: java-javadoc%{?1} = %{epoch}:%{version}-%{release} Provides: java-javadoc%{?1}%{?2} = %{epoch}:%{version}-%{release}
%endif %endif
} }
@ -1099,7 +1140,8 @@ Release: %{?eaprefix}%{rpmrelease}%{?extraver}%{?dist}
Epoch: 1 Epoch: 1
Summary: %{origin_nice} %{featurever} Runtime Environment Summary: %{origin_nice} %{featurever} Runtime Environment
%if 0%{?rhel} <= 8 # Groups are only used up to RHEL 8 and on Fedora versions prior to F30
%if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Languages Group: Development/Languages
%endif %endif
@ -1243,7 +1285,7 @@ BuildRequires: zip
BuildRequires: javapackages-filesystem BuildRequires: javapackages-filesystem
BuildRequires: java-17-openjdk-devel BuildRequires: java-17-openjdk-devel
# Zero-assembler build requirement # Zero-assembler build requirement
%ifnarch %{jit_arches} %ifarch %{zero_arches}
BuildRequires: libffi-devel BuildRequires: libffi-devel
%endif %endif
BuildRequires: tzdata-java >= 2015d BuildRequires: tzdata-java >= 2015d
@ -1265,7 +1307,7 @@ The %{origin_nice} %{featurever} runtime environment.
%if %{include_debug_build} %if %{include_debug_build}
%package slowdebug %package slowdebug
Summary: %{origin_nice} %{featurever} Runtime Environment %{debug_on} Summary: %{origin_nice} %{featurever} Runtime Environment %{debug_on}
%if 0%{?rhel} <= 8 %if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Languages Group: Development/Languages
%endif %endif
@ -1278,7 +1320,7 @@ The %{origin_nice} %{featurever} runtime environment.
%if %{include_fastdebug_build} %if %{include_fastdebug_build}
%package fastdebug %package fastdebug
Summary: %{origin_nice} %{featurever} Runtime Environment %{fastdebug_on} Summary: %{origin_nice} %{featurever} Runtime Environment %{fastdebug_on}
%if 0%{?rhel} <= 8 %if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Languages Group: Development/Languages
%endif %endif
@ -1291,7 +1333,7 @@ The %{origin_nice} %{featurever} runtime environment.
%if %{include_normal_build} %if %{include_normal_build}
%package headless %package headless
Summary: %{origin_nice} %{featurever} Headless Runtime Environment Summary: %{origin_nice} %{featurever} Headless Runtime Environment
%if 0%{?rhel} <= 8 %if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Languages Group: Development/Languages
%endif %endif
@ -1304,7 +1346,9 @@ The %{origin_nice} %{featurever} runtime environment without audio and video sup
%if %{include_debug_build} %if %{include_debug_build}
%package headless-slowdebug %package headless-slowdebug
Summary: %{origin_nice} %{featurever} Runtime Environment %{debug_on} Summary: %{origin_nice} %{featurever} Runtime Environment %{debug_on}
%if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Languages Group: Development/Languages
%endif
%{java_headless_rpo -- %{debug_suffix_unquoted}} %{java_headless_rpo -- %{debug_suffix_unquoted}}
@ -1316,7 +1360,9 @@ The %{origin_nice} %{featurever} runtime environment without audio and video sup
%if %{include_fastdebug_build} %if %{include_fastdebug_build}
%package headless-fastdebug %package headless-fastdebug
Summary: %{origin_nice} %{featurever} Runtime Environment %{fastdebug_on} Summary: %{origin_nice} %{featurever} Runtime Environment %{fastdebug_on}
%if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Languages Group: Development/Languages
%endif
%{java_headless_rpo -- %{fastdebug_suffix_unquoted}} %{java_headless_rpo -- %{fastdebug_suffix_unquoted}}
@ -1328,7 +1374,7 @@ The %{origin_nice} %{featurever} runtime environment without audio and video sup
%if %{include_normal_build} %if %{include_normal_build}
%package devel %package devel
Summary: %{origin_nice} %{featurever} Development Environment Summary: %{origin_nice} %{featurever} Development Environment
%if 0%{?rhel} <= 8 %if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Languages Group: Development/Languages
%endif %endif
@ -1341,7 +1387,7 @@ The %{origin_nice} %{featurever} development tools.
%if %{include_debug_build} %if %{include_debug_build}
%package devel-slowdebug %package devel-slowdebug
Summary: %{origin_nice} %{featurever} Development Environment %{debug_on} Summary: %{origin_nice} %{featurever} Development Environment %{debug_on}
%if 0%{?rhel} <= 8 %if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Languages Group: Development/Languages
%endif %endif
@ -1355,7 +1401,9 @@ The %{origin_nice} %{featurever} development tools.
%if %{include_fastdebug_build} %if %{include_fastdebug_build}
%package devel-fastdebug %package devel-fastdebug
Summary: %{origin_nice} %{featurever} Development Environment %{fastdebug_on} Summary: %{origin_nice} %{featurever} Development Environment %{fastdebug_on}
%if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Tools Group: Development/Tools
%endif
%{java_devel_rpo -- %{fastdebug_suffix_unquoted}} %{java_devel_rpo -- %{fastdebug_suffix_unquoted}}
@ -1404,7 +1452,7 @@ The %{origin_nice} %{featurever} libraries for static linking.
%if %{include_normal_build} %if %{include_normal_build}
%package jmods %package jmods
Summary: JMods for %{origin_nice} %{featurever} Summary: JMods for %{origin_nice} %{featurever}
%if 0%{?rhel} <= 8 %if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Languages Group: Development/Languages
%endif %endif
@ -1417,7 +1465,7 @@ The JMods for %{origin_nice} %{featurever}.
%if %{include_debug_build} %if %{include_debug_build}
%package jmods-slowdebug %package jmods-slowdebug
Summary: JMods for %{origin_nice} %{featurever} %{debug_on} Summary: JMods for %{origin_nice} %{featurever} %{debug_on}
%if 0%{?rhel} <= 8 %if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Languages Group: Development/Languages
%endif %endif
@ -1431,7 +1479,9 @@ The JMods for %{origin_nice} %{featurever}.
%if %{include_fastdebug_build} %if %{include_fastdebug_build}
%package jmods-fastdebug %package jmods-fastdebug
Summary: JMods for %{origin_nice} %{featurever} %{fastdebug_on} Summary: JMods for %{origin_nice} %{featurever} %{fastdebug_on}
%if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Tools Group: Development/Tools
%endif
%{java_jmods_rpo -- %{fastdebug_suffix_unquoted}} %{java_jmods_rpo -- %{fastdebug_suffix_unquoted}}
@ -1443,7 +1493,7 @@ The JMods for %{origin_nice} %{featurever}.
%if %{include_normal_build} %if %{include_normal_build}
%package demo %package demo
Summary: %{origin_nice} %{featurever} Demos Summary: %{origin_nice} %{featurever} Demos
%if 0%{?rhel} <= 8 %if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Languages Group: Development/Languages
%endif %endif
@ -1456,7 +1506,7 @@ The %{origin_nice} %{featurever} demos.
%if %{include_debug_build} %if %{include_debug_build}
%package demo-slowdebug %package demo-slowdebug
Summary: %{origin_nice} %{featurever} Demos %{debug_on} Summary: %{origin_nice} %{featurever} Demos %{debug_on}
%if 0%{?rhel} <= 8 %if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Languages Group: Development/Languages
%endif %endif
@ -1470,7 +1520,9 @@ The %{origin_nice} %{featurever} demos.
%if %{include_fastdebug_build} %if %{include_fastdebug_build}
%package demo-fastdebug %package demo-fastdebug
Summary: %{origin_nice} %{featurever} Demos %{fastdebug_on} Summary: %{origin_nice} %{featurever} Demos %{fastdebug_on}
%if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Languages Group: Development/Languages
%endif
%{java_demo_rpo -- %{fastdebug_suffix_unquoted}} %{java_demo_rpo -- %{fastdebug_suffix_unquoted}}
@ -1482,7 +1534,7 @@ The %{origin_nice} %{featurever} demos.
%if %{include_normal_build} %if %{include_normal_build}
%package src %package src
Summary: %{origin_nice} %{featurever} Source Bundle Summary: %{origin_nice} %{featurever} Source Bundle
%if 0%{?rhel} <= 8 %if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Languages Group: Development/Languages
%endif %endif
@ -1496,7 +1548,7 @@ class library source code for use by IDE indexers and debuggers.
%if %{include_debug_build} %if %{include_debug_build}
%package src-slowdebug %package src-slowdebug
Summary: %{origin_nice} %{featurever} Source Bundle %{for_debug} Summary: %{origin_nice} %{featurever} Source Bundle %{for_debug}
%if 0%{?rhel} <= 8 %if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Languages Group: Development/Languages
%endif %endif
@ -1510,7 +1562,9 @@ The %{compatiblename}-src-slowdebug sub-package contains the complete %{origin_n
%if %{include_fastdebug_build} %if %{include_fastdebug_build}
%package src-fastdebug %package src-fastdebug
Summary: %{origin_nice} %{featurever} Source Bundle %{for_fastdebug} Summary: %{origin_nice} %{featurever} Source Bundle %{for_fastdebug}
%if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Development/Languages Group: Development/Languages
%endif
%{java_src_rpo -- %{fastdebug_suffix_unquoted}} %{java_src_rpo -- %{fastdebug_suffix_unquoted}}
@ -1522,13 +1576,13 @@ The %{compatiblename}-src-fastdebug sub-package contains the complete %{origin_n
%if %{include_normal_build} %if %{include_normal_build}
%package javadoc %package javadoc
Summary: %{origin_nice} %{featurever} API documentation Summary: %{origin_nice} %{featurever} API documentation
%if 0%{?rhel} <= 8 %if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Documentation Group: Documentation
%endif %endif
Requires: javapackages-filesystem Requires: javapackages-filesystem
Obsoletes: javadoc-slowdebug < 1:13.0.0.33-1.rolling Obsoletes: javadoc-slowdebug < 1:13.0.0.33-1.rolling
%{java_javadoc_rpo %{nil}} %{java_javadoc_rpo -- %{nil} %{nil}}
%description javadoc %description javadoc
The %{origin_nice} %{featurever} API documentation. The %{origin_nice} %{featurever} API documentation.
@ -1537,19 +1591,28 @@ The %{origin_nice} %{featurever} API documentation.
%if %{include_normal_build} %if %{include_normal_build}
%package javadoc-zip %package javadoc-zip
Summary: %{origin_nice} %{featurever} API documentation compressed in a single archive Summary: %{origin_nice} %{featurever} API documentation compressed in a single archive
%if 0%{?rhel} <= 8 %if (0%{?rhel} > 0 && 0%{?rhel} <= 8) || (0%{?fedora} >= 0 && 0%{?fedora} < 30)
Group: Documentation Group: Documentation
%endif %endif
Requires: javapackages-filesystem Requires: javapackages-filesystem
Obsoletes: javadoc-zip-slowdebug < 1:13.0.0.33-1.rolling Obsoletes: javadoc-zip-slowdebug < 1:13.0.0.33-1.rolling
%{java_javadoc_rpo %{nil}} %{java_javadoc_rpo -- %{nil} -zip}
%{java_javadoc_rpo -- %{nil} %{nil}}
%description javadoc-zip %description javadoc-zip
The %{origin_nice} %{featurever} API documentation compressed in a single archive. The %{origin_nice} %{featurever} API documentation compressed in a single archive.
%endif %endif
%prep %prep
# Using the echo macro breaks rpmdev-bumpspec, as it parses the first line of stdout :-(
%if 0%{?stapinstall:1}
echo "CPU: %{_target_cpu}, arch install directory: %{archinstall}, SystemTap install directory: %{stapinstall}"
%else
%{error:Unrecognised architecture %{_target_cpu}}
%endif
if [ %{include_normal_build} -eq 0 -o %{include_normal_build} -eq 1 ] ; then if [ %{include_normal_build} -eq 0 -o %{include_normal_build} -eq 1 ] ; then
echo "include_normal_build is %{include_normal_build}" echo "include_normal_build is %{include_normal_build}"
else else
@ -1685,65 +1748,54 @@ EXTRA_CPP_FLAGS="%ourcppflags"
# fix rpmlint warnings # fix rpmlint warnings
EXTRA_CFLAGS="$EXTRA_CFLAGS -fno-strict-aliasing" EXTRA_CFLAGS="$EXTRA_CFLAGS -fno-strict-aliasing"
%endif %endif
export EXTRA_CFLAGS %ifarch %{ix86}
# Align stack boundary on x86_32
EXTRA_CFLAGS="$(echo ${EXTRA_CFLAGS} | sed -e 's|-mstackrealign|-mincoming-stack-boundary=2 -mpreferred-stack-boundary=4|')"
EXTRA_CPP_FLAGS="$(echo ${EXTRA_CPP_FLAGS} | sed -e 's|-mstackrealign|-mincoming-stack-boundary=2 -mpreferred-stack-boundary=4|')"
%endif
export EXTRA_CFLAGS EXTRA_CPP_FLAGS
for suffix in %{build_loop} ; do function buildjdk() {
if [ "x$suffix" = "x" ] ; then local outputdir=${1}
debugbuild=release local buildjdk=${2}
debug_symbols=internal local maketargets="${3}"
else local debuglevel=${4}
# change --something to something local link_opt=${5}
debugbuild=`echo $suffix | sed "s/-//g"`
debug_symbols=internal
fi
for loop in %{main_suffix} %{staticlibs_loop} ; do local top_dir_abs_src_path=$(pwd)/%{top_level_dir_name}
local top_dir_abs_build_path=$(pwd)/${outputdir}
if test "x${loop}" = "x%{main_suffix}" ; then # The OpenJDK version file includes the current
# Copy the source tree so we can remove all in-tree libraries # upstream version information. For some reason,
cp -a %{top_level_dir_name} %{top_level_dir_name_backup} # configure does not automatically use the
# Remove all libraries that are linked # default pre-version supplied there (despite
sh %{SOURCE12} %{top_level_dir_name} full # what the file claims), so we pass it manually
# Variable used by configure and hs_err hook on build failures # to configure
link_opt="system" VERSION_FILE=${top_dir_abs_src_path}/make/conf/version-numbers.conf
# Debug builds don't need same targets as release for if [ -f ${VERSION_FILE} ] ; then
# build speed-up
maketargets="%{release_targets}"
if echo $debugbuild | grep -q "debug" ; then
maketargets="%{debug_targets}"
fi
else
# Variable used by configure and hs_err hook on build failures
link_opt="bundled"
# Static library cycle only builds the static libraries
maketargets="%{static_libs_target}"
fi
top_dir_abs_src_path=$(pwd)/%{top_level_dir_name}
top_dir_abs_build_path=$(pwd)/%{buildoutputdir -- ${suffix}${loop}}
# The OpenJDK version file includes the current
# upstream version information. For some reason,
# configure does not automatically use the
# default pre-version supplied there (despite
# what the file claims), so we pass it manually
# to configure
VERSION_FILE=${top_dir_abs_src_path}/make/conf/version-numbers.conf
if [ -f ${VERSION_FILE} ] ; then
EA_DESIGNATOR=$(grep '^DEFAULT_PROMOTED_VERSION_PRE' ${VERSION_FILE} | cut -d '=' -f 2) EA_DESIGNATOR=$(grep '^DEFAULT_PROMOTED_VERSION_PRE' ${VERSION_FILE} | cut -d '=' -f 2)
else else
echo "Could not find OpenJDK version file."; echo "Could not find OpenJDK version file.";
exit 16 exit 16
fi fi
if [ "x${EA_DESIGNATOR}" != "x%{expected_ea_designator}" ] ; then if [ "x${EA_DESIGNATOR}" != "x%{expected_ea_designator}" ] ; then
echo "Spec file is configured for a %{build_type} build, but upstream version-pre setting is ${EA_DESIGNATOR}"; echo "Spec file is configured for a %{build_type} build, but upstream version-pre setting is ${EA_DESIGNATOR}";
exit 17 exit 17
fi fi
mkdir -p ${top_dir_abs_build_path} echo "Using output directory: ${outputdir}";
pushd ${top_dir_abs_build_path} echo "Checking build JDK ${buildjdk} is operational..."
${buildjdk}/bin/java -version
echo "Using make targets: ${maketargets}"
echo "Using debuglevel: ${debuglevel}"
echo "Using link_opt: ${link_opt}"
echo "Building %{newjavaver}-%{buildver}, pre=${EA_DESIGNATOR}, opt=%{lts_designator}"
bash ${top_dir_abs_src_path}/configure \ mkdir -p ${outputdir}
%ifnarch %{jit_arches} pushd ${outputdir}
bash ${top_dir_abs_src_path}/configure \
%ifarch %{zero_arches}
--with-jvm-variants=zero \ --with-jvm-variants=zero \
%endif %endif
%ifarch %{ppc64le} %ifarch %{ppc64le}
@ -1757,9 +1809,9 @@ bash ${top_dir_abs_src_path}/configure \
--with-vendor-url="https://www.redhat.com/" \ --with-vendor-url="https://www.redhat.com/" \
--with-vendor-bug-url="%{bugs}" \ --with-vendor-bug-url="%{bugs}" \
--with-vendor-vm-bug-url="%{bugs}" \ --with-vendor-vm-bug-url="%{bugs}" \
--with-boot-jdk=/usr/lib/jvm/java-%{buildjdkver}-openjdk \ --with-boot-jdk=${buildjdk} \
--with-debug-level=$debugbuild \ --with-debug-level=${debuglevel} \
--with-native-debug-symbols=$debug_symbols \ --with-native-debug-symbols="%{debug_symbols}" \
--enable-sysconf-nss \ --enable-sysconf-nss \
--enable-unlimited-crypto \ --enable-unlimited-crypto \
--with-zlib=system \ --with-zlib=system \
@ -1780,53 +1832,116 @@ bash ${top_dir_abs_src_path}/configure \
%endif %endif
--disable-warnings-as-errors --disable-warnings-as-errors
make \ cat spec.gmk
make \
LOG=trace \ LOG=trace \
WARNINGS_ARE_ERRORS="-Wno-error" \ WARNINGS_ARE_ERRORS="-Wno-error" \
CFLAGS_WARNINGS_ARE_ERRORS="-Wno-error" \ CFLAGS_WARNINGS_ARE_ERRORS="-Wno-error" \
$maketargets || ( pwd; find ${top_dir_abs_src_path} ${top_dir_abs_build_path} -name "hs_err_pid*.log" | xargs cat && false ) $maketargets || ( pwd; find ${top_dir_abs_src_path} ${top_dir_abs_build_path} -name "hs_err_pid*.log" | xargs cat && false )
popd popd
}
# Restore original source tree if we modified it by removing full in-tree sources function installjdk() {
if [ -d %{top_level_dir_name_backup} ] ; then local imagepath=${1}
if [ -d ${imagepath} ] ; then
# the build (erroneously) removes read permissions from some jars
# this is a regression in OpenJDK 7 (our compiler):
# http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1437
find ${imagepath} -iname '*.jar' -exec chmod ugo+r {} \;
# Build screws up permissions on binaries
# https://bugs.openjdk.java.net/browse/JDK-8173610
find ${imagepath} -iname '*.so' -exec chmod +x {} \;
find ${imagepath}/bin/ -exec chmod +x {} \;
# Install nss.cfg right away as we will be using the JRE above
install -m 644 nss.cfg ${imagepath}/conf/security/
# Install nss.fips.cfg: NSS configuration for global FIPS mode (crypto-policies)
install -m 644 nss.fips.cfg ${imagepath}/conf/security/
# Use system-wide tzdata
rm ${imagepath}/lib/tzdb.dat
ln -s %{_datadir}/javazi-1.8/tzdb.dat ${imagepath}/lib/tzdb.dat
# Create fake alt-java as a placeholder for future alt-java
pushd ${imagepath}
# add alt-java man page
echo "Hardened java binary recommended for launching untrusted code from the Web e.g. javaws" > man/man1/%{alt_java_name}.1
cat man/man1/java.1 >> man/man1/%{alt_java_name}.1
popd
fi
}
%if %{build_hotspot_first}
# Build a fresh libjvm.so first and use it to bootstrap
cp -LR --preserve=mode,timestamps %{bootjdk} newboot
systemjdk=$(pwd)/newboot
buildjdk build/newboot ${systemjdk} %{hotspot_target} "release" "bundled"
mv build/newboot/jdk/lib/server/libjvm.so newboot/lib/server
%else
systemjdk=%{bootjdk}
%endif
for suffix in %{build_loop} ; do
if [ "x$suffix" = "x" ] ; then
debugbuild=release
else
# change --something to something
debugbuild=`echo $suffix | sed "s/-//g"`
fi
for loop in %{main_suffix} %{staticlibs_loop} ; do
builddir=%{buildoutputdir -- ${suffix}${loop}}
bootbuilddir=boot${builddir}
if test "x${loop}" = "x%{main_suffix}" ; then
# Copy the source tree so we can remove all in-tree libraries
cp -a %{top_level_dir_name} %{top_level_dir_name_backup}
# Remove all libraries that are linked
sh %{SOURCE12} %{top_level_dir_name} full
# Use system libraries
link_opt="system"
# Debug builds don't need same targets as release for
# build speed-up. We also avoid bootstrapping these
# slower builds.
if echo $debugbuild | grep -q "debug" ; then
maketargets="%{debug_targets}"
run_bootstrap=false
else
maketargets="%{release_targets}"
run_bootstrap=%{bootstrap_build}
fi
if ${run_bootstrap} ; then
buildjdk ${bootbuilddir} ${systemjdk} "%{bootstrap_targets}" ${debugbuild} ${link_opt}
buildjdk ${builddir} $(pwd)/${bootbuilddir}/images/%{jdkimage} "${maketargets}" ${debugbuild} ${link_opt}
rm -rf ${bootbuilddir}
else
buildjdk ${builddir} ${systemjdk} "${maketargets}" ${debugbuild} ${link_opt}
fi
# Restore original source tree we modified by removing full in-tree sources
rm -rf %{top_level_dir_name} rm -rf %{top_level_dir_name}
mv %{top_level_dir_name_backup} %{top_level_dir_name} mv %{top_level_dir_name_backup} %{top_level_dir_name}
fi else
# Use bundled libraries for building statically
link_opt="bundled"
# Static library cycle only builds the static libraries
maketargets="%{static_libs_target}"
# Always just do the one build for the static libraries
buildjdk ${builddir} ${systemjdk} "${maketargets}" ${debugbuild} ${link_opt}
fi
done # end of main / staticlibs loop done # end of main / staticlibs loop
top_dir_abs_main_build_path=$(pwd)/%{buildoutputdir -- ${suffix}%{main_suffix}} # Final setup on the main image
top_dir_abs_main_build_path=$(pwd)/%{buildoutputdir -- ${suffix}%{main_suffix}}
# the build (erroneously) removes read permissions from some jars installjdk ${top_dir_abs_main_build_path}/images/%{jdkimage}
# this is a regression in OpenJDK 7 (our compiler):
# http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1437
find ${top_dir_abs_main_build_path}/images/%{jdkimage} -iname '*.jar' -exec chmod ugo+r {} \;
# Build screws up permissions on binaries
# https://bugs.openjdk.java.net/browse/JDK-8173610
find ${top_dir_abs_main_build_path}/images/%{jdkimage} -iname '*.so' -exec chmod +x {} \;
find ${top_dir_abs_main_build_path}/images/%{jdkimage}/bin/ -exec chmod +x {} \;
# Install nss.cfg right away as we will be using the JRE above
export JAVA_HOME=${top_dir_abs_main_build_path}/images/%{jdkimage}
# Install nss.cfg right away as we will be using the JRE above
install -m 644 nss.cfg $JAVA_HOME/conf/security/
# Install nss.fips.cfg: NSS configuration for global FIPS mode (crypto-policies)
install -m 644 nss.fips.cfg $JAVA_HOME/conf/security/
# Use system-wide tzdata
rm $JAVA_HOME/lib/tzdb.dat
ln -s %{_datadir}/javazi-1.8/tzdb.dat $JAVA_HOME/lib/tzdb.dat
# Create fake alt-java as a placeholder for future alt-java
pushd ${JAVA_HOME}
# add alt-java man page
echo "Hardened java binary recommended for launching untrusted code from the Web e.g. javaws" > man/man1/%{alt_java_name}.1
cat man/man1/java.1 >> man/man1/%{alt_java_name}.1
popd
# build cycles # build cycles
done # end of release / debug cycle loop done # end of release / debug cycle loop
@ -1932,7 +2047,7 @@ gdb -q "$JAVA_HOME/bin/java" <<EOF | tee gdb.out
handle SIGSEGV pass nostop noprint handle SIGSEGV pass nostop noprint
handle SIGILL pass nostop noprint handle SIGILL pass nostop noprint
set breakpoint pending on set breakpoint pending on
break javaCalls.cpp:1 break javaCalls.cpp:58
commands 1 commands 1
backtrace backtrace
quit quit
@ -1940,9 +2055,7 @@ end
run -version run -version
EOF EOF
# This fails on s390x for some reason. Disable for now. See: %ifarch %{gdb_arches}
# https://koji.fedoraproject.org/koji/taskinfo?taskID=41499227
%ifnarch s390x
grep 'JavaCallWrapper::JavaCallWrapper' gdb.out grep 'JavaCallWrapper::JavaCallWrapper' gdb.out
%endif %endif
@ -2328,7 +2441,27 @@ cjc.mainProgram(args)
%endif %endif
%changelog %changelog
* Wed Feb 16 2022 Andrew Hughes <gnu.andrew@redhat.com> - 1:17.0.2.0.8-3 * Thu Feb 17 2022 Andrew Hughes <gnu.andrew@redhat.com> - 1:17.0.2.0.8-4
- Restructure the build so a minimal initial build is then used for the final build (with docs)
- This reduces pressure on the system JDK and ensures the JDK being built can do a full build
- Turn off bootstrapping for slow debug builds, which are particularly slow on ppc64le.
- Handle Fedora in distro conditionals that currently only pertain to RHEL.
- Run OpenJDK normalizer script on the spec file to fix further rogue whitespace
- Sync gdb test with java-1.8.0-openjdk and improve architecture restrictions.
- Introduce stapinstall variable to set SystemTap arch directory correctly (e.g. arm64 on aarch64)
- Need to support noarch for creating source RPMs for non-scratch builds.
- Replace -mstackrealign with -mincoming-stack-boundary=2 -mpreferred-stack-boundary=4 on x86_32 for stack alignment
- Support a HotSpot-only build so a freshly built libjvm.so can then be used in the bootstrap JDK.
- Explicitly list JIT architectures rather than relying on those with slowdebug builds
- Disable the serviceability agent on Zero architectures even when the architecture itself is supported
- Related: RHEL-45216
* Thu Feb 17 2022 Jiri Vanek <jvanek@redhat.com> - 1:17.0.2.0.8-4
- Replaced tabs by sets of spaces to make rpmlint happy
- javadoc-zip gets its own provides next to plain javadoc ones
- Related: RHEL-45216
* Wed Feb 16 2022 Jiri Vanek <jvanek@redhat.com> - 1:17.0.2.0.8-3
- Minor cosmetic improvements to make spec more comparable between variants - Minor cosmetic improvements to make spec more comparable between variants
- Related: RHEL-45216 - Related: RHEL-45216