SHA256
1
0
forked from pool/lzma-sdk
lzma-sdk/lzma-sdk.spec

122 lines
3.9 KiB
RPMSpec
Raw Normal View History

#
# spec file for package lzma-sdk
#
# Copyright (c) 2017 SUSE LINUX 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/
#
%define _sver 1604
%define _maver 16
%define _miver 04
Name: lzma-sdk
Version: 16.04
Release: 0
Summary: An implementation of LZMA compression
# Actually the site says "Public Domain". See license file.
License: LGPL-2.1
Group: Productivity/Archiving/Compression
Url: http://www.7-zip.org/sdk.html
Source0: http://www.7-zip.org/a/lzma%{_sver}.7z
Source1: lzma-sdk-LICENSE.fedora
Patch0: lzma-sdk-16.04-sharedlib.patch
BuildRequires: dos2unix
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: p7zip
BuildRequires: pkg-config
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
LZMA SDK provides documentation, samples, header files, libraries,
and tools for developing applications with LZMA support.
LZMA uses a dictionary compression algorithm (a variant of LZ77, with
huge dictionary sizes and special support for repeatedly used match
distances), whose output is then encoded with a range encoder, using
a model to make a probability prediction of each bit.
LZMA yields around 20%% better compression when operating at approximately
zlib's speed, and around 40%% when trading more time.
%package devel
Summary: Development libraries and headers for %{name}
Group: Development/Languages/C and C++
Requires: liblzmasdk%{_maver} = %{version}
%description devel
This package contains development libraries and headers for %{name}.
%package -n liblzmasdk%{_maver}
Summary: 7-Zip LZMA library
Group: Productivity/Archiving/Compression
%description -n liblzmasdk%{_maver}
Library for encoding/decoding LZMA files from the 7-Zip project.
%prep
%setup -q -c -n lzma%{_sver}
%patch0 -p1
sed -e 's/__LIBMAJ__/%{_maver}/' \
-e 's/__LIBMIN__/%{_miver}/' \
-i CPP/7zip/Bundles/LzmaCon/makefile.gcc
dos2unix DOC/*.txt
install -p -m 0644 %{SOURCE1} .
%build
cd CPP/7zip/Bundles/LzmaCon
make %{?_smp_mflags} -f makefile.gcc clean all
%install
mkdir -p %{buildroot}%{_libdir}
install -m0755 CPP/7zip/Bundles/LzmaCon/liblzmasdk.so.%{_maver}.%{_miver} %{buildroot}%{_libdir}
pushd %{buildroot}%{_libdir}
ln -s liblzmasdk.so.%{version} liblzmasdk.so.%{_maver}
ln -s liblzmasdk.so.%{version} liblzmasdk.so
popd
mkdir -p %{buildroot}/%{_includedir}/lzma%{_sver}/
find . -iname '*.h' | xargs -I {} install -m0644 -D {} %{buildroot}/%{_includedir}/lzma-sdk/{}
# creates support file for pkg-config
mkdir %{buildroot}/%{_libdir}/pkgconfig
tee %{buildroot}/%{_libdir}/pkgconfig/lzma-sdk.pc <<"EOF"
prefix=%{_prefix}
exec_prefix=%{_prefix}
libdir=%{_libdir}
includedir=%{_includedir}
Name: lzma-sdk
Description: 7-Zip implementation of LZMA compression
Version: %{version}
Libs: -L${libdir} -llzmasdk
Cflags: -I${includedir}/lzma-sdk
EOF
%fdupes -s %{buildroot}/%{_includedir}/lzma-sdk
%post -n liblzmasdk%{_maver} -p /sbin/ldconfig
%postun -n liblzmasdk%{_maver} -p /sbin/ldconfig
%files -n liblzmasdk%{_maver}
%defattr(-,root,root)
%doc DOC/lzma.txt DOC/lzma-history.txt lzma-sdk-LICENSE.fedora
%{_libdir}/liblzmasdk.so.%{_maver}.%{_miver}
%{_libdir}/liblzmasdk.so.%{_maver}
%files devel
%defattr(-,root,root)
%doc DOC/7z*.txt DOC/Methods.txt lzma-sdk-LICENSE.fedora
%{_includedir}/lzma-sdk/
%{_libdir}/liblzmasdk.so
%{_libdir}/pkgconfig/lzma-sdk.pc
%changelog