Not worth the time honestly. Unless you have a very distinct reason to do so, ie you're optimizing something, adding a feature that wasn't compiled in (ie debugging/testing new), it's simply not worth it for weirdness like you found that someone smarter than you and I already has fixed, so why knock it.
There should be source packages available for how the packages were compiled in the first place, I would start there and see how they patched/built it and got it to work first, then if you really want to, tweak the build flags backward from that.
-mb