Initial Commit
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
# Exclude bpm archives
|
||||
*.bpm
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Github repository
|
||||
REPO="google/snappy"
|
||||
|
||||
# Get tag name using Github Rest API
|
||||
TAG_NAME=$(curl -s -L -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/"$REPO"/releases/latest | jq -r '.tag_name')
|
||||
|
||||
echo "$TAG_NAME"
|
||||
@@ -0,0 +1,21 @@
|
||||
name: snappy
|
||||
description: A fast compressor/decompressor library
|
||||
version: 1.2.2
|
||||
revision: 1
|
||||
url: https://github.com/google/snappy
|
||||
license: BSD-3-Clause
|
||||
architecture: any
|
||||
type: source
|
||||
depends:
|
||||
- gcc-libs
|
||||
- glibc
|
||||
make_depends:
|
||||
- clang
|
||||
- cmake
|
||||
- googletest
|
||||
- zlib
|
||||
downloads:
|
||||
- url: https://github.com/google/snappy/archive/refs/tags/${BPM_PKG_VERSION}.tar.gz
|
||||
extract_to: ${BPM_SOURCE}
|
||||
extract_strip_components: 1
|
||||
checksum: 90f74bc1fbf78a6c56b3c4a082a05103b3a56bb17bca1a27e052ea11723292dc
|
||||
@@ -0,0 +1,24 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -187,6 +187,12 @@
|
||||
"${PROJECT_BINARY_DIR}/config.h"
|
||||
)
|
||||
|
||||
+configure_file(
|
||||
+ "${CMAKE_CURRENT_SOURCE_DIR}/snappy.pc.in"
|
||||
+ "${CMAKE_CURRENT_BINARY_DIR}/snappy.pc"
|
||||
+ @ONLY
|
||||
+)
|
||||
+
|
||||
# We don't want to define HAVE_ macros in public headers. Instead, we use
|
||||
# CMake's variable substitution with 0/1 variables, which will be seen by the
|
||||
# preprocessor as constants.
|
||||
@@ -395,4 +401,8 @@
|
||||
"${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
||||
)
|
||||
+ install(
|
||||
+ FILES "${PROJECT_BINARY_DIR}/snappy.pc"
|
||||
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
|
||||
+ )
|
||||
endif(SNAPPY_INSTALL)
|
||||
@@ -0,0 +1,25 @@
|
||||
diff --unified --recursive --text --new-file snappy-1.2.2.orig/CMakeLists.txt snappy-1.2.2/CMakeLists.txt
|
||||
--- snappy-1.2.2.orig/CMakeLists.txt 2025-04-19 23:20:48.985433149 +0200
|
||||
+++ snappy-1.2.2/CMakeLists.txt 2025-04-19 23:20:27.703912696 +0200
|
||||
@@ -51,10 +51,6 @@
|
||||
string(REGEX REPLACE "/EH[a-z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHs-c-")
|
||||
add_definitions(-D_HAS_EXCEPTIONS=0)
|
||||
-
|
||||
- # Disable RTTI.
|
||||
- string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
|
||||
else(MSVC)
|
||||
# Use -Wall for clang and gcc.
|
||||
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
|
||||
@@ -81,10 +77,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(MSVC)
|
||||
|
||||
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
|
||||
@@ -0,0 +1,10 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${prefix}/lib
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: snappy
|
||||
Description: Fast compressor/decompressor library.
|
||||
Version: @PROJECT_VERSION@
|
||||
Libs: -L${libdir} -lsnappy
|
||||
Cflags: -I${includedir}
|
||||
@@ -0,0 +1,27 @@
|
||||
diff --unified --recursive --text --new-file snappy-1.2.1.orig/CMakeLists.txt snappy-1.2.1/CMakeLists.txt
|
||||
--- snappy-1.2.1.orig/CMakeLists.txt 2024-09-25 22:35:44.563365640 +0200
|
||||
+++ snappy-1.2.1/CMakeLists.txt 2024-09-25 22:40:22.273395168 +0200
|
||||
@@ -331,19 +331,18 @@
|
||||
set(install_gmock OFF)
|
||||
set(build_gmock ON)
|
||||
|
||||
- # This project is tested using GoogleTest.
|
||||
- add_subdirectory("third_party/googletest")
|
||||
+ find_package(GTest REQUIRED)
|
||||
|
||||
# GoogleTest triggers a missing field initializers warning.
|
||||
if(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
|
||||
- set_property(TARGET gtest
|
||||
+ set_property(TARGET GTest::gtest
|
||||
APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
|
||||
- set_property(TARGET gmock
|
||||
+ set_property(TARGET GTest::gmock
|
||||
APPEND PROPERTY COMPILE_OPTIONS -Wno-missing-field-initializers)
|
||||
endif(SNAPPY_HAVE_NO_MISSING_FIELD_INITIALIZERS)
|
||||
|
||||
if(SNAPPY_HAVE_NO_IMPLICIT_INT_FLOAT_CONVERSION)
|
||||
- set_property(TARGET gtest
|
||||
+ set_property(TARGET GTest::gtest
|
||||
APPEND PROPERTY COMPILE_OPTIONS -Wno-implicit-int-float-conversion)
|
||||
endif(SNAPPY_HAVE_NO_IMPLICIT_INT_FLOAT_CONVERSION)
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
|
||||
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
|
||||
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
|
||||
|
||||
# The prepare function is executed in the root of the temp directory
|
||||
# This function is used for putting downloaded files to the correct location or applying patches
|
||||
prepare() {
|
||||
cd "$BPM_SOURCE"
|
||||
cp "$BPM_WORKDIR"/snappy.pc.in .
|
||||
patch -Np1 -i "$BPM_WORKDIR"/add-pkgconfig.patch
|
||||
patch -Np1 -i "$BPM_WORKDIR"/reenable-rtti.patch
|
||||
patch -Np1 -i "$BPM_WORKDIR"/use-system-gtest.patch
|
||||
}
|
||||
|
||||
# The build function is executed in the source directory
|
||||
# This function is used to compile the source code
|
||||
build() {
|
||||
cmake -B build -DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DCMAKE_CXX_STANDARD=23 \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DSNAPPY_BUILD_BENCHMARKS=OFF
|
||||
cmake --build build
|
||||
}
|
||||
|
||||
# The check function is executed in the source directory
|
||||
# This function is used to run tests to verify the package has been compiled correctly
|
||||
check() {
|
||||
ctest --test-dir build
|
||||
}
|
||||
|
||||
# The package function is executed in the source directory
|
||||
# This function is used to move the compiled files into the output directory
|
||||
package() {
|
||||
DESTDIR="$BPM_OUTPUT" cmake --install build
|
||||
|
||||
# Install package license
|
||||
install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/snappy/COPYING
|
||||
}
|
||||
Reference in New Issue
Block a user