summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2001-06-18 20:16:17 +0000
committerjlam <jlam@pkgsrc.org>2001-06-18 20:16:17 +0000
commitdfa7dc5495ad00b8dc32d59039ec78c69b47a687 (patch)
tree449254f9e1de1417dd1862196a9298164d7680f8 /mk
parent20f4a41c3d50045ebb28b99dd8f3b78c82275503 (diff)
downloadpkgsrc-dfa7dc5495ad00b8dc32d59039ec78c69b47a687.tar.gz
On some platforms, /bin/sh is feebler than NetBSD's /bin/sh with respect to
shell variable manipulation, e.g. ${parameter##word} and ${parameter%word}. Change instances such constructs to use ${DIRNAME} and ${SED} to make the same manipulations. This is the second part of pkg/13236 by Stoned Elipot <Stoned.Elipot@script.jussieu.fr> with minor changes by me. Also explictly create ${BUILDLINK_DIR} at start of _BUILDLINK_USE target to better handle NO_DEPENDS= cases.
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.buildlink.mk13
1 files changed, 9 insertions, 4 deletions
diff --git a/mk/bsd.buildlink.mk b/mk/bsd.buildlink.mk
index 404e133e61c..b4a78d8e8b9 100644
--- a/mk/bsd.buildlink.mk
+++ b/mk/bsd.buildlink.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink.mk,v 1.8 2001/06/18 05:07:40 jlam Exp $
+# $NetBSD: bsd.buildlink.mk,v 1.9 2001/06/18 20:16:17 jlam Exp $
#
# This Makefile fragment is included by package buildlink.mk files. This
# file does the following things:
@@ -100,14 +100,19 @@ _BUILDLINK_USE: .USE
cookie=${BUILDLINK_DIR}/.${.TARGET:S/-buildlink//}_buildlink_done; \
if [ ! -f $${cookie} ]; then \
${ECHO_MSG} "Linking ${.TARGET:S/-buildlink//} files into ${BUILDLINK_DIR}."; \
+ ${MKDIR} ${BUILDLINK_DIR}; \
for file in ${BUILDLINK_FILES.${.TARGET:S/-buildlink//}:S/^/${BUILDLINK_PREFIX.${.TARGET:S/-buildlink//}}\//g}; do \
+ rel_file=`${ECHO} $${file} | ${SED} -e "s|${BUILDLINK_PREFIX.${.TARGET:S/-buildlink//}}/||"` ; \
if [ -z "${BUILDLINK_TRANSFORM.${.TARGET:S/-buildlink//}:Q}" ]; then \
- dest=${BUILDLINK_DIR}/$${file##${BUILDLINK_PREFIX.${.TARGET:S/-buildlink//}}/}; \
+ dest=${BUILDLINK_DIR}/$${rel_file}; \
else \
- dest=`${ECHO} ${BUILDLINK_DIR}/$${file##${BUILDLINK_PREFIX.${.TARGET:S/-buildlink//}}/} | ${SED} ${BUILDLINK_TRANSFORM.${.TARGET:S/-buildlink//}}`; \
+ dest=`${ECHO} ${BUILDLINK_DIR}/$${rel_file} | ${SED} ${BUILDLINK_TRANSFORM.${.TARGET:S/-buildlink//}}`; \
fi; \
if [ -f $${file} ]; then \
- ${MKDIR} $${dest%/*}; \
+ dir=`${DIRNAME} $${dest}`; \
+ if [ ! -d $${dir} ]; then \
+ ${MKDIR} $${dir}; \
+ fi; \
${RM} -f $${dest}; \
${LN} -sf $${file} $${dest}; \
fi; \