e8796ef612
The targets now have priority assigned to them, and, when the dependency ordering magic is done at the end of bsd.port.mk, they are sorted according to their priority. This allows USES to add targets easily and have them run whenever they want without touching bsd.port.mk. To add a target that runs just before post-configure run, do: _USES_configure+= 695:my-post-configure my-post-configure: do something To fine tune when the target is ran, look at the values in the *_SEQ variables at the end of bsd.port.mk, and the other USES. Allow ports Makefiles to override the priority of targets with the TARGET_ORDER_OVERRIDE variable. For example, to get post-install running earlier, (its default is 700) do: TARGET_ORDER_OVERRIDE= 650:post-install While there, add options target helpers for the do-* targets when they exist. Reviewed by: antoine, bapt Exp-run by: antoine Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D3099
72 lines
1.8 KiB
Makefile
72 lines
1.8 KiB
Makefile
# $FreeBSD$
|
|
#
|
|
# Replace #! interpreters in scripts by what we actually have.
|
|
#
|
|
# Standard templates for bash, perl, python,... are included out of
|
|
# the box, others can easily be added per port.
|
|
#
|
|
# Feature: shebangfix
|
|
# Usage: USES=shebangfix
|
|
#
|
|
# To specify that ${WRKSRC}/path1/file and all .pl files in ${WRKSRC}/path2
|
|
# should be processed:
|
|
#
|
|
# SHEBANG_FILES= path1/file path2/*.pl
|
|
#
|
|
# To define a new shebang scheme add the following to the port Makefile:
|
|
#
|
|
# SHEBANG_LANG= lua
|
|
# lua_OLD_CMD= /usr/bin/lua
|
|
# lua_CMD= ${LOCALBASE}/bin/lua
|
|
#
|
|
# To override a definition, for example replacing /usr/bin/perl by
|
|
# /usr/bin/env perl, add the following:
|
|
#
|
|
# perl_CMD= ${SETENV} perl
|
|
#
|
|
# MAINTAINER: portmgr@FreeBSD.org
|
|
|
|
.if !defined(_INCLUDE_USES_SHEBANGFIX_MK)
|
|
_INCLUDE_USES_SHEBANGFIX_MK= yes
|
|
|
|
bash_OLD_CMD?= /bin/bash
|
|
bash_CMD?= ${LOCALBASE}/bin/bash
|
|
java_OLD_CMD?= /usr/bin/java
|
|
java_CMD?= ${LOCALBASE}/bin/java
|
|
ksh_OLD_CMD?= /bin/ksh
|
|
ksh_CMD?= ${LOCALBASE}/bin/ksh
|
|
perl_OLD_CMD?= /usr/bin/perl
|
|
perl_CMD?= ${LOCALBASE}/bin/perl
|
|
php_OLD_CMD?= /usr/bin/php
|
|
php_CMD?= ${LOCALBASE}/bin/php
|
|
python_OLD_CMD?= /usr/bin/python
|
|
.if ${USES:Mpython*}
|
|
python_CMD?= ${PYTHON_CMD}
|
|
.else
|
|
python_CMD?= ${LOCALBASE}/bin/python
|
|
.endif
|
|
ruby_OLD_CMD?= /usr/bin/ruby
|
|
ruby_CMD?= ${LOCALBASE}/bin/ruby
|
|
tcl_OLD_CMD?= /usr/bin/tclsh
|
|
tcl_CMD?= ${TCLSH}
|
|
tk_OLD_CMD?= /usr/bin/wish
|
|
tk_CMD?= ${WISH}
|
|
|
|
SHEBANG_LANG+= bash java ksh perl php python ruby tcl tk
|
|
|
|
.for lang in ${SHEBANG_LANG}
|
|
.if !defined(${lang}_CMD)
|
|
IGNORE+= missing definition for ${lang}_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}|"
|
|
.endfor
|
|
|
|
_USES_patch+= 210:fix-shebang
|
|
fix-shebang:
|
|
@cd ${WRKSRC}; \
|
|
${ECHO_CMD} ${SHEBANG_FILES} | ${XARGS} ${SED} -i '' ${_SHEBANG_REINPLACE_ARGS}
|
|
|
|
.endif
|