1 # $NetBSD: install-sh-override.mk,v 1.1 2007/07/12 18:59:15 jlam Exp $
3 ######################################################################
4 ### install-sh-override (PRIVATE)
5 ######################################################################
6 ### install-sh-override replace any existing install-sh under
7 ### ${WRKSRC} with the version from sysutils/install-sh, which works
8 ### on all pkgsrc platforms, in particular Interix.
10 do-configure-pre-hook: install-sh-override
12 OVERRIDE_DIRDEPTH.install-sh?= ${OVERRIDE_DIRDEPTH}
14 _SCRIPT.install-sh-override= \
16 ${SED} -e "s|@DEFAULT_INSTALL_MODE@|${PKGDIRMODE}|g" \
17 ${PKGSRCDIR}/sysutils/install-sh/files/install-sh.in \
21 .PHONY: install-sh-override
23 @${STEP_MSG} "Replacing install-sh with pkgsrc version"
24 .if defined(INSTALL_SH_OVERRIDE) && !empty(INSTALL_SH_OVERRIDE)
27 set -- dummy ${INSTALL_SH_OVERRIDE}; shift; \
28 while [ $$# -gt 0 ]; do \
30 [ -f "$$file" ] || [ -h "$$file" ] || continue; \
31 ${_SCRIPT.${.TARGET}}; \
36 depth=0; pattern=install-sh; \
37 while [ $$depth -le ${OVERRIDE_DIRDEPTH.install-sh} ]; do \
38 for file in $$pattern; do \
39 [ -f "$$file" ] || [ -h "$$file" ] || continue; \
40 ${_SCRIPT.${.TARGET}}; \
42 depth=`${EXPR} $$depth + 1`; pattern="*/$$pattern"; \