Root directory for installing from source

I ran into a funny issue installing the Hare compiler today:

It stems from the following coincidence: I usually clone third-party software into ~/.local/src/ so that it is separate from code I’m working on and out of sight. And I usually install tools that I can’t get from APT into ~/.local/ as well. (Putting the sources in ~/.local/src/ then also fits the pattern where binaries go in ~/.local/bin/ and man files in ~/.local/share/man/ etc.)

The problem is that the Hare installation procedure assumes that the git repo and the “installed” sources are in different places. Because when you do …

cd ~/.local/src/hare
git pull
make install PREFIX=$HOME/.local

… it tries to copy $HOME/.local/src/hare/stdlib/ into itself.

This issue really only applies to me though, since people working on Hare would definitely separate their git checkout from their installed sources; and end users will eventually be installing Hare via the package manager. Source checkouts aren’t really meant for end users; Hare just isn’t stable enough to be in Debian yet.

But this made me reconsider my approach. There actually isn’t a good reason to install software into ~/.local/ instead of /usr/local/ – that’s what it’s there for, and I’m on a single-user system with sudo rights. I guess I was just paranoid about using sudo, so I’ve been avoiding it unnecessarily. (As long as the installer only does cp or install and doesn’t run other arbitrary code. So first installing with PREFIX=/tmp on an unfamiliar code base still seems like a good idea.)

Conclusion: I’ll keep doing git checkouts of third-party code into ~/.local/src/ (why not), but I’ll install it to /usr/local/ from now on.