# download xcode https://developer.apple.com/downloads/index.action # extract xcode (from linux) dmg2img -p 5 xcode_6.0.1.dmg sudo mount -t hfsplus -o loop xcode_6.0.1.img /mnt mkdir -p /opt/osx/sysroot cp -a /mnt/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/* /opt/osx/sysroot cp -r /opt/osx/sysroot/usr/lib/system/* /opt/osx/sysroot/usr/lib # extract xcode (from osx) hdiutil attach xcode_6.0.1.dmg mkdir -p /opt/osx/sysroot # on linux cp -a /n/osx/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/* /opt/osx/sysroot # on linux cp -r /opt/osx/sysroot/usr/lib/system/* /opt/osx/sysroot/usr/lib # on linux hdiutil detach /Volumes/Xcode # cctools-port cd /opt/osx git clone https://github.com/tpoechtrager/cctools-port cd cctools-port/cctools DISABLE_LTO_SUPPORT=1 ./autogen.sh patch -p1 < /tmp/cctools.diff ./configure --prefix=/opt/osx --target=x86_64-apple-darwin make make install # environment export PATH=$PATH:/opt/osx/bin # gcc cd /opt/osx wget ftp://ftp.lip6.fr/pub/gcc/releases/gcc-4.8.3/gcc-4.8.3.tar.bz2 tar xjvf gcc-4.8.3.tar.bz2 cd gcc-4.8.3 ./contrib/download_prerequisites ln -s /bin/m4 /bin/m4-not-needed mkdir build cd build ../configure --prefix=/opt/osx --disable-checking --enable-languages=c --with-as=/opt/osx/bin/x86_64-apple-darwin-as --with-ld=/opt/osx/bin/x86_64-apple-darwin-ld --target=x86_64-apple-darwin --with-sysroot=/opt/osx/sysroot/ --disable-nls --enable-multilib --disable-libssp --enable-static --enable-shared --disable-libgomp RC_ProjectName="" MACOSX_DEPLOYMENT_TARGET="" make RC_ProjectName="" MACOSX_DEPLOYMENT_TARGET="" make install