win32: build common stuff as a library, fix release build