2 ms·
#!/bin/sh # https://git.kernel.org/pub/scm/utils/dash/dash.git/snapshot/dash-0.5.11.5.tar.gz # https://packages.debian.org/source/dash # tested: #
by 1vuio0pswjnm7 4y ago
#!/bin/sh
# https://git.kernel.org/pub/scm/utils/dash/dash.git/snapshot/dash-0.5.11.5.tar.gz
# https://packages.debian.org/source/dash
# tested:
# dash-debian-unstable.tar.gz
# dash-0.5.11.5.tar.gz
# dash_0.5.11+git20210903+057cd650a4ed.orig.tar.xz
# prerequisite: libedit
nm /usr/lib/libedit.a|grep -q T.ed_insert||exit
nm /usr/lib/libedit.a|grep -q T.rl_complete||exit
test $1||exec echo usage: $0 dash-source-dir
cd $1||exit
# compiling debian ash requires Perl and autotools
./autogen.sh
ed src/histedit.c << eof
134a
el_set(el,EL_BIND,"^I",tabcomplete?"rl-complete":"ed-insert",NULL);
.
117a
el_set(el,EL_SIGNAL,1);
el_set(el,EL_ADDFN,"rl-complete","readline compatible completion function",_el_fn_complete);
.
wq
eof
ed src/options.c << eof
103a
't',
.
83a
"tabcomplete",
.
wq
eof
ed src/options.h << eof
65c
#define NOPTS 18
.
63a
#definetabcomplete optlist[17]
.
wq
eof
./configure --with-libedit
make
# static linking for void linux
cd src||exit
gcc -static -Wall -g -O2 -o dash alias.o arith_yacc.o arith_yylex.o cd.o error.o eval.o exec.o expand.o histedit.o input.o jobs.o mail.o main.o memalloc.o miscbltin.o mystring.o options.o parser.o redir.o show.o trap.o output.o bltin/printf.o system.o bltin/test.o bltin/times.o var.o builtins.o init.o nodes.o signames.o syntax.o -ledit -lcurses
strip -s dash
readelf -d dash