diff options
author | Mathieu Arnold <mat@FreeBSD.org> | 2016-10-24 14:16:23 +0000 |
---|---|---|
committer | Mathieu Arnold <mat@FreeBSD.org> | 2016-10-24 14:16:23 +0000 |
commit | 39dc010c7607ee89b5b9056fc5299231d2bf1f81 (patch) | |
tree | 7e3b2c3fb317e61670b7531df0e4bf3cb2333853 /Mk | |
parent | 97528df8e1d4bec23b224edddb51c9933a8f7b78 (diff) | |
download | ports-39dc010c7607ee89b5b9056fc5299231d2bf1f81.tar.gz ports-39dc010c7607ee89b5b9056fc5299231d2bf1f81.zip |
Add SHEBANG_REGEX and SHEBANG_GLOB, similar as the DOS2UNIX ones.
Sponsored by: Absolight
Notes
Notes:
svn path=/head/; revision=424566
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/Uses/shebangfix.mk | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Mk/Uses/shebangfix.mk b/Mk/Uses/shebangfix.mk index 520cec286c90..670bfa00106a 100644 --- a/Mk/Uses/shebangfix.mk +++ b/Mk/Uses/shebangfix.mk @@ -8,6 +8,10 @@ # Feature: shebangfix # Usage: USES=shebangfix # +# SHEBANG_REGEX a regular expression to match files that needs to be converted +# SHEBANG_FILES list of files or glob pattern relative to ${WRKSRC} +# SHEBANG_GLOB list of glob pattern find(1) will match with +# # To specify that ${WRKSRC}/path1/file and all .pl files in ${WRKSRC}/path2 # should be processed: # @@ -75,7 +79,19 @@ _SHEBANG_REINPLACE_ARGS+= -e "1s|^\#![[:space:]]*${old_cmd:C/\"//g}$$|\#!${${lan _USES_patch+= 210:fix-shebang fix-shebang: +.if defined(SHEBANG_REGEX) + @cd ${WRKSRC}; \ + ${FIND} -E . -type f -iregex '${SHEBANG_REGEX}' \ + -exec ${SED} -i '' ${_SHEBANG_REINPLACE_ARGS} {} + +.elif defined(SHEBANG_GLOB) +.for f in ${SHEBANG_GLOB} + @cd ${WRKSRC}; \ + ${FIND} . -type f -name '${f}' \ + -exec ${SED} -i '' ${_SHEBANG_REINPLACE_ARGS} {} + +.endfor +.else @cd ${WRKSRC}; \ ${ECHO_CMD} ${SHEBANG_FILES} | ${XARGS} ${SED} -i '' ${_SHEBANG_REINPLACE_ARGS} +.endif .endif |