[pacman-dev] [PATCH 2/2] makepkg: Add support for specifying LDFLAGS

Allan McRae allan at archlinux.org
Thu Jan 1 12:47:17 EST 2009


Provide support for specifying LDFLAGS within makepkg.conf but leaves
this undefined by default. Fixes FS#12542.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 doc/makepkg.conf.5.txt |    5 +++++
 etc/makepkg.conf.in    |    1 +
 scripts/makepkg.sh.in  |    4 ++--
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt
index 8b3665b..044c69e 100644
--- a/doc/makepkg.conf.5.txt
+++ b/doc/makepkg.conf.5.txt
@@ -61,6 +61,11 @@ Options
 **CXXFLAGS=**"cxxflags"::
 	Flags used for the C++ compiler; see CFLAGS for more info.
 
+**LDFLAGS=**"ldflags"::
+	Flags used for the linker. Several options may be specified with common
+	usage resembling ``-Wl,--hash-style=gnu``. Read ld(1) for more details on
+	available linker flags.
+
 **MAKEFLAGS=**"makeflags"::
 	This is often used to set the number of jobs used, for example, `-j2`.
 	Other flags that make accepts can also be passed.
diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in
index 9872d5d..675e5f9 100644
--- a/etc/makepkg.conf.in
+++ b/etc/makepkg.conf.in
@@ -31,6 +31,7 @@ CHOST="@CHOST@"
 # -mtune optimizes for an architecture, but builds for whole processor family
 CFLAGS="@CARCHFLAGS at -mtune=generic -O2 -pipe"
 CXXFLAGS="@CARCHFLAGS at -mtune=generic -O2 -pipe"
+#LDFLAGS=""
 #-- Make Flags: change this for DistCC/SMP systems
 #MAKEFLAGS="-j2"
 
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index eae2c31..66aaa5e 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -678,7 +678,7 @@ run_build() {
 	cd "$srcdir"
 
 	# ensure all necessary build variables are exported
-	export CFLAGS CXXFLAGS MAKEFLAGS CHOST
+	export CFLAGS CXXFLAGS MAKEFLAGS LDFLAGS CHOST
 	# save our shell options so build() can't override what we need
 	local shellopts=$(shopt -p)
 
@@ -730,7 +730,7 @@ run_package() {
 	cd "$srcdir"
 
 	# ensure all necessary build variables are exported
-	export CFLAGS CXXFLAGS MAKEFLAGS CHOST
+	export CFLAGS CXXFLAGS MAKEFLAGS LDFLAGS CHOST
 
 	local ret=0
 	if [ "$LOGGING" = "1" ]; then
-- 
1.6.1



More information about the pacman-dev mailing list