1DOLLY 72PACKAGE mandoc3REQUIRES HOST runtime@045# mandoc, the formatter of manual pages, from upstream's release archive,6# unchanged: it turns a page of man or mdoc macros into text. Slop does not7# run its configure, so config.h says what that script would find here. The8# man, apropos and makewhatis the same program can be are not installed: man9# is the core's, and prints a page of text. A package that ships upstream's10# pages uses this one to format them with text-page when it is built.11FROM /v0.1.4/Dollyfile-system-tools 7f6c86fcc73e544e7007646eba2718bbc4d43b7f0516d9558e2dc500b1a05a8012USE /v0.1.4/Dollyfile-zlib 7f3254e8d51bc7edd2fa47b19f3b1e2e43c747476ab93c57654639e4119abde71314REQUIRES HEADER libc15REQUIRES HEADER zlib16REQUIRES LIB    z17REQUIRES TOOL   awk18REQUIRES TOOL   basename19REQUIRES TOOL   cc20REQUIRES TOOL   cp21REQUIRES TOOL   grep22REQUIRES TOOL   gzip23REQUIRES TOOL   make24REQUIRES TOOL   mkdir25REQUIRES TOOL   rm26REQUIRES TOOL   tar27REQUIRES TOOL   test2829SOURCE /v0.1.4/dist/static/default/mandoc-1.14.6.tar.gz 8bf0d570f01e70a6e124884088870cbed7537f36328d512909eb10cd53179d9c /tmp/mandoc.tar.gz30SLOP gzip -dc /tmp/mandoc.tar.gz | tar -xf - -C /tmp3132# Not found here: fts, getprogname, recallocarray, strtonum, ohash, BSD's33# word boundaries in regcomp, pledge and sandbox_init; the archive's own34# replacements are compiled for the first five.35FILE /tmp/mandoc-1.14.6/config.h36    #define _GNU_SOURCE37    #include <sys/types.h>38    #define MAN_CONF_FILE "/etc/man.conf"39    #define MANPATH_BASE "/usr/share/man"40    #define MANPATH_DEFAULT "/usr/share/man"41    #define OSENUM MANDOC_OS_OTHER42    #define UTF8_LOCALE "C.UTF-8"43    #define EFTYPE EINVAL44    #define HAVE_DIRENT_NAMLEN 045    #define HAVE_ENDIAN 146    #define HAVE_ERR 147    #define HAVE_FTS 048    #define HAVE_FTS_COMPARE_CONST 049    #define HAVE_GETLINE 150    #define HAVE_GETSUBOPT 151    #define HAVE_ISBLANK 152    #define HAVE_LESS_T 153    #define HAVE_MKDTEMP 154    #define HAVE_MKSTEMPS 155    #define HAVE_NTOHL 156    #define HAVE_PLEDGE 057    #define HAVE_PROGNAME 058    #define HAVE_REALLOCARRAY 159    #define HAVE_RECALLOCARRAY 060    #define HAVE_REWB_BSD 061    #define HAVE_REWB_SYSV 162    #define HAVE_SANDBOX_INIT 063    #define HAVE_STRCASESTR 164    #define HAVE_STRINGLIST 065    #define HAVE_STRLCAT 166    #define HAVE_STRLCPY 167    #define HAVE_STRNDUP 168    #define HAVE_STRPTIME 169    #define HAVE_STRSEP 170    #define HAVE_STRTONUM 071    #define HAVE_SYS_ENDIAN 072    #define HAVE_VASPRINTF 173    #define HAVE_WCHAR 174    #define HAVE_OHASH 075    #define NEED_XPG4_2 076    #define BINM_APROPOS "apropos"77    #define BINM_CATMAN "catman"78    #define BINM_MAKEWHATIS "makewhatis"79    #define BINM_MAN "man"80    #define BINM_SOELIM "soelim"81    #define BINM_WHATIS "whatis"82    #define BINM_PAGER "less"83    extern const char *getprogname(void);84    extern void setprogname(const char *);85    extern void *recallocarray(void *, size_t, size_t, size_t);86    extern long long strtonum(const char *, long long, long long, const char **);87FILE /tmp/mandoc.mk88    .RECIPEPREFIX := >89    S := /tmp/mandoc-1.14.690    BIN := /usr/bin91    # The objects of upstream's Makefile for mandoc: every source but92    # configure's tests, the archive's other programs and the replacements of93    # what libc has.94    SOURCES := $(filter-out $S/test-% $S/compat_% $(addprefix $S/,cgi.c catman.c mandocd.c demandoc.c soelim.c), \95      $(wildcard $S/*.c)) $(addprefix $S/compat_,fts.c ohash.c progname.c recallocarray.c strtonum.c)96    $(BIN)/mandoc: $(SOURCES:.c=.o)97    >cc $^ -lz -o $@98    $S/%.o: $S/%.c $S/config.h99    >cc -O2 -c $< -o $@100SLOP make -j4 -f /tmp/mandoc.mk101SLOP mkdir -p /usr/share/licenses/mandoc102SLOP cp /tmp/mandoc-1.14.6/LICENSE /usr/share/licenses/mandoc/LICENSE103104# man prints /usr/share/man/cat1/NAME.1 as it is, before the page of macros105# in man1. mandoc marks bold and underlined words by overstriking; a reader106# without a pager, an agent among them, wants the words alone, so awk takes107# the overstrikes out.108FILE /usr/bin/text-page109    #!/bin/slop110    # text-page PAGE...: each manual page as plain text in /usr/share/man/cat1.111    for page in "$@"; do112      text="/usr/share/man/cat1/$(basename "$page")"113      mandoc -T utf8 "$page" | LC_ALL=C.UTF-8 awk '{ gsub(/.\b/, ""); print }' > "$text"114      test -s "$text" || exit 1115    done116117# A letter outside ASCII loses its overstrike whole.118FILE /tmp/text-page-check.1119    .TH CHECK 1120    .SH NAME121    check \- caf\['e]122    .SH DESCRIPTION123    \fBcaf\['e]\fR124SLOP text-page /tmp/text-page-check.1 && grep -c 'café' /usr/share/man/cat1/text-page-check.1 | grep -qx 2125SLOP rm /usr/share/man/cat1/text-page-check.1126SLOP text-page /tmp/mandoc-1.14.6/mandoc.1 && grep -q 'format manual pages' /usr/share/man/cat1/mandoc.1127128EXPORTS TOOL mandoc129EXPORTS TOOL text-page130FILE /usr/share/licenses/mandoc/LICENSE131FILE /usr/share/man/cat1/mandoc.1132