mirror of
https://github.com/dslm4515/BMLFS.git
synced 2025-08-10 02:45:15 +00:00
Updated snappy to 1.1.9
This commit is contained in:
64
build-scripts/snappy.build
Normal file
64
build-scripts/snappy.build
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# snappy
|
||||||
|
# Source: https://github.com/google/snappy/archive/1.1.9/snappy-1.1.9.tar.gz
|
||||||
|
#
|
||||||
|
# $BUILD = Directory to temporarily install
|
||||||
|
# $PKGS = Directory to store built packages
|
||||||
|
#
|
||||||
|
# DEPS
|
||||||
|
# Required: CMake
|
||||||
|
# Recommended: NONE
|
||||||
|
# Optional: NONE
|
||||||
|
|
||||||
|
# If coptimizing with GCC:
|
||||||
|
export CFLAGS="-march=native -pipe "
|
||||||
|
export CFLAGS+="-O3 -ffat-lto-objects -flto=4 "
|
||||||
|
export CFLAGS+="-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector "
|
||||||
|
export CFLAGS+="--param=ssp-buffer-size=32 -Wformat -Wformat-security "
|
||||||
|
export CFLAGS+="-Wno-error -Wl,-z,max-page-size=0x1000"
|
||||||
|
export CXXFLAGS=$CFLAGS
|
||||||
|
export LDFLAGS="-flto=4 -Wl,-O2 -Wl,--as-needed "
|
||||||
|
|
||||||
|
patch -Np1 -i ../patches/snappy-alpine/cmakelists.patch
|
||||||
|
patch -Np1 -i ../patches/snappy-void/inline.patch
|
||||||
|
|
||||||
|
mkdir build && cd build &&
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=/usr \
|
||||||
|
-DBUILD_SHARED_LIBS=yes \
|
||||||
|
-DBUILD_STATIC_LIBS=yes \
|
||||||
|
-DSNAPPY_REQUIRE_AVX2=yes \
|
||||||
|
-DSNAPPY_BUILD_TESTS=no \
|
||||||
|
-DSNAPPY_BUILD_BENCHMARKS=no \
|
||||||
|
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
|
||||||
|
-DCMAKE_C_FLAGS="$CFLAGS" .. && \
|
||||||
|
|
||||||
|
read -p "Compile?" && make -j2 &&
|
||||||
|
|
||||||
|
sudo -S make DESTDIR=$BUILD install &&
|
||||||
|
|
||||||
|
cd $BUILD && sudo -S mkdir -v ${BUILD}/install &&
|
||||||
|
cat > /tmp/slack-desc << "EOF"
|
||||||
|
# HOW TO EDIT THIS FILE:
|
||||||
|
# The "handy ruler" below makes it easier to edit a package description. Line
|
||||||
|
# up the first '|' above the ':' following the base package name, and the '|'
|
||||||
|
# on the right side marks the last column you can put a character in. You must
|
||||||
|
# make exactly 11 lines for the formatting to be correct. It's also
|
||||||
|
# customary to leave one space after the ':' except on otherwise blank lines.
|
||||||
|
|
||||||
|
|-----handy-ruler------------------------------------------------------|
|
||||||
|
snappy: snappy (A fast compressor/decompressor)
|
||||||
|
snappy:
|
||||||
|
snappy: Snappy is a compression/decompression library. It does not aim for
|
||||||
|
snappy: maximum compression, or compatibility with any other compression
|
||||||
|
snappy: library; instead, it aims for very high speeds and reasonable
|
||||||
|
snappy: compression. For instance, compared to the fastest mode of zlib,
|
||||||
|
snappy: Snappy is an order of magnitude faster for most inputs, but the
|
||||||
|
snappy: resulting compressed files are anywhere from 20% to 100% bigger.
|
||||||
|
snappy:
|
||||||
|
snappy:
|
||||||
|
snappy:
|
||||||
|
EOF
|
||||||
|
sudo -S mv -v /tmp/slack-desc install/ &&
|
||||||
|
sudo -S makepkg -l y -c n $PKGS/snappy-1.1.9-$(uname -m)-mlfs.txz &&
|
||||||
|
sudo -S rm -rf ${BUILD}/*
|
96
patches/snappy-alpine/cmakelists.patch
Normal file
96
patches/snappy-alpine/cmakelists.patch
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -41,6 +41,8 @@
|
||||||
|
# it prominent in the GUI.
|
||||||
|
option(BUILD_SHARED_LIBS "Build shared libraries(DLLs)." OFF)
|
||||||
|
|
||||||
|
+option(BUILD_STATIC_LIBS "Build static libraries." ON)
|
||||||
|
+
|
||||||
|
option(SNAPPY_BUILD_TESTS "Build Snappy's own tests." ON)
|
||||||
|
|
||||||
|
option(SNAPPY_FUZZING_BUILD "Build Snappy for fuzzing." OFF)
|
||||||
|
@@ -51,6 +53,10 @@
|
||||||
|
|
||||||
|
option(SNAPPY_INSTALL "Install Snappy's header and library" ON)
|
||||||
|
|
||||||
|
+if(NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
|
||||||
|
+ set(BUILD_STATIC_LIBS OFF)
|
||||||
|
+endif ()
|
||||||
|
+
|
||||||
|
include(TestBigEndian)
|
||||||
|
test_big_endian(SNAPPY_IS_BIG_ENDIAN)
|
||||||
|
|
||||||
|
@@ -166,19 +172,28 @@
|
||||||
|
"snappy-stubs-public.h.in"
|
||||||
|
"${PROJECT_BINARY_DIR}/snappy-stubs-public.h")
|
||||||
|
|
||||||
|
+# When BUILD_SHARED_LIBS is:
|
||||||
|
+# ON it will generate a SHARED library
|
||||||
|
+# OFF it will generate a STATIC library
|
||||||
|
add_library(snappy "")
|
||||||
|
-target_sources(snappy
|
||||||
|
- PRIVATE
|
||||||
|
+
|
||||||
|
+# Used to generate both lib types
|
||||||
|
+if (BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
|
||||||
|
+ add_library(snappy_static STATIC "")
|
||||||
|
+ set_target_properties(snappy_static PROPERTIES OUTPUT_NAME snappy)
|
||||||
|
+ install(TARGETS snappy_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
+endif ()
|
||||||
|
+
|
||||||
|
+set(SNAPPY_SOURCE_PRIVATE
|
||||||
|
"snappy-internal.h"
|
||||||
|
"snappy-stubs-internal.h"
|
||||||
|
"snappy-c.cc"
|
||||||
|
"snappy-sinksource.cc"
|
||||||
|
"snappy-stubs-internal.cc"
|
||||||
|
"snappy.cc"
|
||||||
|
- "${PROJECT_BINARY_DIR}/config.h"
|
||||||
|
+ "${PROJECT_BINARY_DIR}/config.h")
|
||||||
|
|
||||||
|
- # Only CMake 3.3+ supports PUBLIC sources in targets exported by "install".
|
||||||
|
- $<$<VERSION_GREATER:CMAKE_VERSION,3.2>:PUBLIC>
|
||||||
|
+set(SNAPPY_SOURCE_PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy-c.h>
|
||||||
|
$<INSTALL_INTERFACE:include/snappy-c.h>
|
||||||
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy-sinksource.h>
|
||||||
|
@@ -186,18 +201,32 @@
|
||||||
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy.h>
|
||||||
|
$<INSTALL_INTERFACE:include/snappy.h>
|
||||||
|
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/snappy-stubs-public.h>
|
||||||
|
- $<INSTALL_INTERFACE:include/snappy-stubs-public.h>
|
||||||
|
-)
|
||||||
|
-target_include_directories(snappy
|
||||||
|
- PUBLIC
|
||||||
|
+ $<INSTALL_INTERFACE:include/snappy-stubs-public.h>)
|
||||||
|
+
|
||||||
|
+set(SNAPPY_INCLUDE_DIRS
|
||||||
|
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
|
||||||
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
||||||
|
- $<INSTALL_INTERFACE:include>
|
||||||
|
-)
|
||||||
|
+ $<INSTALL_INTERFACE:include>)
|
||||||
|
+
|
||||||
|
+# Only CMake 3.3+ supports PUBLIC sources in targets exported by "install".
|
||||||
|
+target_sources(snappy PRIVATE ${SNAPPY_SOURCE_PRIVATE}
|
||||||
|
+ $<$<VERSION_GREATER:CMAKE_VERSION,3.2>:PUBLIC> ${SNAPPY_SOURCE_PUBLIC})
|
||||||
|
+
|
||||||
|
+target_include_directories(snappy PUBLIC ${SNAPPY_INCLUDE_DIRS})
|
||||||
|
+
|
||||||
|
+target_compile_definitions(snappy PRIVATE -DHAVE_CONFIG_H)
|
||||||
|
+
|
||||||
|
+# Only CMake 3.3+ supports PUBLIC sources in targets exported by "install".
|
||||||
|
+target_sources(snappy_static PRIVATE ${SNAPPY_SOURCE_PRIVATE}
|
||||||
|
+ $<$<VERSION_GREATER:CMAKE_VERSION,3.2>:PUBLIC> ${SNAPPY_SOURCE_PUBLIC})
|
||||||
|
+
|
||||||
|
+target_include_directories(snappy_static PUBLIC ${SNAPPY_INCLUDE_DIRS})
|
||||||
|
+
|
||||||
|
+target_compile_definitions(snappy_static PRIVATE -DHAVE_CONFIG_H)
|
||||||
|
+
|
||||||
|
set_target_properties(snappy
|
||||||
|
PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
|
||||||
|
|
||||||
|
-target_compile_definitions(snappy PRIVATE -DHAVE_CONFIG_H)
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
set_target_properties(snappy PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||||
|
endif(BUILD_SHARED_LIBS)
|
11
patches/snappy-void/inline.patch
Normal file
11
patches/snappy-void/inline.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
Add inline with SNAPPY_ATTRIBUTE_ALWAYS_INLINE on AdvanceToNextTag to fix:
|
||||||
|
1097 | size_t tag_type = AdvanceToNextTag(&ip, &tag);
|
||||||
|
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~
|
||||||
|
../snappy.cc:1017:8: error: inlining failed in call to 'always_inline'
|
||||||
|
'size_t snappy::AdvanceToNextTag(const uint8_t**, size_t*)': function body can be overwritten at link time
|
||||||
|
|
||||||
|
--- a/snappy.cc 2021-05-05 02:53:34.000000000 +0400
|
||||||
|
+++ b/snappy.cc 2021-05-24 01:24:59.124654893 +0400
|
||||||
|
@@ -1017 +1017 @@ 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) {
|
Reference in New Issue
Block a user