From owner-svn-ports-all@FreeBSD.ORG Mon Nov 18 12:58:12 2013 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 668DB5C5; Mon, 18 Nov 2013 12:58:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3DC5E2873; Mon, 18 Nov 2013 12:58:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rAICwC9I092592; Mon, 18 Nov 2013 12:58:12 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rAICwCV0092591; Mon, 18 Nov 2013 12:58:12 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201311181258.rAICwCV0092591@svn.freebsd.org> From: Baptiste Daroussin Date: Mon, 18 Nov 2013 12:58:12 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r334181 - 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.16 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, 18 Nov 2013 12:58:12 -0000 Author: bapt Date: Mon Nov 18 12:58:11 2013 New Revision: 334181 URL: http://svnweb.freebsd.org/changeset/ports/334181 Log: New USES=dos2unix It is intended to replace USE_DOS2UNIX By default it convert all the source files Use: DOS2UNIX_FILES= to convert files relative to ${WRKSRC} (globs allowed) DOS2UNIX_REGEX= To convert files matching the regex (using find -R -iregex) DOS2UNIX_GLOB= To convert files matching the glob pattern (using find -name) Added: head/Mk/Uses/dos2unix.mk (contents, props changed) Added: head/Mk/Uses/dos2unix.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/Mk/Uses/dos2unix.mk Mon Nov 18 12:58:11 2013 (r334181) @@ -0,0 +1,40 @@ +# $FreeBSD$ +# +# Provide support to convert files from dos2unix +# +# MAINTAINER: portmgr@FreeBSD.org +# +# DOS2UNIX_REGEX a regular expression to match files that needs to be converted +# DOS2UNIX_FILES list of files of glob pattern relative to ${WRKSRC} +# DOS2UNIX_GLOB list of glob pattern find(1) will match with + +.if !defined(_INCLUDE_USES_DOS2UNIX_MK) +_INCLUDE_USES_DOS2UNIX_MK= yes + +.if !defined(DOS2UNIX_FILES) && !defined(DOS2UNIX_REGEX) && !defined(DOS2UNIX_GLOB) +_DOS2UNIX_ALL= yes +.endif + +pre-patch: dos2unix + +dos2unix: + @${ECHO_MSG} "===> Converting DOS text files to UNIX text files" +.if defined(_DOS2UNIX_ALL) + @${FIND} ${WRKSRC} -type f -print0 | \ + ${XARGS} -0 ${SED} -i '' -e 's/ $$//' +.else +.if defined(DOS2UNIX_FILES) + @(cd ${WRKSRC}; \ + ${ECHO_CMD} ${DOS2UNIX_FILES} | ${XARGS} ${SED} -i '' -e 's/ $$//' ) +.elif defined(DOS2UNIX_REGEX) + @${FIND} -E ${WRKSRC} -type f -iregex '${DOS2UNIX_REGEX}' -print0 | \ + ${XARGS} -0 ${SED} -i '' -e 's/ $$//' +.else +.for f in ${DOS2UNIX_GLOB} + @${FIND} ${SRCSRC} -type f -name '${f}' -print0 | \ + ${XARGS} -0 ${SED} -i '' -e 's/ $$//' +.endfor +.endif +.endif + +.endif