Andreas Schwab 2022-01-06 08:51:26 +00:00 committed by Git OBS Bridge
parent 39e714c451
commit a8d047aa30

View File

@ -1,7 +1,7 @@
#
# spec file
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -16,24 +16,6 @@
#
%if 0%{?sle_version} >= 150400 || 0%{?suse_version} >= 1550
%define livepatchable 1
# Set variables for livepatching.
%define _other %{_topdir}/OTHER
%define tar_basename glibc-livepatch-%{version}-%{release}
%define tar_package_name %{tar_basename}.%{_arch}.tar.xz
%define clones_dest_dir %{tar_basename}/%{_arch}
%else
# Unsupported operating system.
%define livepatchable 0
%endif
%ifnarch x86_64
# Unsupported architectures must have livepatch disabled.
%define livepatchable 0
%endif
# Run with osc --with=fast_build to have a shorter turnaround
# It will avoid building some parts of glibc
%bcond_with fast_build
@ -67,6 +49,13 @@
%bcond_with usrmerged
%endif
# Enable support for livepatching.
%ifarch x86_64
%bcond_without livepatching 1
%else
%bcond_with livepatching 0
%endif
%bcond_with build_all
%define build_main 1
%define build_utils %{with build_all}
@ -79,7 +68,6 @@ ExclusiveArch: do_not_build
%define build_main 0
%define build_utils 1
%define build_testsuite 0
%define livepatchable 0
%endif
%if "%flavor" == "testsuite"
%if %{with ringdisabled}
@ -88,7 +76,6 @@ ExclusiveArch: do_not_build
%define build_main 0
%define build_utils 0
%define build_testsuite 1
%define livepatchable 0
%endif
%if 0%{?cross_arch:1}
%define build_main 0
@ -678,7 +665,7 @@ BuildCCplus=%{cross_arch}-suse-linux-g++
# Add build flags that cannot be passed to configure.
ExtraBuildFlags=
%if %{livepatchable}
%if %{build_main} && %{with livepatching}
# Append necessary flags for livepatch support, if enabled. Do it on make, else
# on configure GCC will report that it can't write the ipa-clones to /dev/ and
# configure will fail to detect that gcc support several flags.
@ -851,32 +838,6 @@ make %{?_smp_mflags} -C cc-base check-abi
%endif
%install
%if %{livepatchable}
# Ipa-clones are files generated by gcc which logs changes made across
# functions, and we need to know such changes to build livepatches
# correctly. These files are intended to be used by the livepatch
# developers and may be retrieved by using `osc getbinaries`.
#
# Create list of ipa-clones.
find . -name "*.ipa-clones" ! -empty | sed 's/^\.\///g' | sort > ipa-clones.list
# Create ipa-clones destination folder and move clones there.
mkdir -p ipa-clones/%{clones_dest_dir}
while read f; do
_dest=ipa-clones/%{clones_dest_dir}/$f
mkdir -p ${_dest%/*}
cp $f $_dest
done < ipa-clones.list
# Create tarball with ipa-clones.
tar cfJ %{tar_package_name} -C ipa-clones %{tar_basename}
# Copy tarball to the OTHER folder to store it as artefact.
cp %{tar_package_name} %{_other}
%endif # livepatchable
%if !%{build_testsuite}
%if %{with usrmerged}
@ -902,6 +863,31 @@ ln -s . %{buildroot}%{slibdir}/lp64d
%endif
%if %{build_main}
%if %{with livepatching}
%define tar_basename glibc-livepatch-%{version}-%{release}
%define tar_package_name %{tar_basename}.%{_arch}.tar.xz
%define clones_dest_dir %{tar_basename}/%{_arch}
# Ipa-clones are files generated by gcc which logs changes made across
# functions, and we need to know such changes to build livepatches
# correctly. These files are intended to be used by the livepatch
# developers and may be retrieved by using `osc getbinaries`.
#
# Create ipa-clones destination folder and move clones there.
mkdir -p ipa-clones/%{clones_dest_dir}
find . -name "*.ipa-clones" ! -empty \
-exec cp -t ipa-clones/%{clones_dest_dir} --parents {} +
# Create tarball with ipa-clones.
tar -cJf %{tar_package_name} -C ipa-clones \
--owner root --group root --sort name %{tar_basename}
# Copy tarball to the OTHER folder to store it as artifact.
cp %{tar_package_name} %{_topdir}/OTHER
%endif
# We don't want to strip the .symtab from our libraries in find-debuginfo.sh,
# certainly not from libc.so.* because it is used by libthread_db to find
# some non-exported symbols in order to detect if threading support
@ -1096,11 +1082,12 @@ make %{?_smp_mflags} install_root=%{buildroot}/%{sysroot} install -C cc-base
rm -rf %{buildroot}/%{sysroot}/%{_libdir}/audit
rm -rf %{buildroot}/%{sysroot}/%{_libdir}/gconv
rm -rf %{buildroot}/%{sysroot}/%{_infodir}
rm -rf %{buildroot}/%{sysroot}/%{_prefix}/share/i18n
rm -rf %{buildroot}/%{sysroot}/%{_datadir}/locale/*/
rm -f %{buildroot}/%{sysroot}/%{_bindir}/makedb
rm -rf %{buildroot}/%{sysroot}/var/lib
rm -f %{buildroot}/%{sysroot}/%{_sbindir}/nscd
rm -rf %{buildroot}/%{sysroot}/%{_datadir}
rm -rf %{buildroot}/%{sysroot}/%{_libexecdir}
rm -rf %{buildroot}/%{sysroot}/%{_bindir}
rm -rf %{buildroot}/%{sysroot}/%{_sbindir}
rm -rf %{buildroot}/%{sysroot}/etc
rm -rf %{buildroot}/%{sysroot}/var
# Some programs look for <prefix>/lib/../$subdir where subdir is
# for instance "lib64". For this path lookup to succeed we need the