For this reason I put up a skeleton project for UDFs:
http://hg.tangent.org/skeleton-mysql-udf
You are welcome to pull it and make use of it for your own projects. Its a very simple design and could use a few more people contributing to it.
It does though handle all of the make/build environment for you, which is pretty nifty :)
My recoup cost for this is one cup of Green Tea from the Victrola here in Seattle.