From 5e0cebbeb7f5d8c74cc1b6a7927b5f51746120a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= Date: Wed, 30 Jan 2019 12:39:14 +0100 Subject: [PATCH] Add conditional for static library --- libxcrypt.spec | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/libxcrypt.spec b/libxcrypt.spec index c1c7731..0627797 100644 --- a/libxcrypt.spec +++ b/libxcrypt.spec @@ -19,6 +19,9 @@ %bcond_with enosys_stubs %endif +# Build the static library? +%bcond_without staticlib + # Run memcheck? %ifarch %{valgrind_arches} # Valgrind does not work well on %%{power64} arches. @@ -94,7 +97,11 @@ --disable-failure-tokens \\\ --disable-silent-rules \\\ --enable-shared \\\ +%if %{with staticlib} \ --enable-static \\\ +%else \ + --disable-static \\\ +%endif \ %if %{with memcheck} \ --enable-valgrind \\\ %else \ @@ -112,8 +119,10 @@ %{__arch_install_post} \ %{__os_install_post} \ %{_bindir}/fipshmac %{buildroot}/%{_lib}/libcrypt.a \ -%{__ln_s} .libcrypt.a.hmac \\\ - %{buildroot}/%{_lib}/.libxcrypt.a.hmac \ +if [[ %{with staticlib} == 1 ]]; then \ + %{__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 \ @@ -237,6 +246,7 @@ The %{name}-devel package contains libraries and header files for developing applications that use %{name}. +%if %{with staticlib} %package static Summary: Static library for -static linking with %{name} @@ -249,6 +259,7 @@ linking. You don't need this, unless you link statically, which is highly discouraged. +%endif %prep @@ -290,12 +301,14 @@ should work unmodified with the provided version of the libcrypt.so.1 library in place. EOF %endif +%if %{with staticlib} %{__cat} << EOF >> README-STATIC Applications that use certain legacy APIs supplied by glibc’s libcrypt (encrypt, encrypt_r, setkey, setkey_r, and fcrypt) cannot be compiled nor linked against the supplied build of the object files provided in the static library libcrypt.a. EOF +%endif %{__mkdir_p} %{_vpath_builddir}{,-compat} @@ -347,7 +360,8 @@ popd # Install documentation to shared %%_pkgdocdir. %{__install} -Dpm 0644 -t %{buildroot}%{_pkgdocdir} \ - ChangeLog NEWS README README-STATIC THANKS TODO + ChangeLog NEWS README THANKS TODO + # Install distribution README file, if existing, to shared %%_pkgdocdir. if [ -f README%{distname} ]; then @@ -361,6 +375,12 @@ if [ -f README-POSIX ]; then README-POSIX fi +# Install README-STATIC file, if existing, to shared %%_pkgdocdir. +if [ -f README-STATIC ]; then + %{__install} -Dpm 0644 -t %{buildroot}%{_pkgdocdir} \ + README-STATIC +fi + %check %if %{with compat_pkg} @@ -437,10 +457,12 @@ done %{_mandir}/man3/crypt_preferred_method.3.* +%if %{with staticlib} %files static %doc %{_pkgdocdir}/README-STATIC /%{_lib}/.lib{,x}crypt.a.hmac /%{_lib}/lib{,x}crypt.a +%endif %changelog