[pacman-dev] [PATCH] makepkg: Add CPPFLAGS support

Allan McRae allan at archlinux.org
Tue May 8 02:05:50 EDT 2012


Add CPPFLAGS support in addition to the current CFLAGS and CXXFLAGS.
This keeps compiler flags split up in the same logical way done
everywhere else.

Signed-off-by: Allan McRae <allan at archlinux.org>
---

This will allow a certian disrtibution to put -D_FORTIFY_SOURCE where
it should be...

 doc/PKGBUILD.5.txt     |    8 ++++----
 doc/makepkg.conf.5.txt |    3 +++
 etc/makepkg.conf.in    |    1 +
 scripts/makepkg.sh.in  |    4 ++--
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt
index eefdbd4..384af7c 100644
--- a/doc/PKGBUILD.5.txt
+++ b/doc/PKGBUILD.5.txt
@@ -254,10 +254,10 @@ A normal sync or upgrade will not use its value.
 		with distcc.
 
 	*buildflags*;;
-		Allow the use of user-specific buildflags (CFLAGS, CXXFLAGS, LDFLAGS)
-		during build as specified in linkman:makepkg.conf[5]. More useful in
-		its negative form `!buildflags` with select packages that have problems
-		building with custom buildflags.
+		Allow the use of user-specific buildflags (CPPFLAGS, CFLAGS, CXXFLAGS,
+		LDFLAGS) during build as specified in linkman:makepkg.conf[5]. More
+		useful in its negative form `!buildflags` with select packages that
+		have problems building with custom buildflags.
 
 	*makeflags*;;
 		Allow the use of user-specific makeflags during build as specified
diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt
index 5970946..de2b4b4 100644
--- a/doc/makepkg.conf.5.txt
+++ b/doc/makepkg.conf.5.txt
@@ -51,6 +51,9 @@ Options
 	A string such as ``i686-pc-linux-gnu'', do not touch unless you know what
 	you are doing. This can be commented out by most users if desired.
 
+**CPPFLAGS=**"cppflags"::
+	Flags used for the C preprocessor; see CFLAGS for more info.
+
 **CFLAGS=**"cflags"::
 	Flags used for the C compiler. This is a key part to the use of makepkg.
 	Usually several options are specified, and the most common string resembles
diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in
index d8117a3..51df493 100644
--- a/etc/makepkg.conf.in
+++ b/etc/makepkg.conf.in
@@ -27,6 +27,7 @@ CARCH="@CARCH@"
 CHOST="@CHOST@"
 
 #-- Compiler and Linker Flags
+#CPPFLAGS=""
 #CFLAGS="-O2 -pipe"
 #CXXFLAGS="-O2 -pipe"
 #LDFLAGS=""
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index d36dbd6..c7baa97 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -955,7 +955,7 @@ run_function() {
 
 	# clear user-specified buildflags if requested
 	if check_option "buildflags" "n"; then
-		unset CFLAGS CXXFLAGS LDFLAGS
+		unset CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
 	fi
 
 	# clear user-specified makeflags if requested
@@ -967,7 +967,7 @@ run_function() {
 	cd_safe "$srcdir"
 
 	# ensure all necessary build variables are exported
-	export CFLAGS CXXFLAGS LDFLAGS MAKEFLAGS CHOST
+	export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS MAKEFLAGS CHOST
 	# save our shell options so pkgfunc() can't override what we need
 	local shellopts=$(shopt -p)
 
-- 
1.7.10.1



More information about the pacman-dev mailing list