Spec cleanup, disable tests by default

This commit is contained in:
Andrey Bondrov 2018-06-21 18:06:17 +10:00
parent 2f91eb2bdc
commit 6263ca78e4

View file

@ -1,7 +1,7 @@
%define realname zstd %define oname zstd
%define libmajor 1 %define major 1
%define libname %mklibname %{realname} %{libmajor} %define libname %mklibname %{oname} %{major}
%define libname_devel %mklibname %{realname} -d %define devname %mklibname %{oname} -d
# aarch64 and armv7hl at least currently segfault # aarch64 and armv7hl at least currently segfault
# in ThreadPool test for the pzstd util # in ThreadPool test for the pzstd util
@ -9,21 +9,18 @@
%bcond_without pzstd %bcond_without pzstd
%endif %endif
Name: zstd %bcond_with tests
Version: 1.3.4
Release: 1 Summary: Zstd compression library
Summary: Zstd compression library Name: zstd
Version: 1.3.4
Release: 2
License: BSD and GPLv2+
Group: Archiving/Compression Group: Archiving/Compression
License: BSD and GPLv2 Url: http://www.zstd.net/
URL: http://www.zstd.net/ Source0: https://github.com/facebook/zstd/archive/v%{version}/%{name}-%{version}.tar.gz
Source0: https://github.com/facebook/zstd/archive/v%{version}/%{name}-%{version}.tar.gz Patch1: pzstd.1.patch
BuildRequires: gtest-devel
Patch1: pzstd.1.patch
BuildRequires: gcc gtest-devel
%if %{with pzstd}
BuildRequires: gcc-c++
%endif
%description %description
Zstd, short for Zstandard, is a fast lossless compression algorithm, Zstd, short for Zstandard, is a fast lossless compression algorithm,
@ -46,27 +43,27 @@ targeting real-time compression scenarios at zlib-level compression ratio.
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
%package -n %{libname} %package -n %{libname}
Summary: Zstd shared library Summary: Zstd shared library
Group: System/Libraries Group: System/Libraries
%description -n %{libname} %description -n %{libname}
Zstandard compression shared library. Zstandard compression shared library.
%files -n %{libname} %files -n %{libname}
%{_libdir}/libzstd.so.* %{_libdir}/libzstd.so.%{major}*
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
%package -n %{libname_devel} %package -n %{devname}
Summary: Header files for Zstd library Summary: Header files for Zstd library
Group: Development/C Group: Development/C
Requires: %{libname} = %{EVRD} Requires: %{libname} = %{EVRD}
Provides: %{name}-devel = %{EVRD} Provides: %{name}-devel = %{EVRD}
Provides: lib%{name}-devel = %{EVRD}
%description -n %{libname_devel} %description -n %{devname}
Header files for Zstd library. Header files for Zstd library.
%files -n %{libname_devel} %files -n %{devname}
%{_includedir}/zbuff.h %{_includedir}/zbuff.h
%{_includedir}/zdict.h %{_includedir}/zdict.h
%{_includedir}/zstd.h %{_includedir}/zstd.h
@ -84,29 +81,29 @@ find -name .gitignore -delete
%endif %endif
%build %build
%{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;}
for dir in lib programs; do for dir in lib programs; do
CFLAGS="%{optflags}" %make -C "$dir" CFLAGS="%{optflags}" LDFLAGS="%{ldflags}" %make -C "$dir"
done done
%if %{with pzstd} %if %{with pzstd}
CFLAGS="%{optflags}" CXXFLAGS="%{optflags} -std=c++11" %make -C 'contrib/pzstd' CFLAGS="%{optflags}" LDFLAGS="%{ldflags}" CXXFLAGS="%{optflags} -std=c++11" %make -C 'contrib/pzstd'
%endif
%check
%{?__global_ldflags:LDFLAGS="${LDFLAGS:-%__global_ldflags}" ; export LDFLAGS ;}
CFLAGS="%{optflags}" make -C tests test-zstd
%if %{with pzstd}
CFLAGS="%{optflags}" CXXFLAGS="%{optflags} -std=c++11" make -C contrib/pzstd test
%endif %endif
%install %install
%make_install PREFIX=%{_prefix} LIBDIR=%{_libdir} %make_install PREFIX=%{_prefix} LIBDIR=%{_libdir}
# Remove undocumented wrappers of minimal use # Remove undocumented wrappers of minimal use
rm %{buildroot}/%{_bindir}/%{name}less rm %{buildroot}%{_bindir}/%{name}less
rm %{buildroot}/%{_bindir}/%{name}grep rm %{buildroot}%{_bindir}/%{name}grep
# Don't install the static lib # Don't install the static lib
rm %{buildroot}/%{_libdir}/libzstd.a rm %{buildroot}%{_libdir}/libzstd.a
%if %{with pzstd} %if %{with pzstd}
install -D -m755 contrib/pzstd/pzstd %{buildroot}/usr/bin/pzstd install -D -m755 contrib/pzstd/pzstd %{buildroot}%{_bindir}/pzstd
install -D -m644 programs/%{name}.1 %{buildroot}/%{_mandir}/man1/p%{name}.1 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
%endif %endif