This is where haikuporter would come in handy. It was designed to make
scripting of the OptionalPackages easy. Perhaps take a look at bep files
for openssl and others as examples. Or at least when you have a working
script, open a haikuports trac ticket and attach your script and we can
convert it to a bep. This would make updating it to the next version a bit
easier. We make use of haikuporter to build most of the optionalpackages.
-scottmc