Add code to fetch patches, and some global Lua definitions.