unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* handle CPPFLAGS in configure and make
@ 2013-05-26  1:28 david
  2013-05-26  1:28 ` [PATCH 1/3] debian: compile with V=1 david
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: david @ 2013-05-26  1:28 UTC (permalink / raw)
  To: notmuch

I wanted to enable hardening flags in the debian build (I guess other
distros will want to do the same); I realized this is made more
difficult by the fact that we don't handle CPPFLAGS in our build
system. Well, if it makes us feel any better, CMake had (has?) the
same bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] debian: compile with V=1
  2013-05-26  1:28 handle CPPFLAGS in configure and make david
@ 2013-05-26  1:28 ` david
  2013-05-26  1:28 ` [PATCH 2/3] configure: grab CPPFLAGS from the environment david
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: david @ 2013-05-26  1:28 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

From: David Bremner <bremner@unb.ca>

The idea is to allow hardening verification tools (in particular blhc)
to scan the logs. Actually fixing the problem will require modifying
the notmuch configure script to propagate CPPFLAGS.
---
 debian/rules |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/rules b/debian/rules
index 71a5602..4257c5a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -9,7 +9,7 @@ override_dh_auto_configure:
 	dh_auto_configure -- --emacslispdir=/usr/share/emacs/site-lisp/notmuch
 
 override_dh_auto_build:
-	dh_auto_build
+	dh_auto_build -- V=1
 	dh_auto_build --sourcedirectory bindings/python
 	cd bindings/python && $(python3_all) setup.py build
 	cd bindings/ruby && ruby extconf.rb --vendor && make
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] configure: grab CPPFLAGS from the environment.
  2013-05-26  1:28 handle CPPFLAGS in configure and make david
  2013-05-26  1:28 ` [PATCH 1/3] debian: compile with V=1 david
@ 2013-05-26  1:28 ` david
  2013-05-26  1:28 ` [PATCH 3/3] build: pass CPPFLAGS to C and C++ compilers david
  2013-05-26 20:07 ` handle CPPFLAGS in configure and make Tomi Ollila
  3 siblings, 0 replies; 6+ messages in thread
From: david @ 2013-05-26  1:28 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

From: David Bremner <bremner@debian.org>

This is needed in particular for hardening flags.
---
 configure |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/configure b/configure
index 460fcfc..3ba1ec3 100755
--- a/configure
+++ b/configure
@@ -43,6 +43,7 @@ fi
 CC=${CC:-gcc}
 CXX=${CXX:-g++}
 CFLAGS=${CFLAGS:--O2}
+CPPFLAGS=${CPPFLAGS:-}
 CXXFLAGS=${CXXFLAGS:-\$(CFLAGS)}
 LDFLAGS=${LDFLAGS:-}
 XAPIAN_CONFIG=${XAPIAN_CONFIG:-xapian-config}
@@ -91,6 +92,7 @@ First, some common variables can specified via environment variables:
 
 	CC		The C compiler to use
 	CFLAGS		Flags to pass to the C compiler
+        CPPFLAGS	Flags to pass to the C preprocessor
 	CXX		The C++ compiler to use
 	CXXFLAGS	Flags to pass to the C compiler
 	LDFLAGS		Flags to pass when linking
@@ -615,6 +617,9 @@ EMACS = emacs --quick
 # Default FLAGS for C compiler (can be overridden by user such as "make CFLAGS=-g")
 CFLAGS = ${CFLAGS}
 
+# Default FLAGS for C preprocessor (can be overridden by user such as "make CPPFLAGS=-I/usr/local/include")
+CPPFLAGS = ${CPPFLAGS}
+
 # Default FLAGS for C++ compiler (can be overridden by user such as "make CXXFLAGS=-g")
 CXXFLAGS = ${CXXFLAGS}
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] build: pass CPPFLAGS to C and C++ compilers
  2013-05-26  1:28 handle CPPFLAGS in configure and make david
  2013-05-26  1:28 ` [PATCH 1/3] debian: compile with V=1 david
  2013-05-26  1:28 ` [PATCH 2/3] configure: grab CPPFLAGS from the environment david
@ 2013-05-26  1:28 ` david
  2013-06-03  0:09   ` David Bremner
  2013-05-26 20:07 ` handle CPPFLAGS in configure and make Tomi Ollila
  3 siblings, 1 reply; 6+ messages in thread
