From fa0891535b8ce35a595b3e3165782f81bae5b87a Mon Sep 17 00:00:00 2001 From: wjyrich Date: Thu, 3 Jul 2025 11:46:40 +0800 Subject: [PATCH] fix: fix safe build with debian/rules. as title. Logs: --- CMakeLists.txt | 5 ----- debian/rules | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f87c58bc..6d0cdf90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,11 +8,6 @@ project(dde-network-core LANGUAGES CXX C ) -# 增加安全编译参数 -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-all") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z relro -z now -z noexecstack -pie") - option(ENABLE_DEEPIN_NMQT "enable nmqt patch on deepin" OFF) set(DDE-Network-Core_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/src-old") diff --git a/debian/rules b/debian/rules index 3dc71317..0cd9d0a3 100755 --- a/debian/rules +++ b/debian/rules @@ -2,6 +2,10 @@ include /usr/share/dpkg/default.mk export QT_SELECT = qt5 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +export DEB_CFLAGS_MAINT_APPEND = -Wall +export DEB_CXXFLAGS_MAINT_APPEND = -Wall +export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack -Wl,-E DISTRO = $(shell lsb_release -is) ifeq ($(DISTRO),Deepin)