Apply hotfix for LuaJIT, update and cleanup build system