Add FORTIFY_SOURCE flag

This commit is contained in:
alan (NyxTrail) 2024-03-09 10:04:24 +00:00
parent 5078741566
commit 0eb16ca071
No known key found for this signature in database
GPG Key ID: 32C5D29762C48D4A
3 changed files with 16 additions and 2 deletions

View File

@ -0,0 +1,11 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -88,7 +88,7 @@
"protocols/")
set(CMAKE_CXX_STANDARD 23)
add_compile_definitions(WLR_USE_UNSTABLE)
-add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing -Wno-pointer-arith)
+add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing -Wno-pointer-arith -D_FORTIFY_SOURCE=2)
add_link_options(-rdynamic)
set(CMAKE_ENABLE_EXPORTS TRUE)

View File

@ -2,3 +2,4 @@
002-disable-udis86.patch
003-use-system-hyprland-protocols.patch
004-use-bash-in-makefile.patch
005-add-fortify-build-flags.patch

6
debian/rules vendored
View File

@ -1,20 +1,20 @@
#!/usr/bin/make -f
# You must remove unused comment lines for the released package.
export DH_VERBOSE = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O2
export DEB_BUILD_HARDENING_FORTIFY = 1
%:
dh $@
override_dh_auto_build:
dh_auto_build -- PREFIX=/usr all
# Ignore makeshlibs. Our included binary is a custom copy of wlroots
# that is installed into a private directory (/usr/lib/hyprland/).
override_dh_makeshlibs:
:
override_dh_auto_install:
chrpath -r /usr/lib/hyprland build/Hyprland
# Fix permission on hyprland.pc (Hyprland sets 777 on everything in
@ -24,6 +24,7 @@ override_dh_auto_install:
# Modify PREFIX so that this DESTDIR is actually taken into account.
# (Upstream Makefile supports PREFIX, but not DESTDIR)
dh_auto_install -- PREFIX='$${DESTDIR}/usr'
override_dh_clean:
dh_clean
# call clear target provided by Hyprland
@ -35,6 +36,7 @@ override_dh_clean:
# Hyprland made this change. Revert it or dpkg-source will complain that
# meson.build does not match the one in the original source tarball
sed -E -i -e 's/^soversion = .*/soversion = version_minor.to_int() - 5/g' subprojects/wlroots/meson.build
#override_dh_auto_configure:
# dh_auto_configure -- \
# -DCMAKE_LIBRARY_ARCHITECTURE="$(DEB_TARGET_MULTIARCH)"