Add some of the source
Make it all build, adding missing support functions
Add libevent linkage