Convert build shell scripts to Lua, with common infrastructure.