I work with a lot of scientific software on Linux distributions (normally Debian variants and Red Hat variants). In order to maximize performance and get access to the latest features, it's often preferable to compile software from source.
However, doing so is messy, and can lead to conflict with the package manager. I looked at all of the suggestions in the Unix & Linux question "How to compile and install programs from source" and the Unix & Linux question Where should I put software I compile from source? for some guidance. These questions are a good place to start, but it's not clear to me how I can manage dependencies easily. For example, if I build the development branch of NumPy from source using something like checkinstall, how should I detect dependencies so that I can add them correctly into the package built by checkinstall? My goal here is to make installing and uninstalling software relatively painless without cluttering my configuration.
I'd also like to make my configuration repeatable. By that, I mean, I'd like to set up a workflow for installing software on my machine so that I could repeat it exactly on a fresh OS install. Is there a best practice for that? When it comes to standard packages in a package manager, the simplest method for repeating a software install is to make a script containing the appropriate
apt-get install <package> (or equivalents). However, when installing software from source, I could see this method getting very complicated. Is there a better way?