[packages/libxcrypt] add bcond for building as libcrypt replacement

atler atler at pld-linux.org
Mon Aug 24 21:36:03 CEST 2020


commit 0f4884b2ffa9d94c3ac14e6bfe1f3ebd7ec1cb15
Author: Jan Palus <atler at pld-linux.org>
Date:   Mon Aug 24 21:30:19 2020 +0200

    add bcond for building as libcrypt replacement
    
    non-obsolete and maintained replacement which both fedora and debian
    default to

 libxcrypt.spec | 41 ++++++++++++++++++++++++++++++++---------
 1 file changed, 32 insertions(+), 9 deletions(-)
---
diff --git a/libxcrypt.spec b/libxcrypt.spec
index f9c565b..1f46a14 100644
--- a/libxcrypt.spec
+++ b/libxcrypt.spec
@@ -1,3 +1,7 @@
+#
+# Conditional build:
+%bcond_with	default_crypt	# build as default libcrypt provider
+
 Summary:	Crypt Library for DES, MD5, and Blowfish
 Summary(pl.UTF-8):	Biblioteka szyfrująca hasła obsługująca DES, MD5 i Blowfish
 Name:		libxcrypt
@@ -15,10 +19,23 @@ BuildRequires:	automake >= 1:1.14
 BuildRequires:	gcc >= 5:3.2
 BuildRequires:	libtool >= 2:2
 BuildRequires:	pkgconfig >= 1:0.27
+%if %{with default_crypt}
+Provides:	crypt(blowfish)
+Obsoletes:	glibc-libcrypt
+%endif
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %undefine	__cxx
 
+%if %{with default_crypt}
+%define		libname		libcrypt
+%define		libver		1
+%else
+%define		libname		libxcrypt
+%define		libver		2
+%endif
+
+
 %description
 libxcrypt is a replacement for libcrypt, which comes with the GNU C
 Library. It supports DES crypt, MD5, and passwords with Blowfish
@@ -60,7 +77,7 @@ Ten pakiet zawiera statyczną wersję biblioteki libxcrypt.
 
 %prep
 %setup -q
-%patch0 -p1
+%{!?with_default_crypt:%patch0 -p1}
 
 %build
 %{__libtoolize}
@@ -81,15 +98,15 @@ install -d $RPM_BUILD_ROOT/%{_lib}
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
-%{__mv} $RPM_BUILD_ROOT%{_libdir}/libxcrypt.so.* $RPM_BUILD_ROOT/%{_lib}
-ln -snf /%{_lib}/$(basename $RPM_BUILD_ROOT/%{_lib}/libxcrypt.so.*.*.*) $RPM_BUILD_ROOT%{_libdir}/libxcrypt.so
+%{__mv} $RPM_BUILD_ROOT%{_libdir}/%{libname}.so.* $RPM_BUILD_ROOT/%{_lib}
+ln -snf /%{_lib}/$(basename $RPM_BUILD_ROOT/%{_lib}/%{libname}.so.*.*.*) $RPM_BUILD_ROOT%{_libdir}/%{libname}.so
 
 # obsoleted by pkg-config
-%{__rm} $RPM_BUILD_ROOT%{_libdir}/libxcrypt.la
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/%{libname}.la
 # PLD doesn't need Owl compatibility
 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libowcrypt.*
 # packaged with glibc-devel
-%{__rm} $RPM_BUILD_ROOT%{_mandir}/man3/crypt{,_r,_ra,_rn}.3*
+%{!?with_default_crypt:%{__rm} $RPM_BUILD_ROOT%{_mandir}/man3/crypt{,_r,_ra,_rn}.3*}
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -100,20 +117,26 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(644,root,root,755)
 %doc AUTHORS ChangeLog LICENSING NEWS README.md THANKS TODO.md
-%attr(755,root,root) /%{_lib}/libxcrypt.so.*.*.*
-%attr(755,root,root) %ghost /%{_lib}/libxcrypt.so.2
+%attr(755,root,root) /%{_lib}/%{libname}.so.*.*.*
+%attr(755,root,root) %ghost /%{_lib}/%{libname}.so.%{libver}
 
 %files devel
 %defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libxcrypt.so
+%attr(755,root,root) %{_libdir}/%{libname}.so
 %{_includedir}/xcrypt
 %{_pkgconfigdir}/libcrypt.pc
 %{_pkgconfigdir}/libxcrypt.pc
 %{_mandir}/man3/crypt_checksalt.3*
 %{_mandir}/man3/crypt_gensalt*.3*
 %{_mandir}/man3/crypt_preferred_method.3*
+%if %{with default_crypt}
+%{_mandir}/man3/crypt.3*
+%{_mandir}/man3/crypt_r.3*
+%{_mandir}/man3/crypt_ra.3*
+%{_mandir}/man3/crypt_rn.3*
+%endif
 %{_mandir}/man5/crypt.5*
 
 %files static
 %defattr(644,root,root,755)
-%{_libdir}/libxcrypt.a
+%{_libdir}/%{libname}.a
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libxcrypt.git/commitdiff/0f4884b2ffa9d94c3ac14e6bfe1f3ebd7ec1cb15



More information about the pld-cvs-commit mailing list