1DOLLY 72PACKAGE libterminfo3REQUIRES HOST runtime@045# NetBSD's terminfo library from the netbsd-curses release, two lines fixed, for6# programs the cc package builds (-lterminfo): <term.h> and <termcap.h> over7# the terminal descriptions the library holds.8FROM /v0.1.4/Dollyfile-system-tools 7f6c86fcc73e544e7007646eba2718bbc4d43b7f0516d9558e2dc500b1a05a80910REQUIRES HEADER libc11REQUIRES TOOL ar12REQUIRES TOOL awk13REQUIRES TOOL cat14REQUIRES TOOL cc15REQUIRES TOOL cp16REQUIRES TOOL grep17REQUIRES TOOL make18REQUIRES TOOL sed19REQUIRES TOOL sh20REQUIRES TOOL tar2122SOURCE /v0.1.4/dist/static/tmux/terminfo.tar 02f16349f246ae130a95a41ef88a78aabf7d5374d6e962ce0520dd216274edbe /tmp/terminfo.tar23SLOP tar -xf /tmp/terminfo.tar -C /2425# tparm formats each number with %ld and hands it over as an int: undefined,26# and on wasm64 the other half of the long is whatever the stack held, so a27# cursor address came out as 94489280513;94489280515. onum takes the long it28# is given; the second line fails the build if upstream's text has moved.29SLOP sed -e 's/const char \*fmt, int num, size_t len/const char *fmt, long num, size_t len/' -e 's/onum(term, fmt, (int)val, olen)/onum(term, fmt, val, olen)/' /tmp/terminfo/libterminfo/tparm.c > /tmp/terminfo/tparm.c30SLOP cp /tmp/terminfo/tparm.c /tmp/terminfo/libterminfo/tparm.c31SLOP grep -q 'const char \*fmt, long num, size_t len' /tmp/terminfo/libterminfo/tparm.c && grep -q 'onum(term, fmt, val, olen)' /tmp/terminfo/libterminfo/tparm.c3233# tputs hands its int (*)(int) to a writer that calls it as int (*)(int, void *):34# a call through a pointer of another type, which a Wasm call traps on (zsh's35# prompt). An adapter, beside ospeed, calls it as what it is.36SLOP sed -e 's/^short ospeed;$/short ospeed; static int _ti_putc_one(int c, void *outc) { return ((int (*)(int))outc)(c); }/' -e 's/(int (\*)(int, void \*))(void \*)outc, NULL/_ti_putc_one, (void *)outc/' -e 's/(int (\*)(int, void \*))(void \*)putchar, NULL/_ti_putc_one, (void *)putchar/' /tmp/terminfo/libterminfo/tputs.c > /tmp/terminfo/tputs.c37SLOP cp /tmp/terminfo/tputs.c /tmp/terminfo/libterminfo/tputs.c38SLOP grep -q '_ti_putc_one, (void \*)outc' /tmp/terminfo/libterminfo/tputs.c && grep -q '_ti_putc_one, (void \*)putchar' /tmp/terminfo/libterminfo/tputs.c3940FILE /tmp/terminfo.mk41    .RECIPEPREFIX := >42    .DELETE_ON_ERROR:43    MAKEFLAGS += -r44    N := /tmp/terminfo45    all: /usr/lib/libterminfo.a /usr/include/term.h /usr/include/termcap.h46    47    # libterminfo as its GNUmakefile builds it. nbperf and tic are built48    # first: the library's own scripts run them to write its hash tables49    # and the terminal descriptions it holds (xterm-256color among them).50    # tic needs TERMINFO_COMPAT for _ti_promote, which the release's51    # GNUmakefile leaves out.52    L := $(N)/libterminfo53    $(N)/nbperf/nbperf: $(wildcard $(N)/nbperf/*.c) $(L)/mi_vector_hash.c54    >cc -O1 -I$(N) -I$(N)/nbperf $^ -o $@55    $(L)/hash.c: $(L)/genhash $(L)/term.h $(N)/nbperf/nbperf56    >TOOL_NBPERF=$(N)/nbperf/nbperf sh $(L)/genhash $(L)/term.h > $@57    $(L)/termcap_hash.c: $(L)/genthash $(L)/termcap_map.c $(N)/nbperf/nbperf58    >TOOL_NBPERF=$(N)/nbperf/nbperf sh $(L)/genthash $(L)/termcap_map.c > $@59    $(N)/tic/tic: $(N)/tic/tic.c $(N)/tic/cdbw.c $(L)/compile.c $(L)/mi_vector_hash.c $(L)/hash.c60    >cc -O1 -I$(N) -I$(L) -I$(N)/tic -DTERMINFO_COMPAT $^ -o $@61    $(L)/compiled_terms.c: $(L)/genterms $(N)/terminfo/terminfo $(N)/tic/tic62    >TOOL_TIC=$(N)/tic/tic TERMINFODIR=$(N)/terminfo sh $(L)/genterms > $@63    TI := term ti setupterm curterm tparm tputs compile hash cdbr mi_vector_hash termcap64    $(L)/term.o: $(L)/compiled_terms.c65    $(L)/termcap.o: $(L)/termcap_hash.c66    $(L)/%.o: $(L)/%.c67    >cc -O2 -I$(N) -I$(L) -I$(N)/libcurses '-DINSTALL_PREFIX="/usr"' \68    >  -DTERMINFO_COMPILE -DTERMINFO_DB -DTERMINFO_COMPAT -c $< -o $@69    /usr/lib/libterminfo.a: $(addprefix $(L)/,$(addsuffix .o,$(TI)))70    >ar rcs $@ $^71    /usr/include/%.h: $(L)/%.h72    >cp $< $@73SLOP make -j4 -f /tmp/terminfo.mk7475EXPORTS LIB    terminfo /usr/lib/libterminfo.a76EXPORTS HEADER term     /usr/include/term.h77EXPORTS HEADER termcap  /usr/include/termcap.h78FILE /usr/share/licenses/netbsd-curses/COPYING79