From: david @ 2013-05-26  1:28 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

From: David Bremner <bremner@debian.org>

This is used in particular by hardening flags.
---
 Makefile.local |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile.local b/Makefile.local
index c274f07..644623f 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -39,8 +39,8 @@ GPG_FILE=$(SHA1_FILE).asc
 PV_FILE=bindings/python/notmuch/version.py
 
 # Smash together user's values with our extra values
-FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags)
-FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) $(extra_cflags) $(extra_cxxflags)
+FINAL_CFLAGS = -DNOTMUCH_VERSION=$(VERSION) $(CPPFLAGS) $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags)
+FINAL_CXXFLAGS = $(CPPFLAGS) $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) $(extra_cflags) $(extra_cxxflags)
 FINAL_NOTMUCH_LDFLAGS = $(LDFLAGS) -Lutil -lutil -Llib -lnotmuch $(AS_NEEDED_LDFLAGS) $(GMIME_LDFLAGS) $(TALLOC_LDFLAGS)
 FINAL_NOTMUCH_LINKER = CC
 ifneq ($(LINKER_RESOLVES_LIBRARY_DEPENDENCIES),1)
@@ -237,11 +237,11 @@ quiet ?= $($(shell echo $1 | sed -e s'/ .*//'))
 
 %.o: %.cc $(global_deps)
 	@mkdir -p .deps/$(@D)
-	$(call quiet,CXX $(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d
+	$(call quiet,CXX $(CPPFLAGS) $(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d
 
 %.o: %.c $(global_deps)
 	@mkdir -p .deps/$(@D)
-	$(call quiet,CC $(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d
+	$(call quiet,CC $(CPPFLAGS) $(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d
 
 .PHONY : clean
 clean:
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: handle CPPFLAGS in configure and make
  2013-05-26  1:28 handle CPPFLAGS in configure and make david
                   ` (2 preceding siblings ...)
  2013-05-26  1:28 ` [PATCH 3/3] build: pass CPPFLAGS to C and C++ compilers david
@ 2013-05-26 20:07 ` Tomi Ollila
  3 siblings, 0 replies; 6+ messages in thread
From: Tomi Ollila @ 2013-05-26 20:07 UTC (permalink / raw)
  To: david, notmuch

On Sun, May 26 2013, david@tethera.net wrote:

> I wanted to enable hardening flags in the debian build (I guess other
> distros will want to do the same); I realized this is made more
> difficult by the fact that we don't handle CPPFLAGS in our build
> system. Well, if it makes us feel any better, CMake had (has?) the
> same bug.

Series LGTM. I don't know what V=1 does but probably nothing harmful :D

Tomi

>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] build: pass CPPFLAGS to C and C++ compilers
  2013-05-26  1:28 ` [PATCH 3/3] build: pass CPPFLAGS to C and C++ compilers david
@ 2013-06-03  0:09   ` David Bremner
  0 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2013-06-03  0:09 UTC (permalink / raw)
  To: notmuch

david@tethera.net writes:

> From: David Bremner <bremner@debian.org>
>
> This is used in particular by hardening flags.

I pushed all three. I assume someone will let me know if I broke the
build system for them...

d

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-06-03  0:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-26  1:28 handle CPPFLAGS in configure and make david
2013-05-26  1:28 ` [PATCH 1/3] debian: compile with V=1 david
2013-05-26  1:28 ` [PATCH 2/3] configure: grab CPPFLAGS from the environment david
2013-05-26  1:28 ` [PATCH 3/3] build: pass CPPFLAGS to C and C++ compilers david
2013-06-03  0:09   ` David Bremner
2013-05-26 20:07 ` handle CPPFLAGS in configure and make Tomi Ollila

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).