[bug#76342] build: Pass CFLAGS, CPPFLAGS and LDFLAGS to CC.

Message ID 87frkdls9m.fsf@josefsson.org
State New
Headers
Series [bug#76342] build: Pass CFLAGS, CPPFLAGS and LDFLAGS to CC. |

Commit Message

Simon Josefsson Feb. 16, 2025, 5:21 p.m. UTC
  Hi

The Debian QA linters noticed that some CC flags were missing, and this
patch fixes it.  It seems the default CFLAGS for me is '-O2 -g' when
running ./configure so I dropped those since they were added twice
otherwise.  Maye -Wall should be moved to a Makefile.am AM_CFLAGS (or
something), but the attached patch seems sufficient to silences Debian's
"blhc" tool which is my main concern.

https://salsa.debian.org/debian/shepherd/-/jobs/7100765

400:CFLAGS missing (-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection): 			\ gcc -O2 -g -Wall -shared -fPIC -o "etc/crash-handler.so" "etc/crash-handler.c"
400:CPPFLAGS missing (-D_FORTIFY_SOURCE=2): 			\ gcc -O2 -g -Wall -shared -fPIC -o "etc/crash-handler.so" "etc/crash-handler.c"
400:LDFLAGS missing (-Wl,-z,relro): 			\ gcc -O2 -g -Wall -shared -fPIC -o "etc/crash-handler.so" "etc/crash-handler.c"

/Simon
  

Comments

Simon Josefsson Feb. 20, 2025, 7:52 a.m. UTC | #1
retitle 76342 [PATCH] Shepherd: build: Pass CFLAGS, CPPFLAGS and LDFLAGS to CC.
thanks

I forgot to include the word 'Shepherd' in the Subject line...
  
Ludovic Courtès Feb. 20, 2025, 10:53 p.m. UTC | #2
Hi Simon,

Simon Josefsson <simon@josefsson.org> skribis:

> From fdaeac0a71f3bdd1daaafffc46647f05e019ac10 Mon Sep 17 00:00:00 2001
> From: Simon Josefsson <simon@josefsson.org>
> Date: Sun, 16 Feb 2025 16:11:04 +0100
> Subject: [PATCH] build: Pass CFLAGS, CPPFLAGS and LDFLAGS to CC.
>
> * Makefile.am (etc/crash-handler.so): Do it.
>
> Signed-off-by: Simon Josefsson <simon@josefsson.org>

Applied, thanks!

Ludo’.
  

Patch

From fdaeac0a71f3bdd1daaafffc46647f05e019ac10 Mon Sep 17 00:00:00 2001
From: Simon Josefsson <simon@josefsson.org>
Date: Sun, 16 Feb 2025 16:11:04 +0100
Subject: [PATCH] build: Pass CFLAGS, CPPFLAGS and LDFLAGS to CC.

* Makefile.am (etc/crash-handler.so): Do it.

Signed-off-by: Simon Josefsson <simon@josefsson.org>
---
 Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index aa2edd9..bc87404 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -107,7 +107,7 @@  install-crash-handler:
 
 etc/crash-handler.so: etc/crash-handler.c
 	$(AM_V_GEN)$(MKDIR_P) etc;			\
-	$(CC) -O2 -g -Wall -shared -fPIC -o "$@" "$^"
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Wall -shared -fPIC -o "$@" "$^"
 
 CLEANFILES += etc/crash-handler.so
 
-- 
2.48.1