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