diff options
author | khorben <khorben@pkgsrc.org> | 2016-03-13 15:32:06 +0000 |
---|---|---|
committer | khorben <khorben@pkgsrc.org> | 2016-03-13 15:32:06 +0000 |
commit | a519369468bfa4341ba8ce2d3518312a69fb6a49 (patch) | |
tree | 03e284e492c84da1e66da01f3279913bfda4f4ac /mk | |
parent | 34cad8ba74da9b21f64c6fe7037fbcf4931c1b4b (diff) | |
download | pkgsrc-a519369468bfa4341ba8ce2d3518312a69fb6a49.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-source | 12 | ||||
-rw-r--r-- | mk/wrapper/cmd-sink-mkpie-gcc | 8 |
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 |