Difference between revisions of "BuildingMacOSX"

From Mumble Wiki
Jump to: navigation, search
(sudo sed 's,sudo,,')
(Use new mumble-voip/mumble-osx-build scripts to build the build-env)
Line 6: Line 6:
  
 
To build Mumble you will need:
 
To build Mumble you will need:
* Mac OS X 10.7 (Lion), or greater
+
* Mac OS X 10.8 (Mountain Lion)
* Xcode (from the Mac App Store) with Xcode command line utilities installed (Preferences -> Downloads)
+
* Xcode 4.4
* pkg-config (http://pkg-config.freedesktop.org/)
 
* The Mumble Qt branch (http://qt.gitorious.org/+mumble-developers/qt/mumble-developers-qt)
 
* Boost (http://www.boost.org/)
 
* libogg (http://www.xiph.org)
 
* libvorbis (http://www.xiph.org/)
 
* libFLAC (http://www.xiph.org/)
 
* libsoundfile (http://www.mega-nerd.com/libsndfile/)
 
* Protocol Buffers (http://code.google.com/p/protobuf/)
 
* Logitech LGLCD SDK (optional)
 
  
To build Murmur, you will need these additional dependencies:
+
=== Creating a build environment ===
* Berkeley DB (http://www.oracle.com/technetwork/database/berkeleydb/overview/index.html)
 
* mcpp (http://www.sourceforge.net/projects/mcpp/)
 
* ZeroC Ice (http://www.zeroc.com/)
 
  
=== Setting up the build environment ===
+
The git repository at https://github.com/mumble-voip/mumble-osx-build contains pre-made scripts that build the current canonical Mumble OS X build environment.
  
Start off by creating a directory to host your new environment. By default, we'll be using $HOME/MumbleBuild,
+
Simply clone the repo, and cd into it:
but anything goes. (Just remember to change the script below:)
 
  
#!/bin/bash
+
  $ git clone https://github.com/mumble-voip/mumble-osx-build
 +
  $ cd mumble-osx-build
  
# C compiler
+
Create a MumbleBuild directory in your home dir:
export CC="clang"
 
export CXX="clang++"
 
  
# Mac OS X SDK stuff
+
  $ mkdir -p ~/MumbleBuild
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
+
Copy the 'env' script to the directory you created in the previous step:
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
+
  $ cp env ~/MumbleBuild/env
export CXXFLAGS=$OSX_CFLAGS
 
export LDFLAGS=$OSX_LDFLAGS
 
  
# Mumble stuff
+
Source the env script to set up the proper environment variables for the Mumble build environment:
export MUMBLE_PREFIX=$HOME/MumbleBuild
 
  
# pkgconfig, PATH, etc.
+
  $ source ~/MumbleBuild/env
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
+
Build the enviroment:
  
Create a copy of the above script as $HOME/MumbleBuild/env, and remember to source it before continuing
+
  $ ./build-all.bash
your build environment set up:
 
  
$ source $HOME/MumbleBuild/env
+
Once this is done, you should have a fully functional installation of Mumble's dependencies (tools and libs) in a self-contained MumbleBuild directory in your home directory.
Now in x86-64 MumbleBuild environment
 
  
== Building Mumble and its dependencies ==
+
=== Building Mumble ===
 
 
=== 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 Git:
 
 
 
git clone https://github.com/mkrautz/xar
 
 
 
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/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).
 
 
 
$ 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 ===
+
Make sure you've sourced ~/MumbleBuild/env into your current shell session:
  
Grab the latest version of Boost from http://www.boost.org/, as of current writing, that is 1.48.0.
+
$ source ~/MumbleBuild/env
  
Apply the patch available at https://dl.dropbox.com/s/24yu9j77qpy0x5u/nilfix.patch
+
Fetch the Mumble source from Git into a directory of your choosing:
 
 
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
 
make install
 
 
 
=== Building libvorbis ===
 
 
 
Grab the latest version (current 1.3.2). Build:
 
 
 
./configure --disable-dependency-tracking --prefix=$MUMBLE_PREFIX
 
make
 
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
 
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:
 
 
 
mkdir -p $MUMBLE_PREFIX/lglcd-sdk/
 
tar -zxvf /Applications/Logitech/GamePanel\ Software/LCD\ Manager/LCDSDK/LCDSDK.tgz -C $MUMBLE_PREFIX/lglcd-sdk/
 
chmod -vR +r $MUMBLE_PREFIX/lglcd-sdk/
 
 
 
=== Building Mumble ===
 
 
 
Fetch the Mumble source from Git:
 
  
 
  git clone --recursive https://github.com/mumble-voip/mumble
 
  git clone --recursive https://github.com/mumble-voip/mumble
Line 226: Line 48:
 
To build the client, execute:
 
To build the client, execute:
  
  cd
+
  cd mumble
  qmake -recursive -spec unsupported/macx-clang main.pro CONFIG+='release no-server'
+
  qmake -recursive -spec unsupported/macx-clang main.pro CONFIG+='release static no-server'
 
  make
 
  make
  
Line 248: Line 70:
 
To build with code signing enabled, use the following three parameters to the osxdist.py script:
 
To build with code signing enabled, use the following three parameters to the osxdist.py script:
  
* --codesign='Developer ID Application: <Name or Organization>'
+
* --developer-id='<Name or Organization>'
* --codesign-installer='Developer ID Installer: <Name or Organization>'
+
* --keychain=<keychain> (optional, defaults to 'login.keychain')
* --codesign-keychain=<keychain> (optional, defaults to 'login.keychain')
 
 
 
Note: The above example is signed by a Developer ID certificates created by uploading Certificate Signing Requests to the Developer Certificate Utility on https://developer.apple.com/membercenter/index.action.
 
Any certificates work, but you should probably juse use Apple's Developer ID certificates, given the precense of Gatekeeper in OS X Mountaion Lion: http://www.apple.com/macosx/mountain-lion/features.html#gatekeeper
 
  
 
[[Category:Development]]
 
[[Category:Development]]

Revision as of 22:47, 4 August 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:

  • Mac OS X 10.8 (Mountain Lion)
  • Xcode 4.4

Creating a build environment

The git repository at https://github.com/mumble-voip/mumble-osx-build contains pre-made scripts that build the current canonical Mumble OS X build environment.

Simply clone the repo, and cd into it:

 $ git clone https://github.com/mumble-voip/mumble-osx-build
 $ cd mumble-osx-build

Create a MumbleBuild directory in your home dir:

 $ mkdir -p ~/MumbleBuild

Copy the 'env' script to the directory you created in the previous step:

 $ cp env ~/MumbleBuild/env

Source the env script to set up the proper environment variables for the Mumble build environment:

 $ source ~/MumbleBuild/env

Build the enviroment:

 $ ./build-all.bash

Once this is done, you should have a fully functional installation of Mumble's dependencies (tools and libs) in a self-contained MumbleBuild directory in your home directory.

Building Mumble

Make sure you've sourced ~/MumbleBuild/env into your current shell session:

$ source ~/MumbleBuild/env

Fetch the Mumble source from Git into a directory of your choosing:

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

To build the client, execute:

cd mumble
qmake -recursive -spec unsupported/macx-clang main.pro CONFIG+='release static 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.

If you only have a Mumble.app, and have not built Murmur, you should also pass the

--no-server

parameter to the osxdist.py script. This will not attempt to package Murmur-specific files in the generated .dmg.

The script supports code signing, and among other things, allow you to build a copy of Mumble signed with your Developer ID certificates from Apple. To build with code signing enabled, use the following three parameters to the osxdist.py script:

  • --developer-id='<Name or Organization>'
  • --keychain=<keychain> (optional, defaults to 'login.keychain')