%global commit b43c183fdad31be0500a5f2ae022a54a66cb1a3d
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: csnappy
Version: 0
Release: 0.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:
BuildRequires: valgrind
%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
%check
make test
%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
* Mon Oct 13 2014 Petr Pisar <ppisar@redhat.com> - 0-0.20141010gitb43c183
- b43c183fdad31be0500a5f2ae022a54a66cb1a3d snapshot