Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Jul 2004 05:04:00 +0300
From:      Giorgos Keramidas <keramida@FreeBSD.org>
To:        Alexey Dokuchaev <danfe@regency.nsu.ru>, "David O'Brien" <obrien@FreeBSD.org>
Cc:        bug-followup@FreeBSD.org
Subject:   Re: docs/69086: Porters Handbook: How to convert from CR/LF to LF using REINPLACE_CMD
Message-ID:  <20040718020400.GA8280@gothmog.gr>
In-Reply-To: <200407150701.i6F714tO099473@regency.nsu.ru>
References:  <200407150701.i6F714tO099473@regency.nsu.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2004-07-15 14:01, Alexey Dokuchaev <danfe@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



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