From 038efbe67ab7d26b59e5106bee9264aaaff10da3 Mon Sep 17 00:00:00 2001 From: Peter Pentchev Date: Mon, 9 Aug 2004 11:51:37 +0000 Subject: [PATCH] Add a blurb about changing CR/LF to LF to the patching section. PR: 69086 Submitted by: Alexey Dokuchaev (mostly) Reviewed by: keramida --- .../books/porters-handbook/book.sgml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/en_US.ISO8859-1/books/porters-handbook/book.sgml b/en_US.ISO8859-1/books/porters-handbook/book.sgml index 234b24b80a..2f615e46f1 100644 --- a/en_US.ISO8859-1/books/porters-handbook/book.sgml +++ b/en_US.ISO8859-1/books/porters-handbook/book.sgml @@ -669,6 +669,25 @@ PLIST_DIRS= lib/X11/oneko lines!); define USE_AUTOCONF_VER=213 and take the diffs of configure.in. + 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 (/bin/sh^M not found), etc. To + quickly convert those files from CR/LF to just LF, you can do + something like this: + + USE_REINPLACE= yes + +post-extract: + @${FIND} -E ${WRKDIR} -type f -iregex ".*\.(c|cpp|h|txt)" -print0 | \ + ${XARGS} -0 ${REINPLACE_CMD} -e 's/[[:cntrl:]]*$$//' '{}' \; + + Of course, if you need to process each and every file, + above can be omitted. Be aware that this + piece of code will strip all trailing control characters from each + line of processed file (except \n). + Also, if you had to delete a file, then you can do it in the post-extract target rather than as part of the patch. Once you are happy with the resulting diff, please split