On Linux, Docker is used to provide a controlled, isolated build environment. In other words, it serves as a "holy build box" (https://github.com/phusion/traveling-ruby#why-it-is-difficul...). There is no native Docker for OS X (i.e. a Docker which can run OS X binaries) so on OS X we try to get as close to an isolated, controlled build environment as we can by setting various environment variables (https://github.com/phusion/traveling-ruby/blob/master/osx/in...), but it's not perfect and I'm sure someone will have just the right amount of Homebrew libraries to interfere with it.
The build scripts are pretty simple. It needs more documentation, but here's the gist:
- setup-docker-container - builds a Docker container which will function as an isolated build environment. Only need to do this once.
- setup-runtime - builds a runtime which is used inside the Docker container. Builds mock chroots and stuff. Only need to do this once. The only reason why this exists is because of limitations in Docker.
- build - builds Ruby binaries, given a runtime directory. It spawns a Docker container which performs the actual building. Inside the Docker container, it invokes the compiler, copies stuff around, etc.
Just follow the hello world tutorial and you'll see how it works.