File xz.spec of Package xz

#
# spec file for package xz
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


# avoid bootstrapping problem
%define _binary_payload w9.bzdio
%if 0%{?centos_version} || 0%{?rhel_version}
%if 0%{?centos_version} <= 600 || 0%{?rhel_version <= 600}
%bcond_without static_libs
%endif
%else
%bcond_with    static_libs
%endif
%if 0%{?suse_version} < 1130
%define do_profiling 0
%endif
%ifarch aarch64 %{arm} %{sparc}
%define do_profiling 0
%endif
Name:           xz
Version:        5.0.7
Release:        0
Summary:        A Program for Compressing Files
License:        LGPL-2.1+ and GPL-2.0+
Group:          Productivity/Archiving/Compression
Url:            http://tukaani.org/xz/
Source0:        http://tukaani.org/xz/%{name}-%{version}.tar.gz
Source1:        http://tukaani.org/xz/%{name}-%{version}.tar.gz.sig
Source2:        baselibs.conf
# from http://tukaani.org/misc/lasse_collin_pubkey.txt#/xz.keyring
Source3:        xz.keyring
BuildRequires:  pkgconfig
Provides:       lzma = %{version}
Obsoletes:      lzma < %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?lang_package:1} > 0
Recommends:     %{name}-lang
%endif

%description
The xz command is a very powerful program for compressing files.

* Average compression ratio of LZMA is about 30% better than that of
   gzip, and 15% better than that of bzip2.

* Decompression speed is only little slower than that of gzip, being
   two to five times faster than bzip2.

* In fast mode, compresses faster than bzip2 with a comparable
   compression ratio.

* Achieving the best compression ratios takes four to even twelve
   times longer than with bzip2. However. this doesn't affect
   decompressing speed.

* Very similar command line interface to what gzip and bzip2 have.

%{?lang_package}

%package -n liblzma5
Summary:        LZMA library
Group:          System/Libraries

%description -n liblzma5
Library for encoding/decoding LZMA files.

%package devel
Summary:        Development package for the LZMA library
Group:          Development/Libraries/C and C++
Requires:       liblzma5 = %{version}
Provides:       lzma-devel = %{version}
Obsoletes:      lzma-devel < %{version}
Provides:       lzma-alpha-devel = %{version}
Obsoletes:      lzma-alpha-devel < %{version}

%description devel
This package contains the header files and libraries needed for
compiling programs using the LZMA library.

%if %{with static_libs}

%package static-devel
Summary:        Static version of LZMA library
Group:          Development/Libraries/C and C++
Requires:       lzma-devel = %{version}

%description static-devel
Static library for the LZMA library
%endif

%prep
%setup -q

%build
%global optflags    %{optflags} -D_REENTRANT -pipe
%if %{do_profiling}
profiledir=$(mktemp -d)
trap "rm -rf $profiledir" EXIT
export CFLAGS="%{optflags} %{cflags_profile_generate}=$profiledir"
%endif
%configure \
%if ! %{with static_libs}
	--disable-static \
%endif
	--with-pic \
	--docdir=%{_docdir}/%{name}
make %{?_smp_mflags}
%if %{do_profiling}
time make check
make clean %{?_smp_mflags}
export CFLAGS="%{optflags} %{cflags_profile_feedback}=$profiledir"
%configure \
%if %{without static_libs}
	--disable-static \
%endif
	--with-pic \
	--docdir=%{_docdir}/%{name}
make %{?_smp_mflags}
%endif

%check
time make check

%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}
rm -v %{buildroot}%{_libdir}/liblzma.la
%find_lang %{name}

%post -n liblzma5 -p /sbin/ldconfig

%postun -n liblzma5 -p /sbin/ldconfig

%if 0%{?lang_package:1} > 0

%files lang -f %{name}.lang
%defattr(-, root, root)

%files
%defattr(-,root,root)
%else

%files -f %{name}.lang
%defattr(-, root, root)
%endif
%defattr(-, root, root)
%{_docdir}/%{name}
%{_bindir}/*
%{_mandir}/man?/*

%files -n liblzma5
%defattr(-, root, root)
%{_libdir}/lib*.so.5*

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

%if %{with static_libs}

%files static-devel
%defattr(-, root, root)
%{_libdir}/*.a
%endif

%changelog
openSUSE Build Service is sponsored by