termux-packages/packages/dash/mktokens.patch

51 lines
1.4 KiB
Diff
Raw Normal View History

On-device build support.
diff -uNr dash-0.5.10.2/src/mktokens dash-0.5.10.2.mod/src/mktokens
--- dash-0.5.10.2/src/mktokens 2014-09-28 11:19:32.000000000 +0300
2019-08-16 02:07:02 +02:00
+++ dash-0.5.10.2.mod/src/mktokens 2019-08-16 03:05:06.422193420 +0300
@@ -37,7 +37,7 @@
# token marks the end of a list. The third column is the name to print in
# error messages.
2019-08-16 02:07:02 +02:00
-cat > /tmp/ka$$ <<\!
+cat > ${TMPDIR:-/tmp}/ka$$ <<\!
TEOF 1 end of file
TNL 0 newline
TSEMI 0 ";"
@@ -68,28 +68,28 @@
TBEGIN 0 "{"
TEND 1 "}"
!
-nl=`wc -l /tmp/ka$$`
+nl=`wc -l ${TMPDIR:-/tmp}/ka$$`
exec > token.h
-awk '{print "#define " $1 " " NR-1}' /tmp/ka$$
+awk '{print "#define " $1 " " NR-1}' ${TMPDIR:-/tmp}/ka$$
2019-08-16 02:07:02 +02:00
exec > token_vars.h
2019-08-16 02:07:02 +02:00
echo '
/* Array indicating which tokens mark the end of a list */
static const char tokendlist[] = {'
-awk '{print "\t" $2 ","}' /tmp/ka$$
+awk '{print "\t" $2 ","}' ${TMPDIR:-/tmp}/ka$$
echo '};
2019-08-16 02:07:02 +02:00
static const char *const tokname[] = {'
sed -e 's/"/\\"/g' \
-e 's/[^ ]*[ ][ ]*[^ ]*[ ][ ]*\(.*\)/ "\1",/' \
- /tmp/ka$$
+ ${TMPDIR:-/tmp}/ka$$
echo '};
'
-sed 's/"//g' /tmp/ka$$ | awk '
2019-08-16 02:07:02 +02:00
-/TNOT/{print "#define KWDOFFSET " NR-1; print "";
+sed 's/"//g' ${TMPDIR:-/tmp}/ka$$ | awk '
+/TNOT/{print "#define KWDOFFSET " NR-1; print "";
print "static const char *const parsekwd[] = {"}
/TNOT/,/neverfound/{if (last) print " \"" last "\","; last = $3}
END{print " \"" last "\"\n};"}'
2019-08-16 02:07:02 +02:00
-rm /tmp/ka$$
+rm ${TMPDIR:-/tmp}/ka$$