Add a blurb about changing CR/LF to LF to the patching section.

PR:		69086
Submitted by:	Alexey Dokuchaev <danfe@regency.nsu.ru> (mostly)
Reviewed by:	keramida
This commit is contained in:
Peter Pentchev 2004-08-09 11:51:37 +00:00
parent ce43b8c0f8
commit 038efbe67a
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=21877

View file

@ -669,6 +669,25 @@ PLIST_DIRS= lib/X11/oneko</programlisting>
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 the software being
ported, especially if it is primarily developed on &windows;, uses
the CR/LF convention for most of its source files. This may cause
problems with further patching, compiler warnings, scripts
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)" -print0 | \
${XARGS} -0 ${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