Pkgsrc

This page is about how pkgsrc, the NetBSD Packages Collection, compiles and installs NetHack onto several Unix-like operating systems, by patching NetHack to be more Unix-portable.


 * Important: The information on this wiki page so far is the result of a study of the pkgsrc documentation and CVS repository, with no actual experience using pkgsrc. Thus this page more probably contains errors.

Introduction
The main way to install a third-party package onto NetBSD is to use pkgsrc like this:


 * 1) cd /usr/pkgsrc/games/nethack
 * 2) make install

First, this installs any necessary dependent packages. Then, this downloads the source code of the package, extracts it, patches it, configures it, builds (compiles) it, and installs it. Many BSD users know this, but pkgsrc is a fork of the FreeBSD Ports Collection, where this "cd /there && make install" idea started.

"If it works, it should work everywhere." Thus, unlike the FreeBSD Ports Collection, pkgsrc works above multiple Unix-like operating systems, the systems most compatible with NetBSD.

An interesting study is to examine the patches that pkgsrc provides, to check if Unix software required portability fixes.

NetHack
Currently pkgsrc can install NetHack 3.4.3 above Unix. This uses five packages, because pkgsrc does not support something like OpenBSD's flavors or Gentoo's USE flags. The nethack package simply depends on the nethack-qt, nethack-tty, nethack-x11 packages, so installing "nethack" gives you all three user interfaces. The three packages simply call a make target in the nethack-lib package which actually handles the NetHack sources. The end result is up to three executables sharing one playground; this differs from the typical setup of having one executable and setting the win option in NETHACKOPTIONS or a nethackrc.

Thus the nethack-lib package is responsible for patching the sources as well as installing the playground.

Patches
These are the patches. (The following list is from HEAD on 2 December 2006, what will become pkgsrc 2006Q4. Compared to 2006Q3, it contains a build fix for Linux.)


 * patch-aa
 * patch-ab
 * opatch-ac
 * patch-ad
 * patch-ae
 * patch-af
 * patch-ag