[packages/snappy] - updated to 1.1.7 - added gtest patch (tests need linking with libgtest) - build system switched to
qboosh
qboosh at pld-linux.org
Mon Dec 25 10:58:30 CET 2017
commit 26603168d47f006bee65a3cc1bab9024e8613895
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Mon Dec 25 10:59:57 2017 +0100
- updated to 1.1.7
- added gtest patch (tests need linking with libgtest)
- build system switched to cmake; upstream .pc file has been dropped, so (re)added as additional source
- static library could be useful, build it in separate process
snappy-gtest.patch | 11 +++++++++
snappy.pc.in | 10 ++++++++
snappy.spec | 69 +++++++++++++++++++++++++++++++++++++-----------------
3 files changed, 68 insertions(+), 22 deletions(-)
---
diff --git a/snappy.spec b/snappy.spec
index 6849c93..c5dde03 100644
--- a/snappy.spec
+++ b/snappy.spec
@@ -1,22 +1,32 @@
+#
+# Conditional build:
+%bcond_without tests # unit tests
+%bcond_without static_libs # static library
+
Summary: Snappy - fast compression/decompression library
Summary(pl.UTF-8): Snappy - biblioteka do szybkiej kompresji i dekompresji
Name: snappy
-Version: 1.1.6
+Version: 1.1.7
Release: 1
License: BSD
Group: Libraries
#Source0Download: https://github.com/google/snappy/releases
Source0: https://github.com/google/snappy/archive/%{version}/%{name}-%{version}.tar.gz
-# Source0-md5: 34bc3707dea702f684a5b8a3649a1721
+# Source0-md5: ee9086291c9ae8deb4dac5e0b85bf54a
+Source1: %{name}.pc.in
Patch0: %{name}-gflags.patch
+Patch1: %{name}-gtest.patch
URL: http://google.github.io/snappy/
-BuildRequires: autoconf >= 2.50
-BuildRequires: automake
-# for tests
-BuildRequires: gflags-devel
+BuildRequires: cmake >= 3.1
BuildRequires: libstdc++-devel
BuildRequires: libtool >= 2:2.0
BuildRequires: pkgconfig
+%if %{with tests}
+BuildRequires: gflags-devel
+BuildRequires: gtest-devel
+BuildRequires: lzo-devel >= 2
+BuildRequires: zlib-devel
+%endif
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
@@ -92,31 +102,43 @@ Statyczna biblioteka Snappy.
%prep
%setup -q
%patch0 -p1
-
-# missing in non-dist tarballs
-test -f INSTALL || touch INSTALL
-test -f README || touch README
+%patch1 -p1
%build
-%{__libtoolize}
-%{__aclocal} -I m4
-%{__autoconf}
-%{__autoheader}
-%{__automake}
-%configure
+%if %{with static_libs}
+install -d build-static
+cd build-static
+%cmake .. \
+ -DBUILD_SHARED_LIBS=OFF \
+ %{!?with_tests:-DSNAPPY_BUILD_TESTS=OFF}
+cd ..
+%endif
+
+install -d build
+cd build
+%cmake .. \
+ %{!?with_tests:-DSNAPPY_BUILD_TESTS=OFF}
+
%{__make}
+%{?with_tests:ctest}
+
%install
rm -rf $RPM_BUILD_ROOT
-%{__make} install \
+%if %{with static_libs}
+# static first so that packaged cmake config files refer to shared library
+%{__make} -C build-static install \
DESTDIR=$RPM_BUILD_ROOT
+%endif
-# obsoleted by pkg-config
-%{__rm} $RPM_BUILD_ROOT%{_libdir}/libsnappy.la
+%{__make} -C build install \
+ DESTDIR=$RPM_BUILD_ROOT
-# already as %doc
-%{__rm} -r $RPM_BUILD_ROOT%{_docdir}/snappy
+# ugh, they removed autotools support together with .pc file :/
+install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
+sed -e 's, at prefix@,%{_prefix},g;s, at libdir@,%{_libdir},g;s, at version@,%{version},g' \
+ %{SOURCE1} > $RPM_BUILD_ROOT%{_pkgconfigdir}/snappy.pc
%clean
rm -rf $RPM_BUILD_ROOT
@@ -126,7 +148,7 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc AUTHORS COPYING ChangeLog NEWS README
+%doc AUTHORS COPYING NEWS README.md
%attr(755,root,root) %{_libdir}/libsnappy.so.*.*.*
%attr(755,root,root) %ghost %{_libdir}/libsnappy.so.1
@@ -135,7 +157,10 @@ rm -rf $RPM_BUILD_ROOT
%attr(755,root,root) %{_libdir}/libsnappy.so
%{_includedir}/snappy*.h
%{_pkgconfigdir}/snappy.pc
+%{_libdir}/cmake/Snappy
+%if %{with static_libs}
%files static
%defattr(644,root,root,755)
%{_libdir}/libsnappy.a
+%endif
diff --git a/snappy-gtest.patch b/snappy-gtest.patch
new file mode 100644
index 0000000..d990e5b
--- /dev/null
+++ b/snappy-gtest.patch
@@ -0,0 +1,11 @@
+--- snappy-1.1.7/CMakeLists.txt.orig 2017-08-25 01:54:23.000000000 +0200
++++ snappy-1.1.7/CMakeLists.txt 2017-12-24 14:32:18.896409605 +0100
+@@ -118,7 +118,7 @@
+ "${PROJECT_SOURCE_DIR}/snappy-test.cc"
+ )
+ target_compile_definitions(snappy_unittest PRIVATE -DHAVE_CONFIG_H)
+- target_link_libraries(snappy_unittest snappy ${GFLAGS_LIBRARIES})
++ target_link_libraries(snappy_unittest snappy ${GFLAGS_LIBRARIES} ${GTEST_LIBRARIES})
+
+ if(HAVE_LIBZ)
+ target_link_libraries(snappy_unittest z)
diff --git a/snappy.pc.in b/snappy.pc.in
new file mode 100644
index 0000000..5e86848
--- /dev/null
+++ b/snappy.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@prefix@
+libdir=@libdir@
+includedir=@prefix@/include
+
+Name: snappy
+Description: A fast compression/decompression library
+Version: @version@
+Libs: -L${libdir} -lsnappy
+Cflags: -I${includedir}
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/snappy.git/commitdiff/26603168d47f006bee65a3cc1bab9024e8613895
More information about the pld-cvs-commit
mailing list