Patchwork [devtools] makepkg.conf: move -D_FORTIFY_SOURCE=2 to CPPFLAGS

login
register
mail settings
Submitter Dave Reisner
Date Feb. 6, 2013, 5:06 p.m.
Message ID <1360170390-7891-1-git-send-email-dreisner@archlinux.org>
Download mbox | patch
Permalink /patch/897/
State New
Headers show

Comments

Dave Reisner - Feb. 6, 2013, 5:06 p.m.
This never belonged in CFLAGS/CXXFLAGS as it really is a preprocessor
flag. While not necessarily harmful, this can potentially cause software
not to build when it fails sanity checks (e.g. curl 7.29.0).

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
---
A similar change will be wanted for core/pacman's makepkg.conf.

 makepkg-i686.conf   | 5 +++--
 makepkg-x86_64.conf | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)
Dave Reisner - Feb. 6, 2013, 5:10 p.m.
On Wed, Feb 06, 2013 at 12:06:30PM -0500, Dave Reisner wrote:
> This never belonged in CFLAGS/CXXFLAGS as it really is a preprocessor
> flag. While not necessarily harmful, this can potentially cause software
> not to build when it fails sanity checks (e.g. curl 7.29.0).
> 
> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
> ---

Damn. this doesn't actually work until pacman 4.1 because makepkg
doesn't export CPPFLAGS from makepkg.conf in 4.0.3.

> A similar change will be wanted for core/pacman's makepkg.conf.
> 
>  makepkg-i686.conf   | 5 +++--
>  makepkg-x86_64.conf | 5 +++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/makepkg-i686.conf b/makepkg-i686.conf
> index 725c2a2..2104f67 100644
> --- a/makepkg-i686.conf
> +++ b/makepkg-i686.conf
> @@ -29,8 +29,9 @@ CHOST="i686-pc-linux-gnu"
>  #-- Compiler and Linker Flags
>  # -march (or -mcpu) builds exclusively for an architecture
>  # -mtune optimizes for an architecture, but builds for whole processor family
> -CFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2"
> -CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2"
> +CPPFLAGS="-D_FORTIFY_SOURCE=2"
> +CFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
> +CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
>  LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
>  #-- Make Flags: change this for DistCC/SMP systems
>  #MAKEFLAGS="-j2"
> diff --git a/makepkg-x86_64.conf b/makepkg-x86_64.conf
> index 4de5c67..214c8fe 100644
> --- a/makepkg-x86_64.conf
> +++ b/makepkg-x86_64.conf
> @@ -29,8 +29,9 @@ CHOST="x86_64-unknown-linux-gnu"
>  #-- Compiler and Linker Flags
>  # -march (or -mcpu) builds exclusively for an architecture
>  # -mtune optimizes for an architecture, but builds for whole processor family
> -CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2"
> -CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2"
> +CPPFLAGS="-D_FORTIFY_SOURCE=2"
> +CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
> +CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
>  LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
>  #-- Make Flags: change this for DistCC/SMP systems
>  #MAKEFLAGS="-j2"
> -- 
> 1.8.1.2
>
Pierre Schmitz - March 10, 2013, 9:04 a.m.
Am 06.02.2013 18:06, schrieb Dave Reisner:
> This never belonged in CFLAGS/CXXFLAGS as it really is a preprocessor
> flag. While not necessarily harmful, this can potentially cause software
> not to build when it fails sanity checks (e.g. curl 7.29.0).

I'll add these flags once they are set in the default makepkg.conf that
ships with pacman.

Patch

diff --git a/makepkg-i686.conf b/makepkg-i686.conf
index 725c2a2..2104f67 100644
--- a/makepkg-i686.conf
+++ b/makepkg-i686.conf
@@ -29,8 +29,9 @@  CHOST="i686-pc-linux-gnu"
 #-- Compiler and Linker Flags
 # -march (or -mcpu) builds exclusively for an architecture
 # -mtune optimizes for an architecture, but builds for whole processor family
-CFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2"
-CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2"
+CPPFLAGS="-D_FORTIFY_SOURCE=2"
+CFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
+CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
 LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
 #-- Make Flags: change this for DistCC/SMP systems
 #MAKEFLAGS="-j2"
diff --git a/makepkg-x86_64.conf b/makepkg-x86_64.conf
index 4de5c67..214c8fe 100644
--- a/makepkg-x86_64.conf
+++ b/makepkg-x86_64.conf
@@ -29,8 +29,9 @@  CHOST="x86_64-unknown-linux-gnu"
 #-- Compiler and Linker Flags
 # -march (or -mcpu) builds exclusively for an architecture
 # -mtune optimizes for an architecture, but builds for whole processor family
-CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2"
-CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2"
+CPPFLAGS="-D_FORTIFY_SOURCE=2"
+CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
+CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4"
 LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro"
 #-- Make Flags: change this for DistCC/SMP systems
 #MAKEFLAGS="-j2"