Fixed various build-breakers on Linux and reconfigured build script to be more friendly to Linux packages.