From 6123b9ea5506fd9ffeaccbc275d102e91e6ed2c9 Mon Sep 17 00:00:00 2001 From: wujing Date: Fri, 19 Mar 2021 07:49:53 +0800 Subject: [PATCH] add secure compile options for libevhtp Signed-off-by: wujing --- ...libevhtp-add-securce-compile-options.patch | 46 +++++++++++++++++++ libevhtp.spec | 14 ++++-- 2 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 0005-libevhtp-add-securce-compile-options.patch diff --git a/0005-libevhtp-add-securce-compile-options.patch b/0005-libevhtp-add-securce-compile-options.patch new file mode 100644 index 0000000..1a2d4bd --- /dev/null +++ b/0005-libevhtp-add-securce-compile-options.patch @@ -0,0 +1,46 @@ +From cb1d37837d76928670c414d3b498d898ee0b32ae Mon Sep 17 00:00:00 2001 +From: wujing +Date: Tue, 16 Mar 2021 10:37:07 +0800 +Subject: [PATCH] libevhtp: add securce compile options + +Signed-off-by: wujing +--- + CMakeLists.txt | 7 ++++++- + cmake/options.cmake | 3 +++ + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fbb0f50..5bc89d5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -110,7 +110,12 @@ elseif(EVHTP_ALLOCATOR STREQUAL "tcmalloc") + endif() + endif() + +-add_library(evhtp SHARED ${LIBEVHTP_SOURCE_FILES}) ++if (NOT EVHTP_BUILD_SHARED) ++ add_library(evhtp ${LIBEVHTP_SOURCE_FILES}) ++else() ++ add_library(evhtp SHARED ${LIBEVHTP_SOURCE_FILES}) ++ target_link_options(evhtp PUBLIC "-Wl,-z,now -s") ++endif() + target_link_libraries(evhtp PUBLIC ${LIBEVHTP_EXTERNAL_LIBS}) + target_include_directories(evhtp PUBLIC ${LIBEVHTP_EXTERNAL_INCLUDES}) + +diff --git a/cmake/options.cmake b/cmake/options.cmake +index 1738642..e781110 100644 +--- a/cmake/options.cmake ++++ b/cmake/options.cmake +@@ -11,6 +11,9 @@ option (EVHTP_DISABLE_REGEX "Disable regex support" OFF) + # -DEVHTP_DEBUG=ON + option (EVHTP_DEBUG "Enable verbose debug logging" OFF) + ++# -DEVHTP_BUILD_SHARED=ON ++option (EVHTP_BUILD_SHARED "Build shared libraries" OFF) ++ + # can be overwritten by new set_alloc functions + set(EVHTP_ALLOCATOR CACHE STRING "Allocator library") + set_property(CACHE EVHTP_ALLOCATOR PROPERTY STRINGS "jemalloc;tcmalloc") +-- +2.29.2 + diff --git a/libevhtp.spec b/libevhtp.spec index a8f85b1..ac435d5 100644 --- a/libevhtp.spec +++ b/libevhtp.spec @@ -1,6 +1,8 @@ +%global debug_package %{nil} + Name: libevhtp Version: 1.2.18 -Release: 2 +Release: 3 Summary: Libevent based HTTP API. License: BSD3 @@ -10,6 +12,7 @@ Patch9000: 0001-decrease-numbers-of-fd-for-shared-pipe-mode.patch Patch9001: 0002-evhtp-enable-dynamic-thread-pool.patch Patch9002: 0003-close-open-ssl.-we-do-NOT-use-it-in-lcrd.patch Patch9003: 0004-Use-shared-library-instead-static-one.patch +Patch9004: 0005-libevhtp-add-securce-compile-options.patch BuildRequires: git gcc-c++ cmake libevent-devel @@ -28,8 +31,6 @@ Requires: %{name} = %{version}-%{release} %{name}-devel contains the header files for developing applications that want to make use of %{name}. -%global debug_package %{nil} - %prep %autosetup -n %{name}-%{version} -p1 @@ -46,6 +47,7 @@ cd build %delete_la_and_a find %{buildroot} -name '*.cmake' -exec rm -f {} ';' +find %{buildroot} -name '*.so.*' -exec strip {} ';' %ldconfig_scriptlets @@ -63,6 +65,12 @@ find %{buildroot} -name '*.cmake' -exec rm -f {} ';' /usr/lib/pkgconfig/evhtp.pc %changelog +* Fri Mar 19 2021 wujing - 1.2.18-3 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC: add secure compile options + * Tue Sep 01 2020 openeuler Buildteam - 1.2.18-2 - Type:enhancement - ID:NA