aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2017-10-15 23:30:20 +0800
committerjilles <jilles@FreeBSD.org>2017-10-15 23:30:20 +0800
commit839a4a00db3cbde470222b9f0abd5985a958decd (patch)
tree05985c009b1f52b85f11fc10a8f346b32ec58052 /Mk
parent11ac00d63aee0a7b2f7d98b474b76eb4113c550f (diff)
downloadfreebsd-ports-gnome-839a4a00db3cbde470222b9f0abd5985a958decd.tar.gz
freebsd-ports-gnome-839a4a00db3cbde470222b9f0abd5985a958decd.tar.zst
freebsd-ports-gnome-839a4a00db3cbde470222b9f0abd5985a958decd.zip
Make COPYTREE_* work with POSIX-compliant sh -c
The COPYTREE_BIN and COPYTREE_SHARE macros use constructs like sh -c 'command' -- arg0 arg1 and assume that $0 will expand to arg0 and $1 will expand to arg1. Our current sh implements it that way. However, POSIX specifies that $0 will expand to -- and $1 will expand to arg0, since the command string is an operand and not an option-argument. Bug #220587 requests making sh POSIX-compliant in this regard. If the argument after the command string does not start with '-', the current sh behaves as required by POSIX. Therefore, adjust the macros so this is always the case. PR: 222870 Approved by: portmgr (antoine)
Diffstat (limited to 'Mk')
-rw-r--r--Mk/bsd.port.mk12
1 files changed, 6 insertions, 6 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index f22f2091fb1f..88a35396a5dd 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -2150,12 +2150,12 @@ SCRIPTS_ENV+= ${INSTALL_MACROS}
# In the -exec shell commands, we add add a . as the first argument, it would
# end up being $0 aka the script name, which is not part of $@, so we force it
# to be able to use $@ directly.
-COPYTREE_BIN= ${SH} -c '(${FIND} -Ed $$0 $$2 | ${CPIO} -dumpl $$1 >/dev/null 2>&1) && \
- ${FIND} -Ed $$0 $$2 \( -type d -exec ${SH} -c '\''cd '\''$$1'\'' && chmod 755 "$$@"'\'' -- . {} + \
- -o -type f -exec ${SH} -c '\''cd '\''$$1'\'' && chmod ${BINMODE} "$$@"'\'' -- . {} + \)' --
-COPYTREE_SHARE= ${SH} -c '(${FIND} -Ed $$0 $$2 | ${CPIO} -dumpl $$1 >/dev/null 2>&1) && \
- ${FIND} -Ed $$0 $$2 \( -type d -exec ${SH} -c '\''cd '\''$$1'\'' && chmod 755 "$$@"'\'' -- . {} + \
- -o -type f -exec ${SH} -c '\''cd '\''$$1'\'' && chmod ${_SHAREMODE} "$$@"'\'' -- . {} + \)' --
+COPYTREE_BIN= ${SH} -c '(${FIND} -Ed $$1 $$3 | ${CPIO} -dumpl $$2 >/dev/null 2>&1) && \
+ ${FIND} -Ed $$1 $$3 \( -type d -exec ${SH} -c '\''cd '\''$$2'\'' && chmod 755 "$$@"'\'' . {} + \
+ -o -type f -exec ${SH} -c '\''cd '\''$$2'\'' && chmod ${BINMODE} "$$@"'\'' . {} + \)' COPYTREE_BIN
+COPYTREE_SHARE= ${SH} -c '(${FIND} -Ed $$1 $$3 | ${CPIO} -dumpl $$2 >/dev/null 2>&1) && \
+ ${FIND} -Ed $$1 $$3 \( -type d -exec ${SH} -c '\''cd '\''$$2'\'' && chmod 755 "$$@"'\'' . {} + \
+ -o -type f -exec ${SH} -c '\''cd '\''$$2'\'' && chmod ${_SHAREMODE} "$$@"'\'' . {} + \)' COPYTREE_SHARE
# The user can override the NO_PACKAGE by specifying this from
# the make command line