I wrote something like that more than once. My use case: I am given the account on the machine on which I do not have admin access, but I still want my tools that are not installed: tmux, git, htop, latest version of vim sometimes, dos2unix, ack, etc. So I create ~/usr, and start the process of downloading and compiling tar.gz, with all the proper flags, most importantly --prefix. I automated this with bash scripts to the varying degrees of automation, but has always been wondering if there is a better and established tool for this.

It's been mentioned elsewhere in this thread, but Exodus is really great for this use case. You can just run

  exodus htop | ssh my-server-name
and your local machine's copy of htop will be installed in your home directory on the remote machine (along with all of the dependencies).
For the benefits of others: spent quite a bit of time googling that exodus thing (way too ubiquitous), and I think this is it: https://github.com/intoli/exodus