Building Drawterm on NetBSD (assumes NetBSD 5.x on i386 port)

Background:

Drawterm is a Plan 9 Terminal Emulator used to connect to a remote Plan 9 system. You can obtain the source code from http://swtch.com/drawterm/. Either grab the latest tarball or use mercurial. Extract someplace convenient like $HOME/src/ :


  ex)
	% mkdir ~/src
	% cd src && snarf http://swtch.com/drawterm/drawterm.tgz
	% tar xzf drawterm.tgz

Configure and Patch

Now that the source files are extracted change to the drawterm/ directory and make the following file tweaks with your favorite editor (+ means add line; - means remove line):


	# Make.config
	AUDIO=none
	+ CONF=unix

	# Make.unix
	- X11=/usr/X11R6                                                   
	+ X11=/usr/X11R7

	- LDADD=-L$(X11)/lib64 -L$(X11)/lib -lX11 -ggdb
	+ LDADD=-L$(X11)/lib64 -L$(X11)/lib -lX11 -ggdb -lossaudio

Build and Install

With the above files tweaked you're ready to build drawterm:


% make
gcc -Wall -Wno-missing-braces -ggdb -I. -I./include -I./kern -c -I/usr/X11R7/include -D_THREAD_SAFE -pthread -O2  -c main.c
gcc -Wall -Wno-missing-braces -ggdb -I. -I./include -I./kern -c -I/usr/X11R7/include -D_THREAD_SAFE -pthread -O2  -c cpu.c
...

If the build fails, type 'make clean' and double-check your tweaks, then re-run 'make'. If all went well you should see the resulting drawterm executable:


	% ls -l drawterm
	-rwxr-xr-x  1 you  users  1146267 Oct  9 20:23 drawterm
	% ldd drawterm
	drawterm:
		-lc.12 => /usr/lib/libc.so.12
		-lXdmcp.6 => /usr/X11R7/lib/libXdmcp.so.6
		-lXau.6 => /usr/X11R7/lib/libXau.so.6
		-lX11.6 => /usr/X11R7/lib/libX11.so.6
		-lossaudio.0 => /usr/lib/libossaudio.so.0
		-lpthread.0 => /usr/lib/libpthread.so.0

You can run drawterm from where it is but it's better to copy it to $HOME/bin/:


	% cp -p drawterm $HOME/bin/

Running

Assuming the remote Plan 9 system has been configured correctly, the following connects drawterm:


	% drawterm -a REMOTE_SYSTEM_IP -c REMOTE_SYSTEM_IP -u REMOTE_SYSTEM_USERNAME

Problems with Colors

If drawterm doesn't look right (default is grey desktop background with rio(1) windows white with black text) it's possible you're X11 display is running at too high resolution; drawterm will work best at 16 or 24 color depth. Try tweaking your /etc/X11/xorg.conf file or toggling the X11 display via the ALT + CTRl + "+/-" keys.