zstd/zstd.spec

128 lines
4.0 KiB
RPMSpec

#
# spec file for package zstd
#
# Copyright (c) 2019 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 major 1
%define libname lib%{name}%{major}
Name: zstd
Version: %{major}.3.8
Release: 0
Summary: Zstandard compression tools
License: BSD-3-Clause AND GPL-2.0-only
Group: Productivity/Archiving/Compression
URL: https://github.com/facebook/zstd
Source0: https://github.com/facebook/zstd/releases/download/v%{version}/%{name}-%{version}.tar.gz
Patch1: pzstd.1.patch
Patch2: pzstd-global-gtest.patch
BuildRequires: gcc
# C++ is needed for pzstd only
BuildRequires: gcc-c++
BuildRequires: googletest-devel
BuildRequires: pkgconfig
%description
Zstd, short for Zstandard, is a lossless compression algorithm,
targeting real-time compression scenarios at zlib-level compression ratio.
Zstd can also offer stronger compression ratios at the cost of
compression speed. Speed vs. compression trade-off is configurable by
small increments. Decompression speed is preserved and remains
roughly the same at all settings, a property shared by most LZ
compression algorithms, such as zlib or lzma.
%package -n %{libname}
Summary: Zstd compression library
Group: System/Libraries
%description -n %{libname}
Zstd, short for Zstandard, is a lossless compression algorithm,
targeting real-time compression scenarios at zlib-level compression ratio.
This subpackage contains the implementation as a shared library.
%package -n lib%{name}-devel
Summary: Development files for the Zstd compression library
Group: Development/Libraries/C and C++
Requires: %{libname} = %{version}
Requires: glibc-devel
%description -n lib%{name}-devel
Zstd, short for Zstandard, is a lossless compression algorithm,
targeting real-time compression scenarios at zlib-level compression ratio.
Needed for compiling programs that link with the library.
%package -n lib%{name}-devel-static
Summary: Development files for the Zstd compression library
Group: Development/Libraries/C and C++
BuildRequires: glibc-devel-static
Requires: lib%{name}-devel = %{version}
%description -n lib%{name}-devel-static
Zstd, short for Zstandard, is a lossless compression algorithm,
targeting real-time compression scenarios at zlib-level compression ratio.
Needed for compiling programs that link with the library.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags} -std=c++11"
for dir in lib programs contrib/pzstd; do
make %{?_smp_mflags} -C "$dir"
done
%check
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags} -std=c++11"
make %{?_smp_mflags} -C tests test-zstd
#make %{?_smp_mflags} -C contrib/pzstd test-pzstd
%install
%make_install PREFIX=%{_prefix} LIBDIR=%{_libdir}
install -D -m755 contrib/pzstd/pzstd %{buildroot}%{_bindir}/pzstd
install -D -m644 programs/zstd.1 %{buildroot}%{_mandir}/man1/pzstd.1
%files
%license COPYING LICENSE
%doc README.md CHANGELOG
%{_bindir}/*
%{_mandir}/man1/*.1%{?ext_man}
%files -n %{libname}
%license COPYING LICENSE
%{_libdir}/libzstd.so.*
%files -n lib%{name}-devel
%license COPYING LICENSE
%{_includedir}/*.h
%{_libdir}/pkgconfig/libzstd.pc
%{_libdir}/libzstd.so
%files -n lib%{name}-devel-static
%license COPYING LICENSE
%{_libdir}/libzstd.a
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%changelog