Index: Mk/Uses/shebangfix.mk =================================================================== --- Mk/Uses/shebangfix.mk +++ Mk/Uses/shebangfix.mk @@ -35,11 +35,14 @@ java_CMD?= ${LOCALBASE}/bin/java ksh_OLD_CMD?= /bin/ksh ksh_CMD?= ${LOCALBASE}/bin/ksh -perl_OLD_CMD?= /usr/bin/perl +perl_OLD_CMD?= /usr/bin/perl \ + "/usr/bin/env perl" \ + perl perl_CMD?= ${LOCALBASE}/bin/perl php_OLD_CMD?= /usr/bin/php php_CMD?= ${LOCALBASE}/bin/php -python_OLD_CMD?= /usr/bin/python +python_OLD_CMD?= /usr/bin/python \ + "/usr/bin/env python" .if ${USES:Mpython*} python_CMD?= ${PYTHON_CMD} .else @@ -55,13 +58,15 @@ SHEBANG_LANG+= bash java ksh perl php python ruby tcl tk .for lang in ${SHEBANG_LANG} -.if !defined(${lang}_CMD) +. if !defined(${lang}_CMD) IGNORE+= missing definition for ${lang}_CMD -.endif -.if !defined(${lang}_OLD_CMD) +. endif +. if !defined(${lang}_OLD_CMD) IGNORE+= missing definition for ${lang}_OLD_CMD -.endif -_SHEBANG_REINPLACE_ARGS+= -e "1s|^\#![[:space:]]*${${lang}_OLD_CMD}|\#!${${lang}_CMD}|" +. endif +. for old_cmd in ${${lang}_OLD_CMD} +_SHEBANG_REINPLACE_ARGS+= -e "1s|^\#![[:space:]]*${old_cmd:C/\"//g}|\#!${${lang}_CMD}|" +. endfor .endfor _USES_patch+= 210:fix-shebang