zstd/zstd.spec

112 lines
2.7 KiB
RPMSpec
Raw Permalink Normal View History

2018-06-21 18:06:17 +10:00
%define oname zstd
%define major 1
%define libname %mklibname %{oname} %{major}
%define devname %mklibname %{oname} -d
2018-06-21 10:14:25 +03:00
# aarch64 and armv7hl at least currently segfault
# in ThreadPool test for the pzstd util
%ifarch %{ix86} x86_64
%bcond_without pzstd
%endif
2018-06-21 18:06:17 +10:00
%bcond_with tests
2018-06-21 10:14:25 +03:00
2018-06-21 18:06:17 +10:00
Summary: Zstd compression library
Name: zstd
Version: 1.4.3
Release: 1
2018-06-21 18:06:17 +10:00
License: BSD and GPLv2+
Group: Archiving/Compression
Url: http://www.zstd.net/
Source0: https://github.com/facebook/zstd/archive/v%{version}/%{name}-%{version}.tar.gz
Patch1: pzstd.1.patch
BuildRequires: gtest-devel
2018-06-21 10:14:25 +03:00
%description
Zstd, short for Zstandard, is a fast lossless compression algorithm,
targeting real-time compression scenarios at zlib-level compression ratio.
%files
%doc CHANGELOG README.md
2018-06-21 10:14:25 +03:00
%{_bindir}/%{name}
%{_bindir}/%{name}cat
%{_bindir}/%{name}grep
%{_bindir}/%{name}less
%{_bindir}/%{name}mt
2018-06-21 10:14:25 +03:00
%if %{with pzstd}
%{_bindir}/p%{name}
%{_mandir}/man1/p%{name}.1*
%endif
%{_bindir}/un%{name}
%{_mandir}/man1/%{name}.1*
%{_mandir}/man1/%{name}cat.1*
%{_mandir}/man1/%{name}grep.1*
%{_mandir}/man1/%{name}less.1*
%{_mandir}/man1/un%{name}.1*
2018-06-21 10:14:25 +03:00
#----------------------------------------------------------------------------
%package -n %{libname}
2018-06-21 18:06:17 +10:00
Summary: Zstd shared library
2018-06-21 10:14:25 +03:00
Group: System/Libraries
2018-06-21 18:06:17 +10:00
2018-06-21 10:14:25 +03:00
%description -n %{libname}
Zstandard compression shared library.
%files -n %{libname}
2018-06-21 18:06:17 +10:00
%{_libdir}/libzstd.so.%{major}*
2018-06-21 10:14:25 +03:00
#----------------------------------------------------------------------------
2018-06-21 18:06:17 +10:00
%package -n %{devname}
Summary: Header files for Zstd library
2018-06-21 10:14:25 +03:00
Group: Development/C
2018-06-21 18:06:17 +10:00
Requires: %{libname} = %{EVRD}
Provides: %{name}-devel = %{EVRD}
2018-06-21 10:14:25 +03:00
2018-06-21 18:06:17 +10:00
%description -n %{devname}
2018-06-21 10:14:25 +03:00
Header files for Zstd library.
2018-06-21 18:06:17 +10:00
%files -n %{devname}
2018-06-21 10:14:25 +03:00
%{_includedir}/zbuff.h
%{_includedir}/zdict.h
%{_includedir}/zstd.h
%{_includedir}/zstd_errors.h
%{_libdir}/pkgconfig/libzstd.pc
%{_libdir}/libzstd.so
#----------------------------------------------------------------------------
%prep
%setup -q
find -name .gitignore -delete
%if %{with pzstd}
%patch1 -p1
%endif
%build
for dir in lib programs; do
2018-06-21 18:06:17 +10:00
CFLAGS="%{optflags}" LDFLAGS="%{ldflags}" %make -C "$dir"
2018-06-21 10:14:25 +03:00
done
%if %{with pzstd}
2018-06-21 18:06:17 +10:00
CFLAGS="%{optflags}" LDFLAGS="%{ldflags}" CXXFLAGS="%{optflags} -std=c++11" %make -C 'contrib/pzstd'
2018-06-21 10:14:25 +03:00
%endif
%install
%make_install PREFIX=%{_prefix} LIBDIR=%{_libdir}
2018-06-21 10:14:25 +03:00
# Don't install the static lib
2018-06-21 18:06:17 +10:00
rm %{buildroot}%{_libdir}/libzstd.a
2018-06-21 10:14:25 +03:00
%if %{with pzstd}
2018-06-21 18:06:17 +10:00
install -D -m755 contrib/pzstd/pzstd %{buildroot}%{_bindir}/pzstd
install -D -m644 programs/%{name}.1 %{buildroot}%{_mandir}/man1/p%{name}.1
%endif
%if %{with tests}
%check
CFLAGS="%{optflags}" LDFLAGS="%{ldflags}" make -C tests test-zstd
%if %{with pzstd}
CFLAGS="%{optflags}" LDFLAGS="%{ldflags}" CXXFLAGS="%{optflags} -std=c++11" make -C contrib/pzstd test
%endif
2018-06-21 10:14:25 +03:00
%endif