+#
+# 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
-Version: 3.0.2
+Version: 4.4.22
Release: 1
-License: LGPL v2+, Public Domain, Freeware
+License: LGPL v2.1+
Group: Libraries
-Source0: ftp://ftp.suse.com/pub/people/kukuk/libxcrypt/%{name}-%{version}.tar.bz2
-# Source0-md5: 56cf4285086f26649b8792b53fe8b00f
+#Source0Download: https://github.com/besser82/libxcrypt/releases
+Source0: https://github.com/besser82/libxcrypt/archive/v%{version}/%{name}-%{version}.tar.gz
+# Source0-md5: 6e4f363d86f99562d012c47e7f024618
+Patch0: %{name}-xcrypt.patch
+URL: https://github.com/besser82/libxcrypt
+BuildRequires: autoconf >= 2.62
+BuildRequires: automake >= 1:1.14
+BuildRequires: gcc >= 5:3.2
+BuildRequires: libltdl-devel
+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
+libxcrypt is a replacement for libcrypt, which comes with the GNU C
+Library. It supports DES crypt, MD5, and passwords with Blowfish
encryption.
+%description -l pl.UTF-8
+libxcrypt to zamiennik biblioteki libcrypt dostarczanej wraz z
+biblioteką GNU C (libc). Obsługuje szyfrowanie haseł DES, MD5 oraz
+Blowfish.
+
%package devel
-Summary: Header files and develpment documentation for libxcrypt
+Summary: Header file for libxcrypt
+Summary(pl.UTF-8): Plik nagłówkowy biblioteki libxcrypt
+License: LGPL v2.1+
Group: Development/Libraries
-Requires: %{name} = %{epoch}:%{version}-%{release}
+Requires: %{name} = %{version}-%{release}
%description devel
-This package contains the header files to develop software using
+This package contains the header file to develop software using
libxcrypt.
+%description devel -l pl.UTF-8
+Ten pakiet zawiera plik nagłówkowy pozwalający na tworzenie programów
+korzystających z libxcrypt.
+
%package static
Summary: Static libxcrypt library
+Summary(pl.UTF-8): Statyczna biblioteka libxcrypt
+License: LGPL v2.1+
Group: Development/Libraries
-Requires: %{name}-devel = %{epoch}:%{version}-%{release}
+Requires: %{name}-devel = %{version}-%{release}
%description static
-This package contains the static library used for development.
+This package contains the static libxcrypt library used for
+development.
+
+%description static -l pl.UTF-8
+Ten pakiet zawiera statyczną wersję biblioteki libxcrypt.
%prep
%setup -q
+%{!?with_default_crypt:%patch0 -p1}
%build
+%{__libtoolize}
+%{__aclocal}
+%{__autoconf}
+%{__autoheader}
+%{__automake}
%configure \
- --libdir=/%{_lib}
+ %{!?with_default_crypt:--includedir=%{_includedir}/xcrypt} \
+ --disable-werror \
+ --disable-xcrypt-compat-files
%{__make}
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{_libdir}
+install -d $RPM_BUILD_ROOT/%{_lib}
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
-mv $RPM_BUILD_ROOT/%{_lib}/lib*.{l,}a $RPM_BUILD_ROOT%{_libdir}
-sed -i -e 's#/%{_lib}#%{_libdir}#g' $RPM_BUILD_ROOT%{_libdir}/*.la
+%{__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
-for lib in $RPM_BUILD_ROOT/%{_lib}/lib*.so.*; do
- lib=$(echo $lib | sed -e "s#$RPM_BUILD_ROOT##g")
- slib=$(basename $lib | sed -e 's#\.so\..*#.so#g')
- ln -sf $lib $RPM_BUILD_ROOT%{_libdir}/$slib
-done
+# obsoleted by pkg-config
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/%{libname}.la
+# PLD doesn't need Owl compatibility
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/libowcrypt.*
+# packaged with glibc-devel
+%{!?with_default_crypt:%{__rm} $RPM_BUILD_ROOT%{_mandir}/man3/crypt{,_r,_ra,_rn}.3*}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc ChangeLog NEWS README*
-%attr(755,root,root) /%{_lib}/libxcrypt.so.*
-%dir /%{_lib}/xcrypt
-%attr(755,root,root) /%{_lib}/xcrypt/libxcrypt*.so*
+%doc AUTHORS ChangeLog LICENSING NEWS README.md THANKS TODO.md
+%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
-%{_includedir}/xcrypt.h
-%{_libdir}/*.la
+%attr(755,root,root) %{_libdir}/%{libname}.so
+%if %{with default_crypt}
+%{_includedir}/crypt.h
+%else
+%{_includedir}/xcrypt
+%endif
+%{_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