summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorkhorben <khorben>2016-03-13 15:32:06 +0000
committerkhorben <khorben>2016-03-13 15:32:06 +0000
commitf524f5d82fb55d2a80a4a91269ec0b66d0b3b23b (patch)
tree03e284e492c84da1e66da01f3279913bfda4f4ac /mk
parente8a0aaaff0c43e6a8a0b8d91b9461d2464125379 (diff)
downloadpkgsrc-f524f5d82fb55d2a80a4a91269ec0b66d0b3b23b.tar.gz
Also determine when compiling from source files
This allows fixing an issue with PKGSRC_MKPIE, where "gcc source.c" would not work. Some packages rely on this test to determine if a working compiler is available.
Diffstat (limited to 'mk')
-rw-r--r--mk/wrapper/arg-source12
-rw-r--r--mk/wrapper/cmd-sink-mkpie-gcc8
2 files changed, 16 insertions, 4 deletions
diff --git a/mk/wrapper/arg-source b/mk/wrapper/arg-source
index 476de2de56b..803f5deddcd 100644
--- a/mk/wrapper/arg-source
+++ b/mk/wrapper/arg-source
@@ -1,4 +1,4 @@
-# $NetBSD: arg-source,v 1.17 2016/03/11 23:03:31 khorben Exp $
+# $NetBSD: arg-source,v 1.18 2016/03/13 15:32:06 khorben Exp $
#
# Copyright (c) 2004 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -171,6 +171,16 @@ while $test $# -gt 0; do
$debug_log $wrapperlog " (arg-source) push: $arg"
;;
##############################################################
+ # Determine if we are compiling anything from source.
+ ##############################################################
+ *.C|*.CPP|*.c|*.c++|*.cc|*.cp|*.cpp|*.cxx|*.go|\
+ *.H|*.HPP|*.h|*.h++|*.hh|*.hp|*.hpp|*.hxx|*.i|*.ii|\
+ *.M|*.m|*.mi|*.mii|*.mm|*.S|*.s|*.sx|*.tcc)
+ has_source=yes
+ append_queue argbuf "$arg"
+ $debug_log $wrapperlog " (arg-source) push: $arg"
+ ;;
+ ##############################################################
# For everything else, just queue it up.
##############################################################
*)
diff --git a/mk/wrapper/cmd-sink-mkpie-gcc b/mk/wrapper/cmd-sink-mkpie-gcc
index 8a1ed864d6d..288187a6bcb 100644
--- a/mk/wrapper/cmd-sink-mkpie-gcc
+++ b/mk/wrapper/cmd-sink-mkpie-gcc
@@ -1,4 +1,4 @@
-# $NetBSD: cmd-sink-mkpie-gcc,v 1.1 2016/03/11 23:03:31 khorben Exp $
+# $NetBSD: cmd-sink-mkpie-gcc,v 1.2 2016/03/13 15:32:06 khorben Exp $
#
# Copyright (c) 2016 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -39,8 +39,10 @@ done
# Append any optional flags required when linking binaries.
if $test "$dont_link_binary" != "yes"; then
- # XXX obtain these flags from _MKPIE_LDFLAGS.gcc
- for arg in -pie; do
+ # XXX obtain these flags from _MKPIE_LDFLAGS.gcc and _MKPIE_CFLAGS.gcc
+ MKPIE_FLAGS="-pie"
+ $test "$has_source" = "yes" && MKPIE_FLAGS="-fPIC $MKPIE_FLAGS"
+ for arg in $MKPIE_FLAGS; do
$debug_log $wrapperlog " (cmd-sink-mkpie-gcc) pop: $arg"
. $buildcmd
done