docs/69086: Porters Handbook: How to convert from CR/LF to LF using REINPLACE_CMD

Giorgos Keramidas keramida at FreeBSD.org
Sun Jul 18 02:10:27 UTC 2004


The following reply was made to PR docs/69086; it has been noted by GNATS.

From: Giorgos Keramidas <keramida at FreeBSD.org>
To: Alexey Dokuchaev <danfe at regency.nsu.ru>,
	"David O'Brien" <obrien at FreeBSD.org>
Cc: bug-followup at FreeBSD.org, freebsd-ports at FreeBSD.org
Subject: Re: docs/69086: Porters Handbook: How to convert from CR/LF to LF using REINPLACE_CMD
Date: Sun, 18 Jul 2004 05:04:00 +0300

 On 2004-07-15 14:01, Alexey Dokuchaev <danfe at regency.nsu.ru> wrote:
 > I therefore suggest including this in Porter's Handbook, as in
 > attached patch.
 
 This looks like a very nice way to filter the sources to me.  I'm not
 very experienced with the way our ports system works though.
 
 Do the people on freebsd-ports agree about this change?  In particular,
 since he seems to be the most active ports committer that updates the
 porters-handbook, does David O'Brien agree with this addition?
 
 > Index: book.sgml
 > ===================================================================
 > RCS file: /home/pub/ftp/pub/FreeBSD/development/FreeBSD-CVS//doc/en_US.ISO8859-1/books/porters-handbook/book.sgml,v
 > retrieving revision 1.461
 > diff -u -r1.461 book.sgml
 > --- book.sgml	12 Jul 2004 08:24:15 -0000	1.461
 > +++ book.sgml	15 Jul 2004 06:55:26 -0000
 > @@ -681,6 +681,24 @@
 >  	  lines!); define <literal>USE_AUTOCONF_VER=213</literal> and take the
 >  	  diffs of <filename>configure.in</filename>.</para>
 >  
 > +	<para>Quite often, there is a situation when ported software, being
 > +	  primarily developed on Windows, uses CR/LF convention for most of its
 > +	  source files.  This may cause problems with further patching, compiler
 > +	  warnings, scipts execution (<command>/bin/sh^M</command> not found),
 > +	  etc.  To quickly convert those files from CR/LF to just LF, you can do
 > +	  something like this:</para>
 > +
 > +	<programlisting>USE_REINPLACE=	yes
 > +
 > +post-extract:
 > +	@${FIND} -E ${WRKDIR} -type f -iregex ".*\.(c|cpp|h|txt)" \
 > +		-exec ${REINPLACE_CMD} -e 's/[[:cntrl:]]*$$//' '{}' \;</programlisting>
 > +
 > +	<para>Of course, if you need to process each and every file,
 > +	  <option>-iregex</option> above can be omitted.  Be aware that this
 > +	  piece of code will strip all trailing control characters from each
 > +	  line of processed file (except <literal>\n</literal>).</para>
 > +
 >  	<para>Also, if you had to delete a file, then you can do it in the
 >  	  <maketarget>post-extract</maketarget> target rather than as part of
 >  	  the patch.  Once you are happy with the resulting diff, please split



More information about the freebsd-doc mailing list