[packages/crc32c] - new - added system-libs patch to use system glog, gtest and benchmark libraries

qboosh qboosh at pld-linux.org
Wed Jun 29 19:18:19 CEST 2022


commit ede8c4a21145a71db9dad436100275d3318fc9ea
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Wed Jun 29 19:19:32 2022 +0200

    - new
    - added system-libs patch to use system glog, gtest and benchmark libraries

 crc32c-system-libs.patch | 57 ++++++++++++++++++++++++++++
 crc32c.spec              | 99 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 156 insertions(+)
---
diff --git a/crc32c.spec b/crc32c.spec
new file mode 100644
index 0000000..8c751a3
--- /dev/null
+++ b/crc32c.spec
@@ -0,0 +1,99 @@
+#
+# Conditional build:
+%bcond_without	tests	# unit testing
+#
+Summary:	CRC32C library
+Summary(pl.UTF-8):	Biblioteka cyklicznego kodu nadmiarowego CRC32C
+Name:		crc32c
+Version:	1.1.2
+Release:	1
+License:	BSD
+Group:		Libraries
+#Source0Download: https://github.com/google/crc32c/tags
+Source0:	https://github.com/google/crc32c/archive/%{version}/%{name}-%{version}.tar.gz
+# Source0-md5:	cc0338e6a60c38cab04a70a2c36cd9f2
+Patch0:		%{name}-system-libs.patch
+URL:		https://github.com/google/crc32c
+BuildRequires:	cmake >= 3.1
+BuildRequires:	libstdc++-devel >= 6:4.7
+%if %{with tests}
+# with cmake support
+BuildRequires:	glog-devel >= 0.6
+BuildRequires:	google-benchmark-devel
+BuildRequires:	gtest-devel
+%endif
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+This project (originating in Google LevelDB key-value store) collects
+a few CRC32C implementations under an umbrella that dispatches to a
+suitable implementation based on the host computer's hardware
+capabilities.
+
+CRC32C is specified as the CRC that uses the iSCSI polynomial in RFC
+3720. The polynomial was introduced by G. Castagnoli, S. Braeuer and
+M. Herrmann. CRC32C is used in software such as Btrfs, ext4, Ceph and
+leveldb.
+
+%description -l pl.UTF-8
+Ten projekt (wywodzący się z bazy klucz-wartość Google LevelDB) zbiera
+kilka implementacji CRC32C w obudowaniu, które wybiera implementację
+pasującą do możliwości sprzętowych komputera.
+
+Algorytm CRC32C to cykliczny kod nadmiarowy, wykorzystujący wielomian
+iSCSI określony w RFC 3720. Wielomian został wprowadzony przez G.
+Castagnoliego, S. Braeuera i M. Herrmanna. Algorytm jest
+wykorzystywany w takim oprogramowaniu, jak btrfs, ext4, ceph czy
+leveldb.
+
+%package devel
+Summary:	Header files for crc32c library
+Summary(pl.UTF-8):	Pliki nagłówkowe biblioteki crc32c
+Group:		Development/Libraries
+Requires:	%{name} = %{version}-%{release}
+
+%description devel
+Header files for crc32c library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki crc32c.
+
+%prep
+%setup -q
+%patch0 -p1
+
+%build
+install -d build
+cd build
+%cmake .. \
+	%{!?with_tests:-DCRC32C_BUILD_BENCHMARKS=OFF -DCRC32C_BUILD_TESTS=OFF}
+
+%{__make}
+
+%if %{with tests}
+%{__make} test
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} -C build install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post	-p /sbin/ldconfig
+%postun	-p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc AUTHORS LICENSE README.md
+%attr(755,root,root) %{_libdir}/libcrc32c.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libcrc32c.so.1
+
+%files devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libcrc32c.so
+%{_includedir}/crc32c
+%{_libdir}/cmake/Crc32c
diff --git a/crc32c-system-libs.patch b/crc32c-system-libs.patch
new file mode 100644
index 0000000..944122f
--- /dev/null
+++ b/crc32c-system-libs.patch
@@ -0,0 +1,57 @@
+--- crc32c-1.1.2/CMakeLists.txt.orig	2021-10-05 21:47:30.000000000 +0200
++++ crc32c-1.1.2/CMakeLists.txt	2022-06-29 16:46:21.011209574 +0200
+@@ -187,26 +187,9 @@ if(CRC32C_USE_GLOG)
+   # CPU cycles on the CI.
+   set(BUILD_TESTING_SAVED "${BUILD_TESTING}")
+   set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
+-  add_subdirectory("third_party/glog" EXCLUDE_FROM_ALL)
++  find_package(glog REQUIRED)
+   set(BUILD_TESTING "${BUILD_TESTING_SAVED}" CACHE BOOL "" FORCE)
+ 
+-  # glog triggers deprecation warnings on OSX.
+-  # https://github.com/google/glog/issues/185
+-  if(CRC32C_HAVE_NO_DEPRECATED)
+-    set_property(TARGET glog APPEND PROPERTY COMPILE_OPTIONS -Wno-deprecated)
+-  endif(CRC32C_HAVE_NO_DEPRECATED)
+-
+-  # glog triggers sign comparison warnings on gcc.
+-  if(CRC32C_HAVE_NO_SIGN_COMPARE)
+-    set_property(TARGET glog APPEND PROPERTY COMPILE_OPTIONS -Wno-sign-compare)
+-  endif(CRC32C_HAVE_NO_SIGN_COMPARE)
+-
+-  # glog triggers unused parameter warnings on clang.
+-  if(CRC32C_HAVE_NO_UNUSED_PARAMETER)
+-    set_property(TARGET glog
+-                 APPEND PROPERTY COMPILE_OPTIONS -Wno-unused-parameter)
+-  endif(CRC32C_HAVE_NO_UNUSED_PARAMETER)
+-
+   set(CRC32C_TESTS_BUILT_WITH_GLOG 1)
+ endif(CRC32C_USE_GLOG)
+ 
+@@ -315,16 +298,8 @@ if(CRC32C_BUILD_TESTS)
+   set(install_gmock OFF)
+ 
+   # This project is tested using GoogleTest.
+-  add_subdirectory("third_party/googletest")
++  find_package(GTest REQUIRED)
+ 
+-  # GoogleTest triggers a missing field initializers warning.
+-  if(CRC32C_HAVE_NO_MISSING_FIELD_INITIALIZERS)
+-    set_property(TARGET gtest
+-        APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
+-    set_property(TARGET gmock
+-        APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
+-  endif(CRC32C_HAVE_NO_MISSING_FIELD_INITIALIZERS)
+-
+   add_executable(crc32c_tests "")
+   target_sources(crc32c_tests
+     PRIVATE
+@@ -385,7 +368,7 @@ if(CRC32C_BUILD_BENCHMARKS)
+   # This project uses Google benchmark for benchmarking.
+   set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
+   set(BENCHMARK_ENABLE_EXCEPTIONS OFF CACHE BOOL "" FORCE)
+-  add_subdirectory("third_party/benchmark")
++  find_package(benchmark REQUIRED)
+   target_link_libraries(crc32c_bench benchmark)
+ 
+   if(CRC32C_USE_GLOG)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/crc32c.git/commitdiff/ede8c4a21145a71db9dad436100275d3318fc9ea



More information about the pld-cvs-commit mailing list