svn commit: r424566 - head/Mk/Uses

Mathieu Arnold mat at FreeBSD.org
Mon Oct 24 14:16:24 UTC 2016


Author: mat
Date: Mon Oct 24 14:16:23 2016
New Revision: 424566
URL: https://svnweb.freebsd.org/changeset/ports/424566

Log:
  Add SHEBANG_REGEX and SHEBANG_GLOB, similar as the DOS2UNIX ones.
  
  Sponsored by:	Absolight

Modified:
  head/Mk/Uses/shebangfix.mk

Modified: head/Mk/Uses/shebangfix.mk
==============================================================================
--- head/Mk/Uses/shebangfix.mk	Mon Oct 24 13:32:49 2016	(r424565)
+++ head/Mk/Uses/shebangfix.mk	Mon Oct 24 14:16:23 2016	(r424566)
@@ -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|^\#![[:
 
 _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


More information about the svn-ports-all mailing list