Reduce disk footprint by removing build artifacts by default.
Related: rhbz#1999940
This commit is contained in:
parent
7eeb37f129
commit
42db25eae5
@ -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
|
||||||
|
# Remove build artifacts by default
|
||||||
|
%bcond_with artifacts
|
||||||
|
|
||||||
# Workaround for stripping of debug symbols from static libraries
|
# Workaround for stripping of debug symbols from static libraries
|
||||||
%if %{with staticlibs}
|
%if %{with staticlibs}
|
||||||
@ -343,7 +345,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 7
|
%global buildver 7
|
||||||
%global rpmrelease 5
|
%global rpmrelease 6
|
||||||
#%%global tagsuffix %%{nil}
|
#%%global tagsuffix %%{nil}
|
||||||
# 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
|
||||||
@ -393,6 +395,7 @@
|
|||||||
%global static_libs_image static-libs
|
%global static_libs_image static-libs
|
||||||
# output dir stub
|
# output dir stub
|
||||||
%define buildoutputdir() %{expand:build/jdk11.build%{?1}}
|
%define buildoutputdir() %{expand:build/jdk11.build%{?1}}
|
||||||
|
%define installoutputdir() %{expand:install/jdk11.install%{?1}}
|
||||||
# we can copy the javadoc to not arched dir, or make it not noarch
|
# we can copy the javadoc to not arched dir, or make it not noarch
|
||||||
%define uniquejavadocdir() %{expand:%{fullversion}.%{_arch}%{?1}}
|
%define uniquejavadocdir() %{expand:%{fullversion}.%{_arch}%{?1}}
|
||||||
# main id and dir of this jdk
|
# main id and dir of this jdk
|
||||||
@ -1760,10 +1763,11 @@ export EXTRA_CFLAGS EXTRA_ASFLAGS
|
|||||||
|
|
||||||
function buildjdk() {
|
function buildjdk() {
|
||||||
local outputdir=${1}
|
local outputdir=${1}
|
||||||
local buildjdk=${2}
|
local installdir=${2}
|
||||||
local maketargets="${3}"
|
local buildjdk=${3}
|
||||||
local debuglevel=${4}
|
local maketargets="${4}"
|
||||||
local link_opt=${5}
|
local debuglevel=${5}
|
||||||
|
local link_opt=${6}
|
||||||
|
|
||||||
local top_dir_abs_src_path=$(pwd)/%{top_level_dir_name}
|
local top_dir_abs_src_path=$(pwd)/%{top_level_dir_name}
|
||||||
local top_dir_abs_build_path=$(pwd)/${outputdir}
|
local top_dir_abs_build_path=$(pwd)/${outputdir}
|
||||||
@ -1776,7 +1780,7 @@ function buildjdk() {
|
|||||||
echo "Using link_opt: ${link_opt}"
|
echo "Using link_opt: ${link_opt}"
|
||||||
echo "Building %{newjavaver}-%{buildver}, pre=%{ea_designator}, opt=%{lts_designator}"
|
echo "Building %{newjavaver}-%{buildver}, pre=%{ea_designator}, opt=%{lts_designator}"
|
||||||
|
|
||||||
mkdir -p ${outputdir}
|
mkdir -p ${outputdir} ${installdir}
|
||||||
pushd ${outputdir}
|
pushd ${outputdir}
|
||||||
|
|
||||||
bash ${top_dir_abs_src_path}/configure \
|
bash ${top_dir_abs_src_path}/configure \
|
||||||
@ -1825,6 +1829,23 @@ function buildjdk() {
|
|||||||
$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
|
||||||
|
|
||||||
|
echo "Installing build from ${outputdir} to ${installdir}..."
|
||||||
|
echo "Installing images..."
|
||||||
|
mv ${outputdir}/images ${installdir}
|
||||||
|
if [ -d ${outputdir}/bundles ] ; then
|
||||||
|
echo "Installing bundles...";
|
||||||
|
mv ${outputdir}/bundles ${installdir} ;
|
||||||
|
fi
|
||||||
|
if [ -d ${outputdir}/docs ] ; then
|
||||||
|
echo "Installing docs...";
|
||||||
|
mv ${outputdir}/docs ${installdir} ;
|
||||||
|
fi
|
||||||
|
|
||||||
|
%if !%{with artifacts}
|
||||||
|
echo "Removing output directory...";
|
||||||
|
rm -rf ${outputdir}
|
||||||
|
%endif
|
||||||
}
|
}
|
||||||
|
|
||||||
function installjdk() {
|
function installjdk() {
|
||||||
@ -1873,6 +1894,8 @@ for suffix in %{build_loop} ; do
|
|||||||
|
|
||||||
builddir=%{buildoutputdir -- ${suffix}${loop}}
|
builddir=%{buildoutputdir -- ${suffix}${loop}}
|
||||||
bootbuilddir=boot${builddir}
|
bootbuilddir=boot${builddir}
|
||||||
|
installdir=%{installoutputdir -- ${suffix}${loop}}
|
||||||
|
bootinstalldir=boot${installdir}
|
||||||
|
|
||||||
if test "x${loop}" = "x%{main_suffix}" ; then
|
if test "x${loop}" = "x%{main_suffix}" ; then
|
||||||
# Copy the source tree so we can remove all in-tree libraries
|
# Copy the source tree so we can remove all in-tree libraries
|
||||||
@ -1888,11 +1911,11 @@ for suffix in %{build_loop} ; do
|
|||||||
maketargets="%{debug_targets}"
|
maketargets="%{debug_targets}"
|
||||||
fi
|
fi
|
||||||
%if %{bootstrap_build}
|
%if %{bootstrap_build}
|
||||||
buildjdk ${bootbuilddir} ${systemjdk} "%{bootstrap_targets}" ${debugbuild} ${link_opt}
|
buildjdk ${bootbuilddir} ${bootinstalldir} ${systemjdk} "%{bootstrap_targets}" ${debugbuild} ${link_opt}
|
||||||
buildjdk ${builddir} $(pwd)/${bootbuilddir}/images/%{jdkimage} "${maketargets}" ${debugbuild} ${link_opt}
|
buildjdk ${builddir} ${installdir} $(pwd)/${bootinstalldir}/images/%{jdkimage} "${maketargets}" ${debugbuild} ${link_opt}
|
||||||
rm -rf ${bootbuilddir}
|
%{!?with_artifacts:rm -rf ${bootinstalldir}}
|
||||||
%else
|
%else
|
||||||
buildjdk ${builddir} ${systemjdk} "${maketargets}" ${debugbuild} ${link_opt}
|
buildjdk ${builddir} ${installdir} ${systemjdk} "${maketargets}" ${debugbuild} ${link_opt}
|
||||||
%endif
|
%endif
|
||||||
# Restore original source tree we modified by removing full in-tree sources
|
# Restore original source tree we modified by removing full in-tree sources
|
||||||
rm -rf %{top_level_dir_name}
|
rm -rf %{top_level_dir_name}
|
||||||
@ -1903,13 +1926,13 @@ for suffix in %{build_loop} ; do
|
|||||||
# Static library cycle only builds the static libraries
|
# Static library cycle only builds the static libraries
|
||||||
maketargets="%{static_libs_target}"
|
maketargets="%{static_libs_target}"
|
||||||
# Always just do the one build for the static libraries
|
# Always just do the one build for the static libraries
|
||||||
buildjdk ${builddir} ${systemjdk} "${maketargets}" ${debugbuild} ${link_opt}
|
buildjdk ${builddir} ${installdir} ${systemjdk} "${maketargets}" ${debugbuild} ${link_opt}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done # end of main / staticlibs loop
|
done # end of main / staticlibs loop
|
||||||
|
|
||||||
# Final setup on the main image
|
# Final setup on the main image
|
||||||
top_dir_abs_main_build_path=$(pwd)/%{buildoutputdir -- ${suffix}%{main_suffix}}
|
top_dir_abs_main_build_path=$(pwd)/%{installoutputdir -- ${suffix}%{main_suffix}}
|
||||||
installjdk ${top_dir_abs_main_build_path}/images/%{jdkimage}
|
installjdk ${top_dir_abs_main_build_path}/images/%{jdkimage}
|
||||||
|
|
||||||
# build cycles
|
# build cycles
|
||||||
@ -1920,9 +1943,9 @@ done # end of release / debug cycle loop
|
|||||||
# We test debug first as it will give better diagnostics on a crash
|
# We test debug first as it will give better diagnostics on a crash
|
||||||
for suffix in %{build_loop} ; do
|
for suffix in %{build_loop} ; do
|
||||||
|
|
||||||
top_dir_abs_main_build_path=$(pwd)/%{buildoutputdir -- ${suffix}%{main_suffix}}
|
top_dir_abs_main_build_path=$(pwd)/%{installoutputdir -- ${suffix}%{main_suffix}}
|
||||||
%if %{include_staticlibs}
|
%if %{include_staticlibs}
|
||||||
top_dir_abs_staticlibs_build_path=$(pwd)/%{buildoutputdir -- ${suffix}%{staticlibs_loop}}
|
top_dir_abs_staticlibs_build_path=$(pwd)/%{installoutputdir -- ${suffix}%{staticlibs_loop}}
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
export JAVA_HOME=${top_dir_abs_main_build_path}/images/%{jdkimage}
|
export JAVA_HOME=${top_dir_abs_main_build_path}/images/%{jdkimage}
|
||||||
@ -2056,9 +2079,9 @@ STRIP_KEEP_SYMTAB=libjvm*
|
|||||||
|
|
||||||
for suffix in %{build_loop} ; do
|
for suffix in %{build_loop} ; do
|
||||||
|
|
||||||
top_dir_abs_main_build_path=$(pwd)/%{buildoutputdir -- ${suffix}%{main_suffix}}
|
top_dir_abs_main_build_path=$(pwd)/%{installoutputdir -- ${suffix}%{main_suffix}}
|
||||||
%if %{include_staticlibs}
|
%if %{include_staticlibs}
|
||||||
top_dir_abs_staticlibs_build_path=$(pwd)/%{buildoutputdir -- ${suffix}%{staticlibs_loop}}
|
top_dir_abs_staticlibs_build_path=$(pwd)/%{installoutputdir -- ${suffix}%{staticlibs_loop}}
|
||||||
%endif
|
%endif
|
||||||
jdk_image=${top_dir_abs_main_build_path}/images/%{jdkimage}
|
jdk_image=${top_dir_abs_main_build_path}/images/%{jdkimage}
|
||||||
|
|
||||||
@ -2401,6 +2424,10 @@ require "copy_jdk_configs.lua"
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sun Oct 10 2021 Andrew Hughes <gnu.andrew@redhat.com> - 1:11.0.12.0.7-6
|
||||||
|
- Reduce disk footprint by removing build artifacts by default.
|
||||||
|
- Related: rhbz#1999940
|
||||||
|
|
||||||
* Sun Oct 10 2021 Andrew Hughes <gnu.andrew@redhat.com> - 1:11.0.12.0.7-5
|
* Sun Oct 10 2021 Andrew Hughes <gnu.andrew@redhat.com> - 1:11.0.12.0.7-5
|
||||||
- Restructure the build so a minimal initial build is then used for the final build (with docs)
|
- 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
|
- This reduces pressure on the system JDK and ensures the JDK being built can do a full build
|
||||||
|
Loading…
Reference in New Issue
Block a user