3 # Provide support to convert files from dos2unix
5 # DOS2UNIX_REGEX a regular expression to match files that needs to be converted
6 # DOS2UNIX_FILES list of files of glob pattern relative to ${WRKSRC}
7 # DOS2UNIX_GLOB list of glob pattern find(1) will match with
8 # DOS2UNIX_WRKSRC top-level path for directory traversal instead of ${WRKSRC}
10 # MAINTAINER: portmgr@FreeBSD.org
12 .if !defined(_INCLUDE_USES_DOS2UNIX_MK)
13 _INCLUDE_USES_DOS2UNIX_MK= yes
15 .if !defined(DOS2UNIX_FILES) && !defined(DOS2UNIX_REGEX) && !defined(DOS2UNIX_GLOB)
19 DOS2UNIX_WRKSRC?= ${WRKSRC}
21 _USES_patch+= 200:dos2unix
23 @${ECHO_MSG} "===> Converting DOS text files to UNIX text files"
24 .if defined(_DOS2UNIX_ALL)
25 @${FIND} ${DOS2UNIX_WRKSRC} -type f -print0 | \
26 ${XARGS} -0 ${SED} -i '' -e 's/
\r$$//'
28 .if defined(DOS2UNIX_FILES)
29 @(cd ${DOS2UNIX_WRKSRC}; \
30 ${ECHO_CMD} ${DOS2UNIX_FILES} | ${XARGS} ${SED} -i '' -e 's/
\r$$//' )
31 .elif defined(DOS2UNIX_REGEX)
32 @${FIND} -E ${DOS2UNIX_WRKSRC} -type f -iregex '${DOS2UNIX_REGEX}' -print0 | \
33 ${XARGS} -0 ${SED} -i '' -e 's/
\r$$//'
35 .for f in ${DOS2UNIX_GLOB}
36 @${FIND} ${DOS2UNIX_WRKSRC} -type f -name '${f}' -print0 | \
37 ${XARGS} -0 ${SED} -i '' -e 's/
\r$$//'