I'm using pretty much the same script for this, plus the slightly tweaked makefiles for Lua (included) because of GMS requiring dylibs to be 32-bit. Could be that old thing with dylib->dylib references - I should probably try compiling Lua+Apollo into a single dylib again later.