Matthias Apitz schrieb am Mittwoch, den 05. August 2015:

> I digged into this and the reason is in the source tree of mutt itself.
> 
> The option (...) strings get punched into a file conststrings.c and if you 
> build mutt
> with 'make' it gives an error due to a gmake'ish construct in the Makefile /
> Makefile.in:
> 
> # make conststrings.c 
> cc -I/usr/local/include -o txt2c 
> cc: error: no input files
> *** Error code 1 (ignored)
> (  cc -I/usr/local/include -v ||  cc -I/usr/local/include --version ||
> cc -I/usr/local/include -V ||  echo "unknown compiler";  ) 2>&1 |
> ./txt2c.sh cc_version >conststrings_c
> echo "-pipe   -DLIBICONV_PLUG -g -fno-strict-aliasing" | ./txt2c.sh
> cc_cflags >>conststrings_c
> grep ac_cs_config= config.status |  cut -d= -f2- |  sed -e 's/^"//' -e
> 's/"$//' | ./txt2c.sh configure_options >>conststrings_c
> mv -f conststrings_c conststrings.c
> 
> i.e. because it can not build txt2c from txt2c.c it falles back to use
> some shell script txt2c.sh; this, in turn, has another error: it
> contains a sed pipeline and among others it does (here as an example
> with some string):
> 
> $ echo "FreeBSD is the better system" | sed -e 's/\t/\\t/'g -e 's/\r/\\r/g'
> F\reeBSD is \the be\t\te\r sys\tem
> 
> The workaround is to make mutt with gmake (the default on Linux);
> 
> The bugs should be fixed im mutt, ofc.

Yeah, the sed script is not portable. Better to replace it by perl 
(patch attached)

regards,
Christian
diff --git a/txt2c.sh b/txt2c.sh
--- a/txt2c.sh
+++ b/txt2c.sh
@@ -10,15 +10,14 @@ txt2c_fallback () {
 	# or odd-looking sequences.  The result is a sequence of quote-bounded
 	# C strings, which the compiler concatenates into a single C string.
 	tr -c '\011\012\015\040[!-~]' '?' |
-	sed \
-	    -e 's/\\/\\\\/g' \
-	    -e 's/"/\\"/g' \
-	    -e 's/??/\?\?/g' \
-	    -e 's/\t/\\t/'g \
-	    -e 's/\r/\\r/g' \
-	    -e 's/^/	"/g' \
-	    -e 's/$/\\n"/g'
-	echo ";"
+	perl -p \
+	    -e 's/\\/\\\\/g;' \
+	    -e 's/\t/\\t/g;' \
+	    -e 's/\r/\\r/g;' \
+	    -e 's/"/\\"/g;' \
+	    -e 's/^/	\"/g;' \
+	    -e 's/$/\\n\"/;'
+	echo "; /* generated by txt2c.sh */"
 }
 
 ./txt2c test </dev/null >/dev/null 2>&1 &&

Reply via email to