#
# Conditional build:
-%bcond_without tests # don't perform make check
-#
-%define snap beta
+%bcond_without tests # don't perform make check
+%bcond_without asm # ix86 asm optimizations
+%bcond_without static_libs # static library
+
+%ifnarch %{ix86}
+# Speed-optimized CRC64 using slicing-by-four algorithm. This uses only i386
+# instructions, but it is optimized for i686 and later (including e.g. Pentium
+# II/III/IV, Athlon XP, and Core 2).
+%undefine with_asm
+%endif
+
+%if "%{pld_release}" == "ac"
+%undefine with_asm
+%endif
+
Summary: LZMA Encoder/Decoder
Summary(pl.UTF-8): Koder/Dekoder LZMA
Name: xz
-Version: 4.999.8
-Release: 0.%{snap}.1
-Epoch: 1
+Version: 5.4.6
+Release: 2
+Epoch: 2
License: LGPL v2.1+, helper scripts on GPL v2+
Group: Applications/Archiving
-Source0: http://tukaani.org/xz/%{name}-%{version}%{snap}.tar.gz
-# Source0-md5: f00967331a487e88d51207fe17c56f52
-URL: http://tukaani.org/xz/
-BuildRequires: rpmbuild(macros) >= 1.402
-BuildRequires: sed >= 4.0
-Suggests: mktemp
-Conflicts: rpm < 4.4.9
+Source0: https://github.com/tukaani-project/xz/releases/download/v%{version}/%{name}-%{version}.tar.bz2
+# Source0-md5: 098549e685e27620f2fe2883b02c35f2
+Patch0: %{name}-parallel.patch
+Patch1: %{name}-memlimit.patch
+URL: https://tukaani.org/xz/
+%{?with_asm:BuildRequires: gcc >= 5:3.4}
+BuildRequires: rpm >= 4.4.9-56
+BuildRequires: rpmbuild(macros) >= 1.527
Requires: %{name}-libs = %{epoch}:%{version}-%{release}
+Suggests: mktemp
Provides: lzma = %{epoch}:%{version}-%{release}
Obsoletes: lzma < 1:4.999.6
+Conflicts: rpm < 4.4.9
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
Summary: Header file for LZMA library
Summary(pl.UTF-8): Plik nagłówkowy biblioteki LZMA
Group: Development/Libraries
-Requires: %{name}-libs = %{epoch}:%{version}-%{release}
+Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
Provides: lzma-devel = %{epoch}:%{version}-%{release}
Obsoletes: lzma-devel < 1:4.999.6
Biblioteka statyczna LZMA.
%prep
-%setup -q -n %{name}-%{version}%{snap}
-sed -i 's|/usr/bin/mktemp|/bin/mktemp|' src/scripts/lzdiff
+%setup -q
+%patch0 -p1
+%patch1 -p1
%build
-%configure
-
+%configure \
+ %{!?with_asm:--disable-assembler} \
+ %{__enable_disable static_libs static}
%{__make}
%{?with_tests:%{__make} check}
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT/{etc/env.d,%{_lib}}
+install -d $RPM_BUILD_ROOT{/etc/env.d,/%{_lib}}
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
+%{__rm} -r $RPM_BUILD_ROOT%{_docdir}/%{name}
+
+install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+cp -a doc/examples* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+
mv -f $RPM_BUILD_ROOT%{_libdir}/liblzma.so.* $RPM_BUILD_ROOT/%{_lib}
-ln -sf /%{_lib}/liblzma.so.0.0.0 $RPM_BUILD_ROOT%{_libdir}/liblzma.so
+ln -sf /%{_lib}/$(basename $RPM_BUILD_ROOT/%{_lib}/liblzma.so.*.*.*) $RPM_BUILD_ROOT%{_libdir}/liblzma.so
echo '#XZ_OPT="--threads=2"' > $RPM_BUILD_ROOT/etc/env.d/XZ_OPT
-:> %{name}.lang
-#%%find_lang %{name}
+%find_lang %{name}
%clean
rm -rf $RPM_BUILD_ROOT
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
-%files
+%files -f %{name}.lang
%defattr(644,root,root,755)
%config(noreplace,missingok) %verify(not md5 mtime size) /etc/env.d/XZ_OPT
-%attr(755,root,root) %{_bindir}/*lz*
-%attr(755,root,root) %{_bindir}/*xz*
+%attr(755,root,root) %{_bindir}/lz*
+%attr(755,root,root) %{_bindir}/unlzma
+%attr(755,root,root) %{_bindir}/unxz
+%attr(755,root,root) %{_bindir}/xz*
%{_mandir}/man1/lz*.1*
-
-%files libs -f %{name}.lang
+%{_mandir}/man1/unlzma.1*
+%{_mandir}/man1/unxz.1*
+%{_mandir}/man1/xz*.1*
+%lang(de) %{_mandir}/de/man1/lz*.1*
+%lang(de) %{_mandir}/de/man1/unlzma.1*
+%lang(de) %{_mandir}/de/man1/unxz.1*
+%lang(de) %{_mandir}/de/man1/xz*.1*
+%lang(fr) %{_mandir}/fr/man1/lz*.1*
+%lang(fr) %{_mandir}/fr/man1/unlzma.1*
+%lang(fr) %{_mandir}/fr/man1/unxz.1*
+%lang(fr) %{_mandir}/fr/man1/xz*.1*
+%lang(ko) %{_mandir}/ko/man1/lz*.1*
+%lang(ko) %{_mandir}/ko/man1/unlzma.1*
+%lang(ko) %{_mandir}/ko/man1/unxz.1*
+%lang(ko) %{_mandir}/ko/man1/xz*.1*
+%lang(pt_BR) %{_mandir}/pt_BR/man1/lz*.1*
+%lang(pt_BR) %{_mandir}/pt_BR/man1/unlzma.1*
+%lang(pt_BR) %{_mandir}/pt_BR/man1/unxz.1*
+%lang(pt_BR) %{_mandir}/pt_BR/man1/xz*.1*
+%lang(ro) %{_mandir}/ro/man1/lz*.1*
+%lang(ro) %{_mandir}/ro/man1/unlzma.1*
+%lang(ro) %{_mandir}/ro/man1/unxz.1*
+%lang(ro) %{_mandir}/ro/man1/xz*.1*
+%lang(uk) %{_mandir}/uk/man1/lz*.1*
+%lang(uk) %{_mandir}/uk/man1/unlzma.1*
+%lang(uk) %{_mandir}/uk/man1/unxz.1*
+%lang(uk) %{_mandir}/uk/man1/xz*.1*
+
+%files libs
%defattr(644,root,root,755)
%doc AUTHORS COPYING README THANKS
-%doc doc/{bugs,file-format}.txt
+%doc doc/*.txt
%attr(755,root,root) /%{_lib}/liblzma.so.*.*.*
-%attr(755,root,root) %ghost /%{_lib}/liblzma.so.0
+%attr(755,root,root) %ghost /%{_lib}/liblzma.so.5
%files devel
%defattr(644,root,root,755)
%{_includedir}/lzma.h
%{_includedir}/lzma
%{_pkgconfigdir}/liblzma.pc
+%{_examplesdir}/%{name}-%{version}
+%if %{with static_libs}
%files static
%defattr(644,root,root,755)
%{_libdir}/liblzma.a
+%endif