Blob Blame History Raw
%global commit b43c183fdad31be0500a5f2ae022a54a66cb1a3d
%global shortcommit %(c=%{commit}; echo ${c:0:7})

# valgrind is available only on selected arches
%ifarch %{ix86} x86_64 ppc ppc64 ppc64le s390x %{arm} aarch64
%global with_valgrind 1
%endif

Name:       csnappy 
Version:    0
Release:    1.20141010git%{shortcommit}%{?dist}
Summary:    Snappy compression library ported to C 
Group:      System Environment/Libraries
License:    BSD
URL:        https://github.com/zeevt/%{name}
Source0:    https://github.com/zeevt/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz
# Adjust Makefile to install into proper paths,
# <https://github.com/zeevt/csnappy/issues/19>, accepted
Patch0:     %{name}-b43c183f-Install-file-into-DESTDIR-and-LIBDIR.patch
# Include all needed headers
# <https://github.com/zeevt/csnappy/issues/20>, accepted
Patch1:     %{name}-b43c183f-Include-stdint.h-for-uint32_t-types.patch
# Tests:
%if 0%{?with_valgrind}
BuildRequires:  valgrind
%endif

%description
This is an ANSI C port of Google's Snappy library. Snappy is a compression
library designed for speed rather than compression ratios.

%package devel
Group:      Development/Libraries
Summary:    Development files for the %{name} library
Requires:   %{name}%{?_isa} = %{version}-%{release}
Requires:   glibc-headers%{?_isa}

%description devel
Header files for developing applications that use the %{name} library.


%prep
%setup -qn %{name}-%{commit}
%patch0 -p1
%patch1 -p1
# Extract BSD license and copyright notices, bug #1152057
! test -e LICENSE
for F in $(< Makefile sed -e '/libcsnappy.so:/ s/.*:// p' -e 'd'); do
    < $F sed -e '/Copyright/,/\*\//p' -e 'd'
done > LICENSE
test -s LICENSE

%build
make %{?_smp_mflags} 'OPT_FLAGS=%{optflags}' 'LDFLAGS=%{?__global_ldflags}' \
    lib%{name}.so cl_tester

%if 0%{?with_valgrind}
%check
make test
%endif

%install
make install 'DESTDIR=%{buildroot}' 'LIBDIR=%{_libdir}'

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%doc LICENSE README TODO
%{_libdir}/lib%{name}.so

%files devel
%{_includedir}/%{name}.h


%changelog
* Fri Jan 16 2015 Dan HorĂ¡k <dan[at]danny.cz> - 0-1.20141010gitb43c183
- valgrind is available only on selected arches

* Mon Oct 13 2014 Petr Pisar <ppisar@redhat.com> - 0-0.20141010gitb43c183
- b43c183fdad31be0500a5f2ae022a54a66cb1a3d snapshot