From owner-svn-ports-all@freebsd.org Mon Oct 24 14:16:24 2016 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75BCDC1FE2A; Mon, 24 Oct 2016 14:16:24 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47B535E3; Mon, 24 Oct 2016 14:16:24 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9OEGN5o054748; Mon, 24 Oct 2016 14:16:23 GMT (envelope-from mat@FreeBSD.org) Received: (from mat@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9OEGN52054747; Mon, 24 Oct 2016 14:16:23 GMT (envelope-from mat@FreeBSD.org) Message-Id: <201610241416.u9OEGN52054747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mat set sender to mat@FreeBSD.org using -f From: Mathieu Arnold Date: Mon, 24 Oct 2016 14:16:23 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r424566 - head/Mk/Uses X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Oct 2016 14:16:24 -0000 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