SDL2 really is quite something! I didn't have to make any changes to my program when I tried to build it on FreeBSD yesterday. It just worked, so I was quite impressed! I did manage to break FreeBSD after a while - I think by just installing mesa-devel - which broke swrast. After removing the package I could get glxgears to work again.