hubertf's NetBSD Blog
Send interesting links to hubert at feyrer dot de!
[20060727] pkgsrc: the big picture
When we started pkgsrc in 1997, the whole engine was basically one big Makefile, pkgsrc/mk/ I've stopped working on pkgsrc some time ago, but things haven't stopped. Quite on the contrary, pkgsrc has evolved a big deal, and the single big Makefile was split into many seperate files. I won't claim to still have an overview, and each time I look into pkgsrc/mk, I wonder where to start. Obviously the best way would be starting with and reading through everything, but I'll defer that for the time being. Instead, I tried getting some overview by looking at the include structure of the files, and with some shell magic and dot(1), this was easily done:
% cd /usr/pkgsrc/mk
% ( echo 'digraph pkgsrc {' ; \
    grep ^.include * \
    | sed \
	-e 's,:[^/]*/," -> ",' \
	-e 's,:.*<," -> ",' \
	-e 's,\.\./\.\./mk/,,' \
	-e 's,\.\./mk/,,' \
	-e 's,mk/,,' \
	-e 's,[>"]$,";,' \
	-e 's,^,  ",' ; \
    echo "}" ) > /tmp/
% dot -Grankdir=LR -Nfontname=Adobe -Tpng /tmp/ > /tmp/pkgsrc.png 
The result shows that pulls in a lot of files from directories named after the various stages of the build process (pkgsrc/mk/fetch, pkgsrc/mk/checksum, ...). This makes identifying which code is used where easier in the long run.

In the lower half, a lot of "buildlink" files read to find out about user preferences and provide defaults for several applications or subsystems like X11, PAM, Berkeley DB etc. These buildlink files are aligned with a number of "builtin" files, which determine if several features are possibly built into any of the many operating systems that pkgsrc runs on, or if packages that provide that functionality need to be installed, in order to, say, have PAM available for a package to use.

Documentation on many of these files is in the form of comments of the files. There's also some documentation in the pkgsrc guide in pkgsrc/doc/guide, but I don't know how much that is in sync with the code. (I think quite some work is needed on the pkgsrc guide - any takers?)

[Tags: ]

Disclaimer: All opinion expressed here is purely my own. No responsibility is taken for anything.

Access count: 27630582
Copyright (c) Hubert Feyrer