add option to enable rtti set default to current

This commit is contained in:
wangzengliang 2022-06-22 10:52:02 +08:00
parent c6b865fdf8
commit 219f0c8b87
2 changed files with 78 additions and 2 deletions

View File

@ -0,0 +1,72 @@
From 07d1ae496bea8280f4cec08df5745845f7956365 Mon Sep 17 00:00:00 2001
From: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
Date: Wed, 6 Apr 2022 10:04:21 -0700
Subject: [PATCH] snappy: Autospec creation for version 1.1.9
This patch addresses an issue with Ceph
https://tracker.ceph.com/issues/53060. There have been multiple patches
to upstream snappy, but they have all been rejected and the reasoning
has always been that snappy would like to be consistent in their build
flags with chrome as mentioned at
https://github.com/google/snappy/pull/144#issuecomment-968371042
add-option-to-enable-rtti-set-default-to-current-ben.patch
---
CMakeLists.txt | 14 ++++++++++----
snappy-stubs-internal.h | 2 +-
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 672561e..cafdc59 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,8 +53,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
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-")
+ if(NOT SNAPPY_ENABLE_RTTI)
+ string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
+ endif(SNAPPY_ENABLE_RTTI)
else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Use -Wall for clang and gcc.
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
@@ -78,8 +80,10 @@ else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
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")
+ if(NOT SNAPPY_ENABLE_RTTI)
+ string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
+ endif(SNAPPY_ENABLE_RTTI)
endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
@@ -98,6 +102,8 @@ option(SNAPPY_REQUIRE_AVX2 "Target processors with AVX2 support." OFF)
option(SNAPPY_INSTALL "Install Snappy's header and library" ON)
+option(SNAPPY_ENABLE_RTTI "Enable RTTI for Snappy's library" OFF)
+
include(TestBigEndian)
test_big_endian(SNAPPY_IS_BIG_ENDIAN)
diff --git a/snappy-stubs-internal.h b/snappy-stubs-internal.h
index c2a838f..5bf7870 100644
--- a/snappy-stubs-internal.h
+++ b/snappy-stubs-internal.h
@@ -100,7 +100,7 @@
// Inlining hints.
#ifdef HAVE_ATTRIBUTE_ALWAYS_INLINE
-#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline))
+#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE
#else
#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE
#endif
--
2.24.4

View File

@ -1,6 +1,6 @@
Name: snappy
Version: 1.1.9
Release: 1
Release: 2
Summary: A fast compressor/decompressor
License: BSD
URL: https://github.com/google/snappy
@ -9,6 +9,7 @@ Source1: snappy.pc
Patch0: remove-dependency-on-google-benchmark-and-gmock.patch
Patch1: fix-the-AdvanceToNextTag-fails-to-be-compiled-without-inline.patch
Patch2: add-option-to-enable-rtti-set-default-to-current-ben.patch
BuildRequires: gcc-c++ make gtest-devel cmake
@ -32,7 +33,7 @@ This package is the development files for snappy.
%autosetup -n %{name}-%{version} -p1
%build
%cmake
%cmake -DSNAPPY_ENABLE_RTTI=ON
%make_build
%install
@ -69,6 +70,9 @@ make test
%doc NEWS README.md
%changelog
* Wed Jun 22 2022 wangzengliang<wangzengliang1@huawei.com> - 1.1.9-2
- DESC: add option to enable rtti set default to current
* Fri Dec 24 2021 yuanxin<yuanxin24@huawei.com> - 1.1.9-1
- update version to 1.1.9