Browse Source

dash: fix hardcoded /tmp in `mktokens` to allow on-device build

emacs-27
Leonid Plyushch 5 years ago
parent
commit
adf81a0c34
No known key found for this signature in database GPG Key ID: 45F2964132545795
  1. 6
      packages/dash/build.sh
  2. 50
      packages/dash/mktokens.patch

6
packages/dash/build.sh

@ -9,8 +9,6 @@ TERMUX_PKG_ESSENTIAL=true
termux_step_post_make_install() {
# Symlink sh -> dash
cd $TERMUX_PREFIX/bin
ln -sf dash sh
cd $TERMUX_PREFIX/share/man/man1
ln -sf dash.1 sh.1
ln -sfr $TERMUX_PREFIX/bin/{dash,sh}
ln -sfr $TERMUX_PREFIX/share/man/man1/{dash,sh}.1
}

50
packages/dash/mktokens.patch

@ -0,0 +1,50 @@
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
+++ dash-0.5.10.2.mod/src/mktokens 2019-08-16 02:59:56.353262055 +0300
@@ -37,7 +37,7 @@
# token marks the end of a list. The third column is the name to print in
# error messages.
-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$$
exec > token_vars.h
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 '};
static const char *const tokname[] = {'
sed -e 's/"/\\"/g' \
-e 's/[^ ]*[ ][ ]*[^ ]*[ ][ ]*\(.*\)/ "\1",/' \
- /tmp/ka$$
+ ${TMPDIR:-/tmp}/ka$$
echo '};
'
-sed 's/"//g' /tmp/ka$$ | awk '
-/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};"}'
-rm /tmp/ka$$
+rm ${TMPDIR:-/tmp}/ka$$
Loading…
Cancel
Save