pkgsrc/regress/tools-platform/zzz-prepare-tools.mk
rillig 063bbedf6b regress: add tools-platform/ for testing the platform tools
Right now, the tests in regress/tools are a mixture of testing the pkgsrc
infrastructure in mk/tools and the tools provided by the platforms.
These don't go well together, therefore the tests for the platform tools
will be migrated here.
2020-05-01 18:37:59 +00:00

40 lines
1 KiB
Makefile

# $NetBSD: zzz-prepare-tools.mk,v 1.1 2020/05/01 18:37:59 rillig Exp $
#
# This "package" creates wrappers for the platform tools in a temporary
# directory.
#
PKGNAME= tools-platform-2020.05.01
CATEGORIES= pkgtools
USE_TOOLS= chmod sed sh tr
.include "../../mk/bsd.prefs.mk"
PLATFORM_TOOLS!= \
${SED} -n \
's,^TOOLS_PLATFORM\.\([^[:space:]]*\)[?]=.*,\1,p' \
../../mk/tools/tools.*.mk
prepare-platform-tools:
.for tool in ${PLATFORM_TOOLS:O:u}
. if ${TOOLS_PLATFORM.${tool}:U} && ${TOOLS_PLATFORM.${tool}:[#]} == 1
. for cmd in ${TOOLS_PLATFORM.${tool}}
. if ${cmd:M/*}
@ln -s ${cmd:Q} ${BINDIR:Q}/${tool:Q}
. elif ${cmd} == "[" || ${cmd:Necho:Nfalse:Ntest:Ntrue} != ${cmd}
# ignore these shell builtins
. else
@${ECHO} "Skipping single-word tool "${tool:Q}": "${cmd:Q}
. endif
. endfor
. elif ${TOOLS_PLATFORM.${tool}:U}
@{ \
${ECHO} '#! '${SH:Q}; \
${ECHO} 'exec '${TOOLS_PLATFORM.${tool}:Q}' "$$@"'; \
} > ${BINDIR:Q}/${tool:Q}
@${CHMOD} +x ${BINDIR:Q}/${tool:Q}
. endif
.endfor
.include "../../mk/bsd.pkg.mk"