OSX build instructions (using OSX 10.8.3 and Xcode 4.6.2):

1. Install SDL framework
   - go to http://www.libsdl.org/download-1.2.php
     - download SDL-1.2.15.dmg
   - Open the DMG and copy SDL.framework to /Library/Frameworks
     - also, copy devel-lite to your desktop
   - Build SDLMain.m_o:
     - open terminal, cd ~/Desktop/devel-lite
     - run: gcc -c -O3 -I./ -I/Library/Frameworks/SDL.framework/Headers -o SDLMain.m_o SDLMain.m
2. Install macports
3. Install the following ports (sudo port install <name>):
   - bzip2
   - freetype
   - libpng
   - libsamplerate
   - speex
   - zlib
4. Boost requires some special stuff. We must compile with clang and libc++.
   - edit your /opt/local/etc/macports/macports.conf
     - add to end: default_compiler	clang
   - sudo port edit boost
     - change this line:
       write_jam "using darwin : : ${configure.cxx} : <cxxflags>\"${configure.cxxflags}\" ${compileflags} <linkflags>\"${configure.ldflags}\" : ;" 
     - to this:
       write_jam "using darwin : : ${configure.cxx} : <cxxflags>\"${configure.cxxflags} -std=c++11 -stdlib=libc++\" ${compileflags} <linkflags>\"${configure.ldflags} -stdlib=libc++\" : ;" 
   - if you have boost already installed in macports, remove it:
     - sudo port uninstall boost
   - reinstall boost from source:
     - sudo port -s install boost
5. Download the Mupen64Plus source code:
   - Open terminal window, create build directory for Mupen64Plus
   - Download and unpack the latest m64p_helper_scripts.tar.gz from: https://code.google.com/p/mupen64plus/wiki/CompilingFromHg
   - run ./m64p_get.sh
6. Hack your ui-console makefile to build against SDLMain.m_o:
   - edit source/mupen64plus-ui-console/projects/unix/Makefile
     - change line:
       CFLAGS += $(SDL_CFLAGS)
     - to:
       CFLAGS += $(SDL_CFLAGS) ~/devel-lite/SDLMain.m_o -framework Cocoa
7. Hack your m64p_build.sh script to build under OSX:
   - change line:
     "$MAKE" -C source/mupen64plus-${component}/projects/unix all $@
   - to:
      if [ "${component}" = "ui-console" ]; then
          "$MAKE" -C source/mupen64plus-${component}/projects/unix all -j4 V=1 CC=clang CXX=clang++ OSX_SDK=10.7 SDL_CFLAGS="-I/opt/local/include -D__APPLE__ -I/Library/Frameworks/SDL.framework/Headers" SDL_LDLIBS="-F/Library/Frameworks -framework SDL -framework Foundation" OPTFLAGS="-O3" LDFLAGS="-Wl,-rpath -Wl,@executable_path/../Frameworks"
      else
          "$MAKE" -C source/mupen64plus-${component}/projects/unix all -j4 V=1 CC=clang CXX=clang++ OSX_SDK=10.7 SDL_CFLAGS="-I/opt/local/include -D__APPLE__ -I/Library/Frameworks/SDL.framework/Headers" SDL_LDLIBS="-F/Library/Frameworks -framework SDL -framework Foundation" OPTFLAGS="-O3"
      fi
8. Build it
   - copy osx_build_bundle.sh from source/mupen64plus-core/tools to current directory
   - run ./osx_build_bundle.sh
