pkgsrc on a LFS system
Sometimes when dealing with Linux/Unix software there comes a moment when you find wonderfully detailed documentation, written by someone who knows everything about the subject by heart, and therefore doesn't bother explaining some of the most basic things about the software in question.
I felt like that when installing pkgsrc on my Linux from Scratch system.
pkgsrc is the package manager for NetBSD, but it also is highly portable to other unix-likes. Largely because what it primarily does is to get the source files of software, and then compile it. Which means unlike other package managers you don't use premade binaries, but instead everything gets build on your system. Which is what I want if I am installing on a Linux from Scratch system. The point of LFS is after all that you build everything for your own machine. Ok, the point is also that you learn how to do all this. But there comes a point when having a package manager is useful indeed.
Anyway. pkgsrc obviously expects you to know what it's talking about, and so it tells you with no irony that you should download the source tree via CVS, although Git is also mentioned as an option. It doesn't mention the address of the git repository. I fruitlessly searched for it for a while, until someone pointed out a github mirror of the CVS repository to me. I should have known, but I expected it to be an address local to the NetBSD site.
Anyway. Before finding the git repository I tried to install CVS unsuccessfully. CVS is a rather ancient versioning system (meaning it's a few years younger than me, but in IT times it's from the equivalent of the Createceous). It can be had on it's website in it's last release as well. One from 2008. It turns out, while currently BLFS (Beyond Linux from Scratch) doesn't mention this piece of software at all, it was supported up to BLFS 7.7. I guess the lack of interest in the times of git got it removed. I fruitlessly tried to use the 7.7 instructions to install it, only to run against library issues. This wouldn't be an issue if I was using a distro with binary packages most likely, as those come pre-compiled.
But then I got the git link anyway, so that became a moot point.
Installation is in fact rather simple, but also curiously full of holes in all the explanations. I had to find multiple documents that loved to go into weird edge cases, to realize the only thing I needed to do after downloading the tar.gz was
cd pkgsrc/bootstrap
./bootstrap --make-jobs=1
./cleanup
That --make-jobs option wasn't really explained anywhere either, but my first few attempts failed because one application refused to compile in parallel processes.
By default the programs compiled get installed into /usr/pkg/bin/sbin, the man pages into /usr/pkg/man. I had to set the paths for that as well.
There actually is another question about the way it all installs: I wanted to use this as a package management system, being able to update and supplement all the software I installed beforehand. But the way it works with separate bin folders this creates a seperate infrastructure instead. This COULD be changed as well (one can set different prefixes and directories during bootstrap), but for now this works. I was told this is preferable in case one messes up the whole source tree. But how often does that happen?
So wait, how do you actually install stuff with it?
First you might have to change /usr/pkg/etc/mk.conf (or wherever mk.conf is)
Well, the pkgsrc directory we installed earlier is also full of build recipes for all the apps netbsd has to offer. Which means basically all the common and free software you usually get.
Go to /usr/pkgsrc and you see multiple categories. Enter any of the categories and there will be multiple applications.
Then just go to any of those applications and type bmake install, and it will start compiling and install.