Building heirloom tools for Plan9/APE

The sources are based on the Heirloom toolchest release 070715.
Libraries have been stripped out and built individually.

Purpose: in this package, all binaries that are able to build are installed at /$objtype/bin/ape/ , which means that they overwrite native APE binaries and will mask many native Plan9 utilities when running ape/psh.

This may be considered bloat, but some special behaviour of some utilities are required for scripts, for example heirloom "sort" vs native Plan9 "sort" 

To build heirloom tools, libuxre, libwchar (replaced by libutf8) and libcommon are required.

Various tools may require other additions to APE
- libgen
- malloc
- libpoll

Hacks:
- a common hack is to make a "mock" mkstemp() function which returns a random value. I believe it to be safe, but not sure.
Does Plan9 even have file id:s? Perhaps better to always return "-1" (fail)?


Tools that build:

TOOLSTHATBUILD= _install \
				banner \
				bdiff \
				bfs \
				cal \
				calprog \
				chmod \
				chown \
				cksum \
				cmp \
				col \
				comm \
				csplit \
				cut \
				dc \
				deroff \
				diff \
				diff3 \
				dircmp \
				dirname \
				echo \
				env \
				expand \
				factor \
				file \
				fmt \
				fold \
				getopt \
				groups \
				hd \
				head \
				id \
				join \
				kill \
				line \
				listusers \
				ln \
				logins \
				mail \
				man \
				mesg \
				mkdir \
				mkfifo \
				nawk \
				nice \
				nl \
				nohup \
				od \
				paste \
				pathchk \
				pr \
				printf \
				priocntl \
				rmdir \
				sdiff \
				sed \
				sleep \
				sort \
				split \
				tabs \
				tee \
				time \
				touch \
				true \				
				tsort \
				tty \
				ul \
				uname \
				uniq \
				units \



mkmk -a $TOOLSTHATBUILD > mkfile


Tools that don't build (yet):

bc: is not distributed as a .c file, needs some manual intervention

copy: needs some more hacking

pax/cpio: depends on sys/mtio.h and related functionality

cp/mv/ln: high priority utilities, expects stuff from the C-library not present (related to file id:s).
- for "cp -r", sbase "cp" can be used for now, modify /rc/bin/ln to use /$objtype/bin/cp.

date: needs more hacking (utmpx support in libcommon)

dd: depends on sys/mtio.h and related funcitonality

df: some hacking needed

du: needs some more members in struct stat and rlimit

ed: needs some more hacking or perhaps other variant

expr: needs some more hacking. distributed as yacc file.

getconf: needs confstr (libcommon hacks )

grep/fgrep/egrep: missing sys/mman.h dependency + linking issues (must fix libraries)

hostname: sethostname missing

ls : needs curses + various stuff normally found in sys/ioctl.h

mknod: needs "major/minor" functions and sys/mkdev.h

news: some more hacking needed

nice: most likely broken... (syscall dependency)

oawk: need to fix flex

pg: need more hacking

pgrep/pkill: need /sys/procfs.h etc...

ps: need sys/proc.

renice: probably not supposed to work (just like nice)

rm: RLIMIT -stuff missing

setpgrp: getsid and gepgid

shl: unsupported stuff

spell: might build but involved, next release

stty: some stuff not defined

sync: sync() not present in unistd.h

tapecntl: depends on stuff not present in APE

tar: missing sys/mkdev.h














