== Howto build Hydrogen on Mac Os X == [updated April 16 2010] Building Hydrogen on osx is not difficult but involves some preparation. Three methods are described here: '''1. Building everything with MacPorts [http://www.macports.org/install.php].''' + Advantage: by far the easiest way - Disadvantage: does not result in the most up to date Hydrogen version '''2. Building partly with MacPorts [http://www.macports.org/install.php], and partly by hand''' + Advantage: results in the most up to date Hydrogen version from SVN - Disadvantage: a bit more difficult and time-consuming '''3. Building partly with [wiki:Fink] [http://finkproject.org/], and partly by hand''' + Advantage: results in the most up to date Hydrogen version from SVN - Disadvantage: a bit more difficult and time-consuming ''(NOTE: Method 2 and 3 are almost the same. Both Macports and Fink are a way to build, install and manage open source software on Mac Os X. Both have thousands of open source software packages available. Macports uses a BSD style package management. Fink uses a Debian Linux style package management. Neither one is 'better' than the other. Macports tends to be a little quicker in updating packages, Fink has a little more packages available. Fink also has a small number of pre-built packages available, which may be more convenient for starters.)'' = Method 1. Building everything with MacPorts = '''Preparing your system''' 1. Install the MacOSX XCode Developer tools for your system (from install DVD or download from Apple at [http://developer.apple.com/technology/xcode.html] - requires an account). Be sure to choose Unix tools as well when installing. 2. Download and install MacPorts from [http://www.macports.org/install.php]; 3. (Optional) Download and install a graphical frontend to MacPorts, for instance PortAuthority ([http://www.codebykevin.com/portauthority.html]) or Porticus ([http://porticus.alittledrop.com]). '''Building Hydrogen with MacPorts''' 4. In PortAuthority search for "hydrogen", select with mouse, choose "installations > Install a Port" from menu. If you don't have PortAuthority, open a terminal and install hydrogen with "sudo port install hydrogen" (sudo will ask for your administrative password). 5. Compiling will now start. This is basically it. MacPorts will now find all dependencies, compile all, and finally install Hydrogen in /Applications/MacPorts/. It takes several hours to complete on a fast Mac. = Method 2. Building partly with Macports and partly by hand = The following procedure involves two parts: A. Setting up the necessary build environment using Macports (read point 1-3 under method 1 on how to set up MacPorts) B. Building Hydrogen by hand. ''(NOTE: All commands are indicated with a $. Just copy-paste the command into the Terminal without the $)'' ''A. Setting up the necessary build environment using Macports'' 1. Build the following applications with Macports: qt4-mac flac libsndfile jack liblrdf libarchive scons. Either via a graphical frontend, or at the command line: {{{ $ sudo port install qt4-mac flac libsndfile jack liblrdf libarchive scons }}} This may take several hours to complete on a fast Mac. ''B. Building Hydrogen by hand'' 2. Open the macosx Terminal application. First you must set the build environment {{{ $ export QTDIR=/opt/local/libexec/qt4-mac }}} 3. and set executable paths {{{ $ export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/libexec/qt4-mac/bin" }}} ''(NOTE: you can set these values permanently in ~/.profile or ~/.bashrc)'' 4. Download the Hydrogen sources from the trunk branch {{{ $ svn co http://svn.assembla.com/svn/hydrogen/trunk }}} 5. Move into the build directory {{{ $ cd trunk }}} 6. Build with scons (variables can be set with =1 and unset with =0): (I am assuming you want to build with jack. Get Jack from [http://jackosx.com/] and install first.) {{{ $ scons alsa=0 coreaudio=1 coremidi=1 flac=1 jack=1 lash=0 libarchive=1 lrdf=1 oss=0 portaudio=0 portmidi=0 bundle=1 }}} If you don't care for an application bundle and want to run Hydrogen directly from the build directory, set bundle=0. If you set bundle=1 you can make a nice app bundle and dmg package by doing the following: 7. Create *.app directory structure {{{ $ mkdir Hydrogen.app ; mkdir Hydrogen.app/Contents ; mkdir Hydrogen.app/Contents/MacOS ; mkdir Hydrogen.app/Contents/Resources }}} 8. Copy necessary files into the application bundle (in case of scons bundle=1) {{{ $ cp -R ./data ./plugins ./Hydrogen.app/Contents/Resources/ ; cp ./macos/Hydrogen.icns ./Hydrogen.app/Contents/Resources/ ; cp ./macos/Info.plist ./Hydrogen.app/Contents/ }}} or if bundle=0 {{{ $ cp -R ./data ./Hydrogen.app/Contents/MacOS/ ; cp -R ./plugins ./Hydrogen.app/Contents/Resources/ ; cp ./macos/Hydrogen.icns ./Hydrogen.app/Contents/Resources/ ; cp ./macos/Info.plist ./Hydrogen.app/Contents/ }}} 9. Copy binary into bundle {{{ $ cp hydrogen Hydrogen.app/Contents/MacOS/Hydrogen }}} 10. Build a self-contained *.app bundle {{{ $ /opt/local/libexec/qt4-mac/bin/macdeployqt Hydrogen.app }}} 11. Rename binary and copy launch script, and make executable {{{ $ mv Hydrogen.app/Contents/MacOS/Hydrogen Hydrogen.app/Contents/MacOS/Hydrogen-bin ; cp macos/hydrogen.sh Hydrogen.app/Contents/MacOS/Hydrogen ; chmod 770 ./Hydrogen.app/Contents/MacOS/Hydrogen }}} 12. Throw away bundled jack lib and symlink to system's installed framework {{{ $ rm -f Hydrogen.app/Contents/Frameworks/libjack.0.dylib ; ln -s /Library/Frameworks/Jackmp.framework/Jackmp Hydrogen.app/Contents/Frameworks/libjack.0.dylib }}} 13. Finalize the packaging and make a dmg package {{{ /opt/local/libexec/qt4-mac/bin/macdeployqt Hydrogen.app -dmg }}} You can check whether the dependencies of the executable have been built-in {{{ $ otool -L Hydrogen.app/Contents/MacOS/Hydrogen-bin }}} It should only list paths that are ubiquitously present on all mac systems (/System/Library/Frameworks/ and /usr/lib/) and paths built into the Hydrogen application bundle (@executable_path/../Frameworks/) You are now ready to use and/or redistribute Hydrogen (under certain conditions, see license file COPYING)! = Method 3. Building partly with [wiki:Fink], and partly by hand = The following procedure involves two parts: A. Setting up the necessary build environment using Fink B. Building Hydrogen by hand. ''(NOTE: All commands are indicated with a $. Just copy-paste the command into the Terminal without the $)'' ''A. Setting up the necessary build environment using Fink'' Setting up Fink entails downloading a version for your system from [http://www.finkproject.org/download/bindist.php?phpLang=en]. A graphical front-end to Fink is FinkCommander [http://finkcommander.sourceforge.net/]. 1. Build the following applications with Fink: jack flac libtar libsndfile openssl liblrdf scons. Either via a graphical frontend, or at the command line: {{{ $ sudo fink install qt4-mac flac libsndfile jack liblrdf libarchive scons }}} This may take several hours to complete on a fast Mac. ''B. Building Hydrogen by hand'' 2. Open the macosx Terminal application. First you must set the build environment {{{ $ export QTDIR=/sw/lib/qt4-mac }}} 3. And set executable paths {{{ $ export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/sw/bin:/sw/sbin:/usr/local/bin:/usr/local/sbin:" }}} ''(NOTE: you can set these values permanently in ~/.profile or ~/.bashrc)'' 4. Download the Hydrogen sources from the trunk branch {{{ $ svn co http://svn.assembla.com/svn/hydrogen/trunk }}} 5. Move into the build directory {{{ $ cd trunk }}} 6. Open the Sconstruct file in the build directory with a texteditor, and modify as follows at line 88 and further (this is to make sure scons uses the dependencies compiled with Fink): {{{ if sys.platform == "darwin": # ldflags.append( '-L/opt/local/lib' ) ldflags.append( '-L/usr/local/lib' ) ldflags.append( '-L/sw/lib' ) # includes.append( '/opt/local/include' ) includes.append( '/usr/local/include/jack' ) includes.append( '/sw/include' ) }}} 7. In features.pri you may have to replace lines 18-24 with: {{{ LIBS += /sw/lib/libFLAC.dylib LIBS += /sw/lib/libFLAC++.dylib LIBS += /usr/local/lib/libjack.dylib LIBS += /sw/lib/libtar.dylib LIBS += /sw/lib/libpng.dylib LIBS += /sw/lib/libsndfile.dylib }}} 8. Build with scons (variables can be set with =1 and unset with =0 ) (I am assuming you want to build with jack. Get Jack from [http://jackosx.com/] and install first.) {{{ $ scons alsa=0 coreaudio=1 coremidi=1 flac=1 jack=1 lash=0 libarchive=1 lrdf=1 oss=0 portaudio=0 portmidi=0 bundle=1 }}} If you don't care for an application bundle and want to run Hydrogen directly from the build directory, set bundle=0. If you set bundle=1 you can make a nice app bundle and dmg package by doing the following: 9. Create *.app directory structure {{{ $ mkdir Hydrogen.app ; mkdir Hydrogen.app/Contents ; mkdir Hydrogen.app/Contents/MacOS ; mkdir Hydrogen.app/Contents/Resources }}} 10. Copy necessary files into the application bundle (in case of scons bundle=1) {{{ $ cp -R ./data ./plugins ./Hydrogen.app/Contents/Resources/ ; cp ./macos/Hydrogen.icns ./Hydrogen.app/Contents/Resources/ ; cp ./macos/Info.plist ./Hydrogen.app/Contents/ }}} or if bundle=0 {{{ $ cp -R ./data ./Hydrogen.app/Contents/MacOS/ ; cp -R ./plugins ./Hydrogen.app/Contents/Resources/ ; cp ./macos/Hydrogen.icns ./Hydrogen.app/Contents/Resources/ ; cp ./macos/Info.plist ./Hydrogen.app/Contents/ }}} 11. Copy binary into bundle {{{ $ cp hydrogen Hydrogen.app/Contents/MacOS/Hydrogen }}} 12. Build a self-contained *.app bundle {{{ $ /sw/lib/qt4-mac/bin/macdeployqt Hydrogen.app }}} 13. Rename binary and copy launch script, and make executable {{{ $ mv Hydrogen.app/Contents/MacOS/Hydrogen Hydrogen.app/Contents/MacOS/Hydrogen-bin ; cp macos/hydrogen.sh Hydrogen.app/Contents/MacOS/Hydrogen ; chmod 770 ./Hydrogen.app/Contents/MacOS/Hydrogen }}} 14. Throw away bundled jack lib and symlink to system's installed framework {{{ $ rm -f Hydrogen.app/Contents/Frameworks/libjack.0.dylib ; ln -s /Library/Frameworks/Jackmp.framework/Jackmp Hydrogen.app/Contents/Frameworks/libjack.0.dylib }}} 15. Finalize the packaging and make a dmg package {{{ /sw/lib/qt4-mac/bin/macdeployqt Hydrogen.app -dmg }}} You can check whether the dependencies of the executable have been built-in {{{ $ otool -L Hydrogen.app/Contents/MacOS/Hydrogen-bin }}} It should only list paths that are ubiquitously present on all mac systems (/System/Library/Frameworks/ and /usr/lib/) and paths built into the Hydrogen application bundle (@executable_path/../Frameworks/) You are now ready to use and/or redistribute Hydrogen (under certain conditions, see license file COPYING)!