summaryrefslogtreecommitdiffstats
path: root/patches/01_convert_ed_to_sed.patch
blob: 7f2c92c6cbc68b290f905d1a65e41d3fd789838f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Author: Patrick McDermott <patrick.mcdermott@libiquity.com>
Subject: Convert bc/fix-libmath_h to use sed

bc/libmath.h (the compiled byte code form of bc/libmath.b) is no longer
distributed by upstream.  This causes it to be compiled with a temporary build
of bc and compiled into a C header with bc/fix-libmath_h, a shell script that
runs ed.  BusyBox ed bails on these commands:

	"libmath.h", 47 lines, 2655 chars
	: ed: no substitutions found for "^"
	: ed: no substitutions found for "$"
	: : : ed: no substitutions found for ",$"
	: "libmath.h", 46 lines, 2652 chars
	: Really quit?

So instead, convert the script to use sed.

diff -Naurp src.orig/bc/fix-libmath_h src/bc/fix-libmath_h
--- src.orig/bc/fix-libmath_h	2017-04-07 18:20:02.000000000 -0400
+++ src/bc/fix-libmath_h	2019-06-23 15:43:12.264276574 -0400
@@ -1,9 +1,7 @@
-ed libmath.h <<EOS-EOS
+mv libmath.h libmath.h.orig
+sed '
 1,1s/^/{"/
-1,\$s/\$/",/
-2,\$s/^/"/
-\$,\$d
-\$,\$s/,\$/,0}/
-w
-q
-EOS-EOS
+1,$s/$/",/
+2,$s/^/"/
+$,$s/^.*$/0}/
+' libmath.h.orig >libmath.h