Portfile as howto
I had an interesting Apache gdb session recently wherein I discovered that the Apache Portable Runtime (APR) package on one of my clients' shiny new Debian Linux boxes was.... well ... completely borked, causing a segfault for every apache child process. It's my fault for using the testing distribution, but (hey!) the box isn't all that important and it's an excuse to see what's new in Debian-land. However, as I actually do want to serve a web page from this machine, I figured it best not to further trust the package manager to find me non-broken software. I decided to download APR and friends + apache and compile it myself. The last time I did anything like this, I used MacPorts (then darwinports) to compile and install apache on my mac at home, a very "batteries included" affair as MacPorts selects a good set of default options for me. After some attempts to grok the various configuration options for Apache, I decided that I really just wanted the same options I have installed on the MacPorts+OSX box at home. Enter MacPorts happily human readable portfiles.
In the MacPorts portfile for apache we find the configure.args line.
configure.args --with-apr=${prefix}/bin/apr-1-config --with-apr-util=${prefix}/bin/apu-1-config --libdir=${prefix}/lib --with-expat=${prefix} --with-pcre=${prefix} --mandir=${prefix}/share/man --enable-mods-shared=all --enable-ssl --with-ssl=${prefix} --enable-deflate --enable-proxy --enable-proxy-connect --enable-proxy-http --enable-proxy-ftp
All that was necessary was to make the prefix variable point to where I wanted to install apache, drop in the args above for the ./configure script, and everything compiled without a hitch. I did already have the various other dependencies (ssl, etc.) installed on my system from the aborted attempts at installing the Apache2 package, so there were no surprises from missing libraries. Editing the (happily very clear and atomic) default apache configuration files a little brought me to the necessary service configuration very quickly. Now I have virtual hosting, mod_rewrite (to send all requests on port 80 to the https port), and some other nice features running on the very latest stable Apache2.