1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-11 02:50:24 +00:00
freebsd-ports/Mk/Uses/dos2unix.mk
Mathieu Arnold e8796ef612 Rewrite the target ordering code.
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
2015-08-17 13:31:25 +00:00

40 lines
1.1 KiB
Makefile

# $FreeBSD$
#
# Provide support to convert files from dos2unix
#
# DOS2UNIX_REGEX a regular expression to match files that needs to be converted
# DOS2UNIX_FILES list of files of glob pattern relative to ${WRKSRC}
# DOS2UNIX_GLOB list of glob pattern find(1) will match with
#
# MAINTAINER: portmgr@FreeBSD.org
.if !defined(_INCLUDE_USES_DOS2UNIX_MK)
_INCLUDE_USES_DOS2UNIX_MK= yes
.if !defined(DOS2UNIX_FILES) && !defined(DOS2UNIX_REGEX) && !defined(DOS2UNIX_GLOB)
_DOS2UNIX_ALL= yes
.endif
_USES_patch+= 200:dos2unix
dos2unix:
@${ECHO_MSG} "===> Converting DOS text files to UNIX text files"
.if defined(_DOS2UNIX_ALL)
@${FIND} ${WRKSRC} -type f -print0 | \
${XARGS} -0 ${SED} -i '' -e 's/
$$//'
.else
.if defined(DOS2UNIX_FILES)
@(cd ${WRKSRC}; \
${ECHO_CMD} ${DOS2UNIX_FILES} | ${XARGS} ${SED} -i '' -e 's/
$$//' )
.elif defined(DOS2UNIX_REGEX)
@${FIND} -E ${WRKSRC} -type f -iregex '${DOS2UNIX_REGEX}' -print0 | \
${XARGS} -0 ${SED} -i '' -e 's/
$$//'
.else
.for f in ${DOS2UNIX_GLOB}
@${FIND} ${WRKSRC} -type f -name '${f}' -print0 | \
${XARGS} -0 ${SED} -i '' -e 's/
$$//'
.endfor
.endif
.endif
.endif