Is there an Ubuntu equivalent to the BSD Ports system? I realize that the Linux and Ubuntu culture tends to install new software from binaries, but having used BSD ports within both BSD and Mac OS X I find it very simple and elegant and the idea of compiling from source on demand, with all dependencies figured out for you, is very powerful.
Most linux distributions, Ubuntu included, distribute packages as binaries. Unless you have a very specific need, IMO, building from source is over rated.
IMO, if you wish to compile from source, you are better off using LFSor Gentoo.
You can, of course, achieve the same thing with Ubuntu by building from source. You should avoid installing packages outside of apt as much as possible.
here is a nice overview of why (fedora wiki).
So what you would do on ubuntu is download the source code from the ubuntu repositories, make any modifications needed, build a package, and install it with apt (dpkg). Doing so is poorly supported, and as with LFS and Gentoo you will need to do a bit of reading.
The documentation is a bit scattered.
Enable the source repositories
You need to enable the source repositories to download the source code.
See Ubuntu wiki repositories for details.
apt-build
apt-build will build from source and is probably the best way of achieving what you want on Ubuntu or Debian (or Mint ...)
Configure your options
You probably want to use -jx where x = number of CPU +1
To prevent your compiled packages / libs from being over written, put these options in
/etc/apt/preferences
Build
see man apt-build
apt-get
apt-get will download the source and install dependencies (binaries)
You can then build and package with any number of tools.
See:
Ubuntu Wiki Easy Compiling
The page on compiling a kernel has more details and alternate options (fakeroot,
Ubuntu wiki compile kernel
That should get you started ;)