mac os xMac OS X

These instructions use gtk-osx, which is a native port of GTK to macosx.
They are loosely based on tryton's build instructions.

(previous instructions used macports and py2exe but this never really worked well for packaging, it is quite useful for development and testing however)

Go to the development index page for more general information.

dependenciesRequirements

  • A Mac OS X system running version 10.5 or later (both x86 and PowerPC are supported)
  • gcc-4.2:
    gcc-4.2 -v
  • Developer SDK:
    ls -ld /Developer/SDKs/MacOSX10.5.sdk
  • git
Note: there are some known issues with MacPorts, you may want to follow these instructions as a separate user or at least remove the macport paths from your environment.

gnomejhbuild

First, download the latest gtk-osx-build-setup.sh script and run it to setup the build environment:

curl -O https://raw.github.com/jralls/gtk-osx-build/master/gtk-osx-build-setup.sh
sh gtk-osx-build-setup.sh

As per the script's warning, you must update your PATH:
export PATH=$PATH:~/.local/bin/

The rest of the instructions will either be jhbuild commands or run from the jhbuild environment by first starting the jhbuild shell.

gtkgtk-osx

Modify the configuration file to use a specific (and more recent) version of Python and GStreamer:
sed -i -e 's/^setup_sdk/#setup_sdk/g' .jhbuildrc-custom
cat << EOF >> .jhbuildrc-custom
_gtk_osx_use_jhbuild_python = True
branches["python"] = "http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2"
setup_sdk(target="10.4", sdk_version="10.5", architectures=["i386"])
os.environ["CC"] = "/usr/bin/gcc-4.2"
os.environ["DYLD_LIBRARY_PATH"] = ""
build_policy = "updated-deps"
modules = [ "python", 
	"meta-gtk-osx-bootstrap", "meta-gtk-osx-core",
	"libcroco", "librsvg",
	"meta-gtk-osx-python", "meta-gtk-osx-themes",
	"gtk-quartz-engine",
	"gtk-mac-integration", "gtk-mac-integration-python" ]
EOF
You must replace i386 with ppc if that is your build platform.
If you want to use Python 2.6, change the URL to: http://www.python.org/ftp/python/2.6.7/Python-2.6.7.tar.bz2


This will build the native version of (Py)GTK for OSX (skipping libiconv to fix library problems on Lion):

jhbuild bootstrap --skip=libiconv
jhbuild build

gtkAudio Support: GStreamer

First we need to install some libraries which are required by some of the GStreamer plugins we use, and the CPU optimization library orc:
jhbuild shell
# orc:
cd; curl -O http://code.entropywave.com/download/orc/orc-0.4.16.tar.gz
tar -zxf orc-0.4.16.tar.gz
cd orc-0.4.16
./configure --prefix ${JHBUILD_PREFIX} --libdir '${JHBUILD_PREFIX}/lib'
make && make install
# ogg:
cd; curl -O http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
tar -zxf libogg-1.3.0.tar.gz
cd libogg-1.3.0
./configure --prefix ${JHBUILD_PREFIX} --libdir ${JHBUILD_PREFIX}/lib --enable-shared --disable-static
make && make install
# theora:
cd; curl -O http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
tar -jxf libtheora-1.1.1.tar.bz2
cd libtheora-1.1.1
./configure --prefix ${JHBUILD_PREFIX} --libdir ${JHBUILD_PREFIX}/lib --enable-shared --disable-static
make && make install
# vorbis:
cd; curl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.bz2
tar -jxf libvorbis-1.3.3.tar.bz2
cd libvorbis-1.3.3
./configure --prefix ${JHBUILD_PREFIX} --libdir ${JHBUILD_PREFIX}/lib --enable-shared --disable-static
make && make install

Now we can build GStreamer and its modules.
First we enable some modules currently disabled by default:
sed -i -e 's/--disable-x --disable-xvideo//g' ~/Source/jhbuild/modulesets/gtk-osx-gstreamer.modules
Then we can start the build:
jhbuild buildone gstreamer
jhbuild buildone gst-plugins-base
jhbuild buildone gst-plugins-good

And the python bindings:
jhbuild shell
curl -O http://gstreamer.freedesktop.org/src/gst-python/gst-python-0.10.22.tar.bz2
tar -jxf gst-python-0.10.22.tar.bz2
cd gst-python-0.10.22
./configure --prefix ${JHBUILD_PREFIX} --libdir ${JHBUILD_PREFIX}/lib
make && make install

osxige-mac-bundler

ige-mac-bundler will be used to generate the standalone osx application bundle.
Download and install it:
jhbuild shell
curl -O http://ftp.gnome.org/pub/gnome/sources/gtk-mac-bundler/0.6/gtk-mac-bundler-0.6.1.tar.bz2
tar jxf gtk-mac-bundler-0.6.1.tar.bz2
cd gtk-mac-bundler-0.6.1
make install

For more information on the process of bundling, why it is necessary and how it affects the shared libraries on OSX, see Dynamic Libraries, RPATH, and Mac OS and Porting to Mac/ige-mac-bundler

gtk x264/vpx Video Encoding Support

First we need yasm:
jhbuild shell
curl -O http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar -jxvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure --libdir=${JHBUILD_PREFIX}/lib --prefix=${JHBUILD_PREFIX}
make && make install

VPX:
jhbuild shell
curl -O http://webm.googlecode.com/files/libvpx-v1.0.0.tar.bz2
tar -jxvf libvpx-v1.0.0.tar.bz2 
cd libvpx-v1.0.0
./configure --libdir=${JHBUILD_PREFIX}/lib --prefix=${JHBUILD_PREFIX} --disable-static
make && make install

x264:
jhbuild shell
curl -O ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
cd x264-snapshot-*
./configure --libdir=${JHBUILD_PREFIX}/lib --prefix=${JHBUILD_PREFIX} --enable-vp8 --enable-pic --target=x86-darwin8-gcc
make && make install

(substitute x86-darwin-gcc with ppc32-darwin8-gcc on PowerPC)

pythonPython dependencies

First we install some libraries used by pycrypto - this optional and provides fastmath
jhbuild shell
curl -O ftp://ftp.gmplib.org/pub/gmp-5.0.4/gmp-5.0.4.tar.bz2
tar -jxf gmp-5.0.4.tar.bz2
cd gmp-5.0.4
./configure --prefix ${JHBUILD_PREFIX} --libdir ${JHBUILD_PREFIX}/lib --build=i386-darwin
make && make install
cd ..
curl -O http://www.mpfr.org/mpfr-current/mpfr-3.1.0.tar.bz2
tar -jxf mpfr-3.1.0.tar.bz2
cd mpfr-3.1.0
./configure --prefix ${JHBUILD_PREFIX} --libdir ${JHBUILD_PREFIX}/lib --build=i386-darwin
make && make install

(substitute i386-darwin with ppc-darwin on PowerPC)


Install setuptools:
jhbuild shell
curl -O http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
tar zxf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python ./setup.py install

And use it to install the following python libraries:
jhbuild shell
easy_install netifaces pam pycrypto twisted pyasn1 PIL py2app

desktopBuild Protocol Support

  • Xpra:
    jhbuild shell
    curl -O https://winswitch.org/src/xpra-0.2.0.tar.bz2
    tar -jxf xpra-0.2.0.tar.bz2
    cd xpra-0.2.0
    python setup.py install
    
  • RDesktop:
    jhbuild shell
    curl -O https://winswitch.org/src/rdesktop-1.7.0.tar.gz
    tar -zxvf rdesktop-1.7.0.tar.gz
    cd rdesktop-1.7.0
    ./configure --prefix ${JHBUILD_PREFIX} --libdir ${JHBUILD_PREFIX}/lib
    make && make install
    
  • TigerVNC:
    jhbuild shell
    curl -O https://winswitch.org/src/tigervnc-1.1.0.tar.gz
    tar -zxf tigervnc-1.1.0.tar.gz
    cd tigervnc-1.1.0
    ./configure --prefix ${JHBUILD_PREFIX} --libdir ${JHBUILD_PREFIX}/lib
    sed -i -e 's+-lXext -lX11+-lXext -lX11 -lgettextlib -L/usr/X11/lib/+g' unix/vncviewer/Makefile
    make && make install
  • NX:
    jhbuild shell
    curl -O https://winswitch.org/src/nxcomp-3.5.0-2.tar.gz
    curl -O https://winswitch.org/src/nxcomp.patch
    curl -O https://winswitch.org/src/nxproxy-3.5.0-1.tar.gz
    tar -zxf nxcomp-3.5.0-2.tar.gz
    cd nxcomp
    ./configure
    patch -p1 < ../nxcomp.patch
    sed -i -e 's+-bundle+-dynamiclib+g' Makefile
    make
    cp -Rp libXcomp.so* ${JHBUILD_PREFIX}/lib/
    cd ..
    tar -zxf nxproxy-3.5.0-1.tar.gz
    cd nxproxy
    ./configure --prefix ${JHBUILD_PREFIX} --libdir ${JHBUILD_PREFIX}/lib
    sed -i -e 's/-lXcomp/-lXcomp -lpng -ljpeg -lz/' Makefile
    make && make install

setup-installerBuilding the standalone application

jhbuild shell
curl -O https://winswitch.org/src/winswitch-0.12.13.src.tar.bz2
tar -jxf winswitch-0.12.13.src.tar.bz2
cd winswitch-0.12.13
# Add the osx specific bits:
curl -O https://winswitch.org/src/winswitch-osx-0.12.13.src.tar.bz2
tar -jxf winswitch-osx-0.12.13.src.tar.bz2
ln  -sf winswitch-osx-0.12.13 osx

PYTHONPATH=.:$PYTHONPATH ./setup.py install
./setup.py py2app
cd osx/bundle
./make-app.sh

The resulting application bundle will be copied to the desktop.

Building a DMG disk image is currently a manual process. (see bug #76 for more details)