From b5ac2b1be55e2d81ce8ee300c797457d288f16ee Mon Sep 17 00:00:00 2001 From: Danny Rawlins Date: Tue, 19 Oct 2021 14:53:23 +1100 Subject: [PATCH] snappy: initial import --- snappy/.footprint | 18 +++++++++ snappy/.signature | 8 ++++ snappy/Pkgfile | 54 +++++++++++++++++++++++++ snappy/snappy-do-not-disable-rtti.patch | 14 +++++++ snappy/snappy-inline.patch | 12 ++++++ snappy/snappy-thirdparty.patch | 48 ++++++++++++++++++++++ 6 files changed, 154 insertions(+) create mode 100644 snappy/.footprint create mode 100644 snappy/.signature create mode 100644 snappy/Pkgfile create mode 100644 snappy/snappy-do-not-disable-rtti.patch create mode 100644 snappy/snappy-inline.patch create mode 100644 snappy/snappy-thirdparty.patch diff --git a/snappy/.footprint b/snappy/.footprint new file mode 100644 index 000000000..58523d895 --- /dev/null +++ b/snappy/.footprint @@ -0,0 +1,18 @@ +drwxr-xr-x root/root usr/ +drwxr-xr-x root/root usr/include/ +-rw-r--r-- root/root usr/include/snappy-c.h +-rw-r--r-- root/root usr/include/snappy-sinksource.h +-rw-r--r-- root/root usr/include/snappy-stubs-public.h +-rw-r--r-- root/root usr/include/snappy.h +drwxr-xr-x root/root usr/lib/ +drwxr-xr-x root/root usr/lib/cmake/ +drwxr-xr-x root/root usr/lib/cmake/Snappy/ +-rw-r--r-- root/root usr/lib/cmake/Snappy/SnappyConfig.cmake +-rw-r--r-- root/root usr/lib/cmake/Snappy/SnappyConfigVersion.cmake +-rw-r--r-- root/root usr/lib/cmake/Snappy/SnappyTargets-release.cmake +-rw-r--r-- root/root usr/lib/cmake/Snappy/SnappyTargets.cmake +lrwxrwxrwx root/root usr/lib/libsnappy.so -> libsnappy.so.1 +lrwxrwxrwx root/root usr/lib/libsnappy.so.1 -> libsnappy.so.1.1.9 +-rwxr-xr-x root/root usr/lib/libsnappy.so.1.1.9 +drwxr-xr-x root/root usr/lib/pkgconfig/ +-rw-r--r-- root/root usr/lib/pkgconfig/snappy.pc diff --git a/snappy/.signature b/snappy/.signature new file mode 100644 index 000000000..604f12f8b --- /dev/null +++ b/snappy/.signature @@ -0,0 +1,8 @@ +untrusted comment: verify with /etc/ports/opt.pub +RWSE3ohX2g5d/YTrt7hBoEBgXLRxBdbQFK63OwrsMMC0xNc//Gndv9VQ1IICKUxApl+qIDHe5u7ed0MgAxq8mX3oC+NcCvBgIw8= +SHA256 (Pkgfile) = 69c9f921cd9e5ceb256fed07c88e8672d59fd3021c0ee36e49e9689d45ed7d77 +SHA256 (.footprint) = a8acb3c1a1ebe35b1b5bfe6bc6917e8fbd654cfbbf0520d626ddcf5262650da9 +SHA256 (snappy-1.1.9.tar.gz) = 75c1fbb3d618dd3a0483bff0e26d0a92b495bbe5059c8b4f1c962b478b6e06e7 +SHA256 (snappy-thirdparty.patch) = c9599e8a4880e7205c74aaadad153c5426853d11ffb7c8a6862d3e291353de7d +SHA256 (snappy-inline.patch) = e8c2d80a6425f9bdf4faf0bd24fdb5f5c55633d9c8775a3bc37ee518b944fae3 +SHA256 (snappy-do-not-disable-rtti.patch) = 0934868ea57a9d9cb3f55b5a2bf0c66f53ec130bd1e1bb3f83f200e6cf3af557 diff --git a/snappy/Pkgfile b/snappy/Pkgfile new file mode 100644 index 000000000..f0bcd7d7f --- /dev/null +++ b/snappy/Pkgfile @@ -0,0 +1,54 @@ +# Description: A fast compressor/decompressor library +# URL: https://google.github.io/snappy/ +# Maintainer: Tim Biermann, tbier at posteo dot de +# Depends on: cmake + +name=snappy +version=1.1.9 +release=1 +source=(https://github.com/google/snappy/archive/$version/$name-$version.tar.gz + snappy-thirdparty.patch + snappy-inline.patch + snappy-do-not-disable-rtti.patch) + +build() { + prt-get isinst ninja && PKGMK_SNAPPY+=' -G Ninja' + + patch -d $name-$version -p1 -i $SRC/snappy-thirdparty.patch + patch -d $name-$version -p1 -i $SRC/snappy-inline.patch + patch -d $name-$version -p1 -i $SRC/snappy-do-not-disable-rtti.patch + + # compile without assertions + CXXFLAGS+=\ -DNDEBUG + + cmake -S $name-$version -B build $PKGMK_SNAPPY \ + -D CMAKE_INSTALL_PREFIX=/usr \ + -D CMAKE_INSTALL_LIBDIR=lib \ + -D CMAKE_BUILD_TYPE=Release \ + -D CMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS" \ + -D CMAKE_C_FLAGS_RELEASE="$CFLAGS" \ + -D BUILD_SHARED_LIBS=ON \ + -D SNAPPY_BUILD_TESTS=OFF \ + -D SNAPPY_BUILD_BENCHMARKS=OFF \ + -D HAVE_LIBZ=NO \ + -D HAVE_LIBLZO2=NO \ + -D HAVE_LIBLZ4=NO \ + -Wno-dev + cmake --build build + DESTDIR=$PKG cmake --install build + +cat <<- EOF > snappy.pc +prefix=/usr +exec_prefix=\${prefix} +includedir=\${prefix}/include +libdir=\${exec_prefix}/lib + +Name: ${name} +Description: A fast compression/decompression library +Version: ${version} +Cflags: -I\${includedir} +Libs: -L\${libdir} -lsnappy +EOF + + install -Dm644 snappy.pc $PKG/usr/lib/pkgconfig/snappy.pc +} diff --git a/snappy/snappy-do-not-disable-rtti.patch b/snappy/snappy-do-not-disable-rtti.patch new file mode 100644 index 000000000..b8d1c1fc2 --- /dev/null +++ b/snappy/snappy-do-not-disable-rtti.patch @@ -0,0 +1,14 @@ +diff -Naur a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2021-05-04 15:53:34.000000000 -0700 ++++ b/CMakeLists.txt 2021-07-08 15:07:15.382419910 -0700 +@@ -76,10 +76,6 @@ + # Disable C++ exceptions. + string(REGEX REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") +- +- # Disable RTTI. +- string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") + endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + + # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make diff --git a/snappy/snappy-inline.patch b/snappy/snappy-inline.patch new file mode 100644 index 000000000..46ed42534 --- /dev/null +++ b/snappy/snappy-inline.patch @@ -0,0 +1,12 @@ +diff -r fd16c2ca3237 snappy.cc +--- a/snappy.cc Sat May 15 15:06:59 2021 +0200 ++++ b/snappy.cc Sat May 15 15:07:31 2021 +0200 +@@ -1014,7 +1014,7 @@ + } + + SNAPPY_ATTRIBUTE_ALWAYS_INLINE +-size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) { ++inline size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) { + const uint8_t*& ip = *ip_p; + // This section is crucial for the throughput of the decompression loop. + // The latency of an iteration is fundamentally constrained by the diff --git a/snappy/snappy-thirdparty.patch b/snappy/snappy-thirdparty.patch new file mode 100644 index 000000000..894fbe987 --- /dev/null +++ b/snappy/snappy-thirdparty.patch @@ -0,0 +1,48 @@ +diff -r efdeda5cdfa2 CMakeLists.txt +--- a/CMakeLists.txt Sat May 15 14:50:17 2021 +0200 ++++ b/CMakeLists.txt Sat May 15 14:54:41 2021 +0200 +@@ -284,29 +284,12 @@ + if(SNAPPY_BUILD_TESTS) + enable_testing() + +- # Prevent overriding the parent project's compiler/linker settings on Windows. +- set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +- set(install_gtest OFF) +- set(install_gmock OFF) +- set(build_gmock ON) +- +- # This project is tested using GoogleTest. +- add_subdirectory("third_party/googletest") +- +- # GoogleTest triggers a missing field initializers warning. +- if(SNAPPY_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(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS) +- + add_executable(snappy_unittest "") + target_sources(snappy_unittest + PRIVATE + "snappy_unittest.cc" + ) +- target_link_libraries(snappy_unittest snappy_test_support gmock_main gtest) ++ target_link_libraries(snappy_unittest snappy_test_support gtest_main gtest) + + add_test( + NAME snappy_unittest +@@ -327,12 +310,11 @@ + PRIVATE + "snappy_benchmark.cc" + ) +- target_link_libraries(snappy_benchmark snappy_test_support benchmark_main) ++ target_link_libraries(snappy_benchmark snappy_test_support benchmark_main benchmark) + + # 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") + endif(SNAPPY_BUILD_BENCHMARKS) + + if(SNAPPY_FUZZING_BUILD)