Modernize spec file

This commit is contained in:
Björn Esser 2020-02-17 18:14:10 +01:00
parent aa3e27a4af
commit a9e5473ec3
No known key found for this signature in database
GPG Key ID: F52E98007594C21D

View File

@ -98,8 +98,7 @@
# Needed for out-of-tree builds.
%global src_topleveldir %{_builddir}/%{name}-%{version}
%global _configure "%{src_topleveldir}/configure"
%global _configure "$(realpath ../configure)"
# Common configure options.
@ -118,30 +117,30 @@
%else \
--disable-valgrind \\\
%endif \
--srcdir=%{src_topleveldir} \\\
--srcdir=$(realpath ..) \\\
--with-pkgconfigdir=%{_libdir}/pkgconfig
# Add generation of HMAC checksums of the final stripped
# binaries. %%define with lazy globbing is used here
# intentionally, because using %%global does not work.
%define __spec_install_post \
%{?__debug_package:%{__debug_install_post}} \
%{__arch_install_post} \
%{__os_install_post} \
if [[ %{with staticlib} == 1 ]]; then \
%{_bindir}/fipshmac %{buildroot}/%{_lib}/libcrypt.a \
%{__ln_s} .libcrypt.a.hmac \\\
%{buildroot}/%{_lib}/.libxcrypt.a.hmac \
fi \
%{_bindir}/fipshmac %{buildroot}/%{_lib}/libcrypt.so.%{sov} \
%{__ln_s} .libcrypt.so.%{sov}.hmac \\\
%{buildroot}/%{_lib}/.libcrypt.so.%{soc}.hmac \
if [[ %{with compat_pkg} == 1 ]]; then \
%{_bindir}/fipshmac %{buildroot}/%{_lib}/libcrypt.so.%{csov} \
%{__ln_s} .libcrypt.so.%{csov}.hmac \\\
%{buildroot}/%{_lib}/.libcrypt.so.%{csoc}.hmac \
fi \
%define __spec_install_post \
%{?__debug_package:%{__debug_install_post}} \
%{__arch_install_post} \
%{__os_install_post} \
fipshmac %{buildroot}/%{_lib}/libcrypt.so.%{sov} \
ln -s .libcrypt.so.%{sov}.hmac \\\
%{buildroot}/%{_lib}/.libcrypt.so.%{soc}.hmac \
if [[ %{with staticlib} == 1 ]]; then \
fipshmac %{buildroot}/%{_lib}/libcrypt.a \
ln -s .libcrypt.a.hmac \\\
%{buildroot}/%{_lib}/.libxcrypt.a.hmac \
fi \
if [[ %{with compat_pkg} == 1 ]]; then \
fipshmac %{buildroot}/%{_lib}/libcrypt.so.%{csov} \
ln -s .libcrypt.so.%{csov}.hmac \\\
%{buildroot}/%{_lib}/.libcrypt.so.%{csoc}.hmac \
fi \
%{nil}
@ -199,7 +198,7 @@ Obsoletes: %{name}-compat < %{version}-%{release}
Requires: glibc%{?_isa} >= %{glibc_minver}
%if 0%{?fedora} >= 30
Recommends: whois-mkpasswd
Recommends: mkpasswd
%endif
%description
@ -277,10 +276,10 @@ discouraged.
%prep
%autosetup -p 1
./bootstrap
$(realpath ./bootstrap)
%if %{with new_api}
%{__cat} << EOF >> README%{distname}
cat << EOF >> README%{distname}
This version of the %{name} package ships the libcrypt.so.2
library and does not provide the legacy API functions that have
been provided by glibc's libcrypt.so.1. The removed functions
@ -299,7 +298,7 @@ EOF
%endif
%if %{with enosys_stubs}
%{__cat} << EOF >> README.posix
cat << EOF >> README.posix
This version of the libcrypt.so.1 library has entirely removed
the functionality of the encrypt, encrypt_r, setkey, setkey_r,
and fcrypt functions, while keeping fully binary compatibility
@ -318,7 +317,7 @@ EOF
%endif
%if %{with staticlib}
%{__cat} << EOF >> README.static
cat << EOF >> README.static
Applications that use certain legacy APIs supplied by glibcs
libcrypt (encrypt, encrypt_r, setkey, setkey_r, and fcrypt)
cannot be compiled nor linked against the supplied build of
@ -328,7 +327,7 @@ EOF
%build
%{__mkdir_p} %{_vpath_builddir}{,-compat}
mkdir -p %{_vpath_builddir}
# Build the default system library.
pushd %{_vpath_builddir}
@ -345,6 +344,8 @@ pushd %{_vpath_builddir}
popd
%if %{with compat_pkg}
mkdir -p %{_vpath_builddir}-compat
# Build the compatibility library.
pushd %{_vpath_builddir}-compat
%configure \
@ -363,37 +364,35 @@ popd
%make_install -C %{_vpath_builddir}-compat
# Cleanup everything we do not need from the compatibility library.
%{_bindir}/find %{buildroot} -xtype f -not -name 'libcrypt.so.%{csoc}*' \
-delete -print
%{_bindir}/find %{buildroot} -type l -not -name 'libcrypt.so.%{csoc}*' \
-delete -print
find %{buildroot} -xtype f -not -name 'libcrypt.so.%{csoc}*' -delete -print
find %{buildroot} -type l -not -name 'libcrypt.so.%{csoc}*' -delete -print
%endif
# Install the default system library.
%make_install -C %{_vpath_builddir}
# Get rid of libtool crap.
%{_bindir}/find %{buildroot} -name '*.la' -delete -print
find %{buildroot} -name '*.la' -delete -print
# Install documentation to shared %%_pkgdocdir.
%{__install} -Dpm 0644 -t %{buildroot}%{_pkgdocdir} \
install -Dpm 0644 -t %{buildroot}%{_pkgdocdir} \
ChangeLog NEWS README* THANKS TODO
# Drop README.md as it is identical to README.
%{__rm} -f %{buildroot}%{_pkgdocdir}/README.md
rm -f %{buildroot}%{_pkgdocdir}/README.md
%check
build_dirs="%{_vpath_builddir}"
%if %{with compat_pkg}
for dir in %{_vpath_builddir} %{_vpath_builddir}-compat; do
%else
for dir in %{_vpath_builddir}; do
build_dirs="${build_dirs} %{_vpath_builddir}-compat"
%endif
for dir in ${build_dirs}; do
%make_build -C ${dir} check || \
{
rc=$?;
echo "-----BEGIN TESTLOG: ${dir}-----";
%{__cat} ${dir}/test-suite.log;
cat ${dir}/test-suite.log;
echo "-----END TESTLOG: ${dir}-----";
exit $rc;
}
@ -402,7 +401,7 @@ for dir in %{_vpath_builddir}; do
{
rc=$?;
echo "-----BEGIN TESTLOG: ${dir}-----";
%{__cat} ${dir}/test-suite-memcheck.log;
cat ${dir}/test-suite-memcheck.log;
echo "-----END TESTLOG: ${dir}-----";
exit $rc;
}