Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Oct 2016 14:16:23 +0000 (UTC)
From:      Mathieu Arnold <mat@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r424566 - head/Mk/Uses
Message-ID:  <201610241416.u9OEGN52054747@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610241416.u9OEGN52054747>