Difference between revisions of "BuildingMacOSX"

From Mumble Wiki
Jump to: navigation, search
(Building Protocol Buffers: 2.4.1)
(Building Mumble: GitHubify and simplify)
Line 215: Line 215:
 
Fetch the Mumble source from Git:
 
Fetch the Mumble source from Git:
  
  git clone git://mumble.git.sourceforge.net/gitroot/mumble mumble.git
+
  git clone --recursive https://github.com/mumble-voip/mumble
cd mumble.git
 
git submodule init
 
git submodule update
 
  
 
To build the client, execute:
 
To build the client, execute:
  
  qmake main.pro CONFIG+='release no-server'
+
cd
 +
  qmake -recursive -spec unsupported/macx-clang main.pro CONFIG+='release no-server'
 
  make
 
  make
  

Revision as of 00:40, 18 February 2012

Building Guides

This page is one of a set of Building pages/guides for the different OSes with information on building Mumble/Murmur.

BuildingLinux BuildingFreeBSD BuildingOpenBSD BuildingMacOSX BuildingWindows


Introduction

This guide describes the method to get a fully working and redistributable version of Mumble and Murmur that uses the Cocoa version of Qt 4.

To build Mumble you will need:

Setting up the build environment

Start off by creating a directory to host your new environment. By default, we'll be using $HOME/MumbleBuild, but anything goes. (Just remember to change the script below:)

#!/bin/bash
# C compiler
export CC="clang"
export CXX="clang++"
# Mac OS X SDK stuff
export MACOSX_DEPLOYMENT_TARGET="10.6"
export OSX_SDK="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/"
# Autotools, etc. setup
export OSX_CFLAGS="-isysroot $OSX_SDK -arch x86_64 -mmacosx-version-min=10.6"
export OSX_LDFLAGS="-isysroot $OSX_SDK -Wl,-syslibroot,$OSX_SDK -arch x86_64 -mmacosx-version-min=10.6"
export CFLAGS=$OSX_CFLAGS
export CXXFLAGS=$OSX_CFLAGS
export LDFLAGS=$OSX_LDFLAGS
# Mumble stuff
export MUMBLE_PREFIX=$HOME/MumbleBuild
# pkgconfig, PATH, etc.
export PKG_CONFIG_PATH=/usr/lib/pkgconfig/:$MUMBLE_PREFIX/lib/pkgconfig/:$PKG_CONFIG_PATH
export PATH=$MUMBLE_PREFIX/Qt4.8/bin/:$PATH
export PATH=$MUMBLE_PREFIX/bin:$PATH
echo Now in x86-64 MumbleBuild environment

Create a copy of the above script as $HOME/MumbleBuild/env, and remember to source it before continuing your build environment set up:

$ source $HOME/MumbleBuild/env
Now in x86-64 MumbleBuild environment

Installing or building pkg-config

If you have Homebrew, MacPorts or Fink available, you probably already have pkg-config installed. If not, either of those packaging solutions are probably the easiest way of acquiring it.

In case you want to compile it yourself, you'll have to download and unpack pkg-config.

sudo mkdir /usr/lib/pkgconfig (choose a path you like)
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
./configure && make && sudo make install 

To make the path permanent add the following line to your ~/.profile file:

export PKG_CONFIG_PATH=/usr/lib/pkgconfig

Also add a path entry to the pkg-config binary to this file:

export PATH=$PATH:/usr/local/bin

Building OpenSSL

Grab it from http://www.openssl.org/. The latest version we use is 1.0.0g.

Unpack and build:

./Configure darwin64-x86_64-cc -shared --prefix=$MUMBLE_PREFIX --openssldir=$MUMBLE_PREFIX/openssl
make
make install

Building libxar

Fetch it via SVN:

svn checkout http://xar.googlecode.com/svn/trunk/ xar-read-only

And build it. LibXAR seems not to want to read the OS X SDK version of libxml2's headers. Instead, it uses the system headers. Therefore we must override the include path.

We also want libxar to link against our own OpenSSL dylibs, which is why we also add the include path and lib dir for our $MUMBLE_PREFIX.

cd xar-read-only/xar
export CFLAGS="-I$OSX_SDK/usr/include/libxml2 ${CFLAGS} -I${MUMBLE_PREFIX}/include/"
export LDFLAGS="${LDFLAGS} -L${MUMBLE_PREFIX}/lib/"
./autogen.sh --prefix=${MUMBLE_PREFIX}
make

After the build, it's a good thing to make sure things went as they should. We want the built libxar to be able to run on both Lion and Snow Leopard. Check that it's linking against our own libcrypto, and that it's linking against the 9.0.0 compatibility version of libxml2 (that's the Leopard version).

FIXME:
$ otool -L lib/libxar.1.dylib
    [...]
    $HOME/MumbleBuild/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.3.0)
    [...]

When all is well, install it:

make install

Building Qt

Download and unpack Qt:

git clone git://gitorious.org/+mumble-developers/qt/mumble-developers-qt.git
cd mumble-developers-qt
git branch -t 4.8-mumble origin/4.8-mumble
git checkout 4.8-mumble

Then build it:

unset CFLAGS
unset CXXFLAGS
unset LDFLAGS
export CFLAGS="-I$MUMBLE_PREFIX/include"
export CXXFLAGS="-I$MUMBLE_PREFIX/include"
OPENSSL_LIBS="-L$MUMBLE_PREFIX/lib -lssl -lcrypto" ./configure -no-pch -fast -nomake examples -nomake demos -nomake docs -debug-and-release -arch x86_64 -cocoa -qt-sql-sqlite -no-dbus -no-webkit -no-phonon -no-phonon-backend -no-qt3support -openssl-linked -mysql_config no -sdk $OSX_SDK -prefix $MUMBLE_PREFIX/Qt4.8 -opensource -confirm-license
make
make install
export CFLAGS=$OSX_CFLAGS
export CXXFLAGS=$OSX_CFLAGS
export LDFLAGS=$OSX_LDFLAGS

Installing Qt icns icon engine

Grab it:

git clone git://github.com/mkrautz/qt-icns-iconengine.git

Build and install it

cd qt-icns-iconengine
qmake -spec unsupported/macx-clang CONFIG+='release'
make
cp libqicnsicon.dylib $MUMBLE_PREFIX/Qt4.8/plugins/iconengines/libqicnsicon.dylib
make distclean
qmake -spec unsupported/macx-clang CONFIG+='debug'
make
cp libqicnsicon.dylib $MUMBLE_PREFIX/Qt4.8/plugins/iconengines/libqicnsicon_debug.dylib

Installing Boost

Grab the latest version of Boost from http://www.boost.org/, as of current writing, that is 1.48.0.

Apply the patch available at https://dl.dropbox.com/s/24yu9j77qpy0x5u/nilfix.patch

It is advisible to unpack Boost to $MUMBLE_PREFIX/include/, so the Boost headers will be available in $MUMBLE_PREFIX/include/boost-1_48_0/, since Mumble will look for the headers in this place by default.

Building libogg

Grab the latest version (current 1.3.0). Build:

./configure --disable-dependency-tracking --prefix=$MUMBLE_PREFIX
make
sudo make install

Building libvorbis

Grab the latest version (current 1.3.2). Build:

./configure --disable-dependency-tracking --prefix=$MUMBLE_PREFIX
make
sudo make install

Building libFLAC

Grab the latest version (currently 1.2.1). Build (x86-64):

./configure --build=x86_64-apple-darwin$(uname -r) --prefix=$MUMBLE_PREFIX
make
sudo make install

Building libsndfile

Grab the latest version (currently 1.0.25).

Patch with: https://dl.dropbox.com/s/a4avgl8itvkh6yq/libsndfile-1.0.25-carbon-header.patch

Build:

./configure --prefix=$MUMBLE_PREFIX --disable-sqlite
make
make install

Building Protocol Buffers

Grab the latest version of Protocol Buffers from its Google Code project: http://code.google.com/p/protobuf/. As of this writing, that is version 2.4.1. Direct link: http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.bz2

Build and install it:

./configure --disable-dependency-tracking --prefix=$MUMBLE_PREFIX
make
make install

Logitech LCD SDK (optional)

Grab it, install it. Build it:

sudo mkdir -p $MUMBLE_PREFIX/lglcd-sdk/
sudo tar -zxvf /Applications/Logitech/GamePanel\ Software/LCD\ Manager/LCDSDK/LCDSDK.tgz -C $MUMBLE_PREFIX/lglcd-sdk/
sudo chmod -vR +r $MUMBLE_PREFIX/lglcd-sdk/

Building Mumble

Fetch the Mumble source from Git:

git clone --recursive https://github.com/mumble-voip/mumble

To build the client, execute:

cd
qmake -recursive -spec unsupported/macx-clang main.pro CONFIG+='release no-server'
make

If everything went well, you should now have a Mumble.app application bundle in the release directory of the root of the source tree.

Distributing Mumble

If you wish to create a proper redistributable Mumble application bundle, please refer to the osxdist.py script in the macx/scripts directory. This will help you clean up your application bundle, include the needed dependencies, resources etc., and create a compressed disk image - ready to redistribute!

The script expects you to be in the root of the source tree. After executing, it will spit out a .dmg of your Mumble build in the release folder.

Please note that the script currently is tuned for creating real redistributable versions of Mumble, and as such only works on universal (x86, ppc) release builds!