Build static-libs-image and add resulting files via -static-libs sub-package.

This commit is contained in:
Jiri Vanek 2020-10-09 11:03:31 +02:00 committed by Petra Mikova
parent e1e52af5d3
commit 3338c5bd61
1 changed files with 77 additions and 8 deletions

View File

@ -20,6 +20,9 @@
# Enable release builds by default on relevant arches.
%bcond_without release
# Workaround for stripping of debug symbols from static libraries
%define __brp_strip_static_archive %{nil}
# 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.
# See: https://bugzilla.redhat.com/show_bug.cgi?id=1520879
@ -138,12 +141,12 @@
%endif
%if %{bootstrap_build}
%global release_targets bootcycle-images docs-zip
%global release_targets bootcycle-images static-libs-image docs-zip
%else
%global release_targets images docs-zip
%global release_targets images docs-zip static-libs-image
%endif
# No docs nor bootcycle for debug builds
%global debug_targets images
%global debug_targets images static-libs-image
# Filter out flags from the optflags macro that cause problems with the OpenJDK build
@ -237,7 +240,7 @@
%global top_level_dir_name %{origin}
%global minorver 0
%global buildver 36
%global rpmrelease 2
%global rpmrelease 3
# 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
%global priority %( printf '%02d%02d%02d%02d' %{majorver} %{minorver} %{securityver} %{buildver} )
@ -286,8 +289,9 @@
# parametrized macros are order-sensitive
%global compatiblename java-%{majorver}-%{origin}
%global fullversion %{compatiblename}-%{version}-%{release}
# images stub
%global jdkimage jdk
# images directories from upstream build
%global jdkimage jdk
%global static_libs_image static-libs
# output dir stub
%global buildoutputdir() %{expand:openjdk/build%1}
# we can copy the javadoc to not arched dir, or make it not noarch
@ -816,6 +820,10 @@ exit 0
%{_jvmdir}/%{sdkdir %%1}/lib/src.zip
}
%define files_static_libs() %{expand:
%{_jvmdir}/%{sdkdir %%1}/lib/static/linux-%{archinstall}/glibc/lib*.a
}
%define files_javadoc() %{expand:
%doc %{_javadocdir}/%{uniquejavadocdir %%1}
%license %{buildoutputdir %%1}/images/%{jdkimage}/legal
@ -926,6 +934,11 @@ Provides: java-sdk%1 = %{epoch}:%{version}-%{release}
%endif
}
%define java_static_libs_rpo() %{expand:
Requires: %{name}-devel%1%{?_isa} = %{epoch}:%{version}-%{release}
OrderWithRequires: %{name}-headless%1%{?_isa} = %{epoch}:%{version}-%{release}
}
%define java_jmods_rpo() %{expand:
# Requires devel package
# as jmods are bytecode, they should be OK without any _isa
@ -1212,6 +1225,38 @@ The %{origin_nice} development tools %{majorver}.
%{fastdebug_warning}
%endif
%if %{include_normal_build}
%package static-libs
Summary: %{origin_nice} libraries for static linking %{majorver}
%{java_static_libs_rpo %{nil}}
%description static-libs
The %{origin_nice} libraries for static linking %{majorver}.
%endif
%if %{include_debug_build}
%package static-libs-debug
Summary: %{origin_nice} libraries for static linking %{majorver} %{debug_on}
%{java_static_libs_rpo -- %{debug_suffix_unquoted}}
%description static-libs-debug
The %{origin_nice} libraries for static linking %{majorver}.
%{debug_warning}
%endif
%if %{include_fastdebug_build}
%package static-libs-fastdebug
Summary: %{origin_nice} libraries for static linking %{majorver} %{fastdebug_on}
%{java_static_libs_rpo -- %{fastdebug_suffix_unquoted}}
%description static-libs-fastdebug
The %{origin_nice} libraries for static linking %{majorver}.
%{fastdebug_warning}
%endif
%if %{include_normal_build}
%package jmods
Summary: JMods for %{origin_nice} %{majorver}
@ -1325,7 +1370,7 @@ The java-%{origin}-src-fastdebug sub-package contains the complete %{origin_nice
Summary: %{origin_nice} %{majorver} API documentation
Group: Documentation
Requires: javapackages-tools
Obsoletes: javadoc-slowdebug < 1:13.0.0.33-1.rolling
Obsoletes: javadoc-debug < 1:13.0.0.33-1.rolling
%{java_javadoc_rpo %{nil}}
@ -1336,7 +1381,7 @@ The %{origin_nice} %{majorver} API documentation.
Summary: %{origin_nice} %{majorver} API documentation compressed in a single archive
Group: Documentation
Requires: javapackages-tools
Obsoletes: javadoc-zip-slowdebug < 1:13.0.0.33-1.rolling
Obsoletes: javadoc-zip-debug < 1:13.0.0.33-1.rolling
%{java_javadoc_rpo %{nil}}
@ -1578,6 +1623,11 @@ $JAVA_HOME/bin/java --add-opens java.base/javax.crypto=ALL-UNNAMED TestCryptoLev
$JAVA_HOME/bin/javac -d . %{SOURCE14}
$JAVA_HOME/bin/java $(echo $(basename %{SOURCE14})|sed "s|\.java||")
# Check debug symbols in static libraries (smoke test)
export STATIC_LIBS_HOME=$(pwd)/%{buildoutputdir -- $suffix}/images/%{static_libs_image}
readelf --debug-dump $STATIC_LIBS_HOME/lib/libfdlibm.a | grep w_remainder.c
readelf --debug-dump $STATIC_LIBS_HOME/lib/libfdlibm.a | grep e_remainder.c
# Check debug symbols are present and can identify code
find "$JAVA_HOME" -iname '*.so' -print0 | while read -d $'\0' lib
do
@ -1716,6 +1766,10 @@ pushd %{buildoutputdir $suffix}/images/%{jdkimage}
rm -rf $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir $suffix}/man
popd
# Install static libs artefacts
mkdir -p $RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir -- $suffix}/lib/static/linux-%{archinstall}/glibc
cp -a %{buildoutputdir -- $suffix}/images/%{static_libs_image}/lib/*.a \
$RPM_BUILD_ROOT%{_jvmdir}/%{sdkdir -- $suffix}/lib/static/linux-%{archinstall}/glibc
# Install Javadoc documentation
@ -1911,6 +1965,9 @@ require "copy_jdk_configs.lua"
%files devel
%{files_devel %{nil}}
%files static-libs
%{files_static_libs %{nil}}
%files jmods
%{files_jmods %{nil}}
@ -1944,6 +2001,9 @@ require "copy_jdk_configs.lua"
%files jmods-debug
%{files_jmods -- %{debug_suffix_unquoted}}
%files static-libs-debug
%{files_static_libs -- %{debug_suffix_unquoted}}
%files demo-debug
%{files_demo -- %{debug_suffix_unquoted}}
@ -1961,6 +2021,9 @@ require "copy_jdk_configs.lua"
%files devel-fastdebug
%{files_devel -- %{fastdebug_suffix_unquoted}}
%files static-libs-fastdebug
%{files_static_libs -- %{fastdebug_suffix_unquoted}}
%files jmods-fastdebug
%{files_jmods -- %{fastdebug_suffix_unquoted}}
@ -1973,6 +2036,12 @@ require "copy_jdk_configs.lua"
%endif
%changelog
* Fri Oct 09 2020 Jiri Vanek <jvanek@redhat.com> - 1:15.0.0.36-3.rolling
- Build static-libs-image and add resulting files via -static-libs sub-package.
- Disable stripping of debug symbols for static libraries part of the -static-libs sub-package.
- JDK-8245832 increases the set of static libraries, so try and include them all with a wildcard.
- Update static-libs packaging to new layout
* Mon Sep 21 2020 Petra Alice Mikova <pmikova@redhat.com> - 1:15.0.0.36-2.rolling
- Add support for fastdebug builds on 64 bit architectures