Summary:        LZMA compression utilities
Summary(ja):    LZMA 圧縮ユーティリティ
Name:           xz
Version:        5.4.1
Release:        1%{?_dist_release}
Group:          accessories
Vendor:         Project Vine
Distribution:   Vine Linux

License:        LGPLv2+
URL:            https://tukaani.org/xz/
Source0:        https://tukaani.org/xz/%{name}-%{version}.tar.xz

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root
Requires:       %{name}-libs = %{version}-%{release}

%description
XZ Utils are an attempt to make LZMA compression easy to use on free (as in
freedom) operating systems. This is achieved by providing tools and libraries
which are similar to use than the equivalents of the most popular existing
compression algorithms.

LZMA is a general purpose compression algorithm designed by Igor Pavlov as
part of 7-Zip. It provides high compression ratio while keeping the
decompression speed fast.


%package 	libs
Summary:	Libraries for decoding LZMA compression
Summary(ja):	LZMA圧縮をデコードするためのライブラリ
Group:		system
License:	LGPLv2+

%description 	libs
Libraries for decoding files compressed with LZMA or XZ utils.


%package 	devel
Summary:	Devel libraries & headers for liblzma
Summary(ja):	liblzma の開発ライブラリとヘッダファイル
Group:		programming
License:	LGPLv2+
Requires:	%{name}-libs = %{version}-%{release}
Requires:	pkgconfig

%description  devel
Devel libraries and headers for liblzma.


%package 	lzma-compat
Summary:	Older LZMA format compatibility binaries
Summary(ja):	旧式のLZMAフォーマット互換バイナリ
Group:		accessories
# lz{grep,diff,more} are GPLv2+. Other binaries are LGPLv2+
License:	GPLv2+ and LGPLv2+
Requires:	%{name} = %{version}-%{release}
Obsoletes:	lzma < 5
Provides:	lzma = 5

%description  lzma-compat
The lzma-compat package contains compatibility links for older
commands that deal with the older LZMA format.


%debug_package


%prep
%setup -q
%autopatch -p1


%build
CFLAGS="%{optflags} -D_FILE_OFFSET_BITS=64"
%ifarch %ix86
  # rhbz#1630650, annocheck reports the following message because liblzma uses
  # crc*_x86.S asm code on i686:
  CFLAGS="$CFLAGS -Wa,--generate-missing-build-notes=yes"
%endif
CXXFLAGS="%{optflags} -D_FILE_OFFSET_BITS=64"
%configure --enable-silent-rules --disable-static
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

make %{?_smp_mflags}


%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot} INSTALL="%{__install} -p"
rm -f %{buildroot}/%{_libdir}/*.a
rm -f %{buildroot}/%{_libdir}/*.la
rm -rf %{buildroot}/%{_docdir}/%{name}

%find_lang %{name}


%check
LD_LIBRARY_PATH=$PWD/src/liblzma/.libs make check


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%license COPYING.*
%doc AUTHORS README THANKS ChangeLog 
%{_bindir}/*xz*
%{_mandir}/man1/*xz*
%{_mandir}/de/man1/*xz*
%{_mandir}/fr/man1/*xz*
%{_mandir}/ko/man1/*xz*
%{_mandir}/ro/man1/*xz*
%{_mandir}/uk/man1/*xz*

%files libs -f %{name}.lang
%defattr(-,root,root,-)
%license COPYING.*
%{_libdir}/lib*.so.*

%files devel
%defattr(-,root,root,-)
%dir %{_includedir}/lzma
%{_includedir}/lzma/*.h
%{_includedir}/lzma.h
%{_libdir}/*.so
%{_libdir}/pkgconfig/liblzma.pc

%files lzma-compat
%defattr(-,root,root,-)
%{_bindir}/*lz*
%{_mandir}/man1/*lz*
%{_mandir}/de/man1/*lz*
%{_mandir}/fr/man1/*lz*
%{_mandir}/ko/man1/*lz*
%{_mandir}/ro/man1/*lz*
%{_mandir}/uk/man1/*lz*


%changelog
* Sun Feb 12 2023 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.4.1-1
- new upstream release.
- dropped Patch1.

* Wed Mar 10 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.2.5-2
- imported Patch1 from upstream.
- dropped scriptlets.

* Thu Jul 16 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.2.5-1
- new upstream release.

* Fri Sep 13 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.2.4-1
- new upstream release.

* Thu Nov 10 2016 Toshiaki Ara <ara_t@384.jp> 5.2.2-1
- new upstream release

* Fri Oct  3 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 5.0.5-3
- moved lzma-compat to Applications/Archiving Group

* Sat Jul 12 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 5.0.5-2
- rebuild with VineSeed environment

* Sat Oct 26 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 5.0.5-1
- new upstream release 

* Fri Oct 19 2012 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 5.0.4-1
- new upstream release 

* Thu Apr 14 2011 IWAI, Masaharu <iwai@alib.jp> 5.0.2-1
- new upstream release
- fix Group: <BTS:VineLinux:1119>
- add Vendor and Distribution tags

* Fri Jan 07 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 5.0.0-1
- new upstream release

* Sun Sep 26 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.999.9-2
- rebuild with rpm-4.8.1 for pkg-config file

* Mon Feb 22 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 	4.999.9-1
- initial build for Vine Linux

* Thu Feb 18 2010 Jindrich Novy <jnovy@redhat.com> 4.999.9-0.2.20091007.beta
- move xz man pages to main package, leave lzma ones where they belong (#566484)

* Wed Oct 07 2009 Jindrich Novy <jnovy@redhat.com> 4.999.9-0.1.20091007.beta
- sync with upstream again

* Fri Oct 02 2009 Jindrich Novy <jnovy@redhat.com> 4.999.9-0.1.20091002.beta
- sync with upstream to generate the same archives on machines with different
  endianess

* Fri Aug 28 2009 Jindrich Novy <jnovy@redhat.com> 4.999.9-0.1.beta
- update to 4.999.9beta

* Mon Aug 17 2009 Jindrich Novy <jnovy@redhat.com> 4.999.8-0.10.beta.20090817git
- sync with upstream because of #517806

* Tue Aug 04 2009 Jindrich Novy <jnovy@redhat.com> 4.999.8-0.9.beta.20090804git
- update to the latest GIT snapshot

* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.999.8-0.8.beta
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Fri Jul 17 2009 Bill Nottingham <notting@redhat.com> 4.999.8-0.7.beta
- tweak summary
- add %%check section (<tibbs@math.uh.edu>)
 
* Thu Jul 09 2009 Bill Nottingham <notting@redhat.com> 4.999.8-0.6.beta
- fix release versioning to match guidelines
- fix up lzma-compat summary/description
- tweak licensing

* Mon Jun 22 2009 Jindrich Novy <jnovy@redhat.com> 4.999.8beta-0.5
- introduce lzma-compat subpackage

* Fri Jun 19 2009 Jindrich Novy <jnovy@redhat.com> 4.999.8beta-0.4
- try to not to conflict with lzma

* Thu Jun 18 2009 Jindrich Novy <jnovy@redhat.com> 4.999.8beta-0.3
- obsolete but don't provide lzma, they are largely incompatible
- put beta to Release

* Wed Jun 17 2009 Jindrich Novy <jnovy@redhat.com> 4.999.8beta-0.2
- obsolete old lzma
- add Requires: pkgconfig

* Tue Jun 16 2009 Jindrich Novy <jnovy@redhat.com> 4.999.8beta-0.1
- package XZ Utils, based on LZMA Utils packaged by Per Patrice Bouchand
