Various build system improvements