makepkg: Add CPPFLAGS support

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@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Allan McRae 2011-12-22 20:19:18 +10:00 committed by Dan McGee
parent c4ea4e017f
commit 8abef73ba9
4 changed files with 10 additions and 6 deletions

View file

@ -254,10 +254,10 @@ A normal sync or upgrade will not use its value.
with distcc. with distcc.
*buildflags*;; *buildflags*;;
Allow the use of user-specific buildflags (CFLAGS, CXXFLAGS, LDFLAGS) Allow the use of user-specific buildflags (CPPFLAGS, CFLAGS, CXXFLAGS,
during build as specified in linkman:makepkg.conf[5]. More useful in LDFLAGS) during build as specified in linkman:makepkg.conf[5]. More
its negative form `!buildflags` with select packages that have problems useful in its negative form `!buildflags` with select packages that
building with custom buildflags. have problems building with custom buildflags.
*makeflags*;; *makeflags*;;
Allow the use of user-specific makeflags during build as specified Allow the use of user-specific makeflags during build as specified

View file

@ -51,6 +51,9 @@ Options
A string such as ``i686-pc-linux-gnu'', do not touch unless you know what 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. 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":: **CFLAGS=**"cflags"::
Flags used for the C compiler. This is a key part to the use of makepkg. 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 Usually several options are specified, and the most common string resembles

View file

@ -27,6 +27,7 @@ CARCH="@CARCH@"
CHOST="@CHOST@" CHOST="@CHOST@"
#-- Compiler and Linker Flags #-- Compiler and Linker Flags
#CPPFLAGS=""
#CFLAGS="-O2 -pipe" #CFLAGS="-O2 -pipe"
#CXXFLAGS="-O2 -pipe" #CXXFLAGS="-O2 -pipe"
#LDFLAGS="" #LDFLAGS=""

View file

@ -955,7 +955,7 @@ run_function() {
# clear user-specified buildflags if requested # clear user-specified buildflags if requested
if check_option "buildflags" "n"; then if check_option "buildflags" "n"; then
unset CFLAGS CXXFLAGS LDFLAGS unset CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
fi fi
# clear user-specified makeflags if requested # clear user-specified makeflags if requested
@ -967,7 +967,7 @@ run_function() {
cd_safe "$srcdir" cd_safe "$srcdir"
# ensure all necessary build variables are exported # 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 # save our shell options so pkgfunc() can't override what we need
local shellopts=$(shopt -p) local shellopts=$(shopt -p)