wiki:Documentation/HOWTO/BuildOnOSX
Last modified 3 years ago Last modified on 03/27/14 00:46:04

Building on OS X

Building fldigi from source on OS X is a process similar to that for Debian. The main difference is that library binaries are not so readily available, although it may be possible to obtain binaries for some of the libraries required to build fldigi from repositories such as MacPorts. This document assumes that you are building all the dependencies from source.

To compile fldigi and its dependencies you will also need various development tools that come with Xcode. Download and install Xcode before continuing.

The build commands will create single architecture (i.e., not "universal") binaries. They were tested on a Snow Leopard (OS X 10.6) system but should also work for 10.5.


  1. Build dependencies
    1. pkg-config
    2. libpng
    3. FLTK
    4. PortAudio
    5. samplerate
    6. sndfile
    7. xmlrpc-c
    8. libtool
    9. hamlib
  2. Getting the source
  3. Compiling fldigi
  4. Installing the binaries
  5. Installing the binaries
  6. Acknowledgements


Build dependencies

The developers maintain their fldigi/OS X build tree as follows:

  • Source trees are kept in separate subdirectories under $HOME/src
  • Binaries are installed in separate subdirectories under $HOME/sw
  • Symbolic links are made in $HOME/sw/bin and $HOME/sw/lib/pkgconfig
  • $HOME/sw/bin is added to PATH and $HOME/sw/lib/pkgconfig is added to PKG_CONFIG_PATH

We assume that you will use the same or a similar arrangement. Substitute the following values (or define these variables) whenever you encounter them in the build instructions:

SRC=$HOME/src
PREFIX=$HOME/sw

Create these two directories before proceeding:

mkdir -p $SRC $PREFIX

and also add $PREFIX/bin to your PATH:

export PATH=$PREFIX/bin:$PATH

pkg-config

  1. Obtain the latest release of pkg-config and extract it in $SRC.
  2. Build and install with:
    ./configure --prefix=$PREFIX --with-internal-glib
    make && make install
    
  3. Set the pkg-config search path variable:
    mkdir -p $PREFIX/lib/pkgconfig
    export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$PREFIX/lib/pkgconfig
    

You will probably want to set PATH and PKG_CONFIG_PATH in your shell initialisation files if you will be building fldigi regularly.

libpng

  1. Obtain the latest release of libpng and extract it in $SRC.
  2. Build and install with:
    ./configure --prefix=$PREFIX/png --enable-static --disable-shared
    make && make install
    
  3. Create pkg-config symlinks:
    (cd $PREFIX/lib/pkgconfig; ln -s ../../png/lib/pkgconfig/* .)
    

FLTK

  1. Obtain the latest release of FLTK (1.1.10-rc2 or later) and extract it in $SRC.
  2. Build and install with:
    ./configure --prefix=$PREFIX/fltk --enable-static --disable-shared --enable-threads --enable-quartz
    make && make install
    
  3. Create the fltk-config symlink:
    ln -s ../fltk/bin/fltk-config $PREFIX/bin
    

PortAudio

  1. Obtain the latest PortAudio "v19" trunk snapshot and extract it in $SRC.
  2. Build and install with:
    ./configure --prefix=$PREFIX/portaudio --enable-static --disable-shared --disable-mac-universal
    make && make install
    
  3. Create pkg-config symlinks:
    (cd $PREFIX/lib/pkgconfig; ln -s ../../portaudio/*.pc ./ )
    

samplerate

  1. Obtain the latest libsamplerate release and extract it in $SRC.
  2. Build and install with:
    ./configure --prefix=$PREFIX/samplerate --enable-static --disable-shared
    make && make install
    
  3. Create pkg-config symlinks:
    (cd $PREFIX/lib/pkgconfig; ln -s ../../samplerate/lib/pkgconfig/* .)
    

sndfile

  1. Obtain the latest libsndfile release and extract it in $SRC.
  2. Build and install with:
    ./configure --prefix=$PREFIX/sndfile --enable-static --disable-shared
    make && make install
    
  3. Create pkg-config symlinks:
    (cd $PREFIX/lib/pkgconfig; ln -s ../../sndfile/lib/pkgconfig/* .)
    

xmlrpc-c

  1. Obtain the latest stable release or stable snapshot of xmlrpc-c and extract it in $SRC.
  2. Build and install with:
    ./configure --prefix=$PREFIX/xmlrpc --enable-static --disable-shared
    make && make install
    
  3. Create xmlrpc-c-config symlink:
    ln -s ../xmlrpc/bin/xmlrpc-c-config $PREFIX/bin
    

libtool

  1. Obtain the latest release of libtool and extract it in $SRC.
  2. Build and install with:
    ./configure --prefix=$PREFIX/libtool --enable-static --disable-shared
    make && make install
    
  3. Add the libtool header files to the include path:
    export CPPFLAGS="-I$PREFIX/libtool/include"
    

hamlib

  1. Obtain the latest release of hamlib and extract it in $SRC.
  2. Build and install with:
    ./configure --prefix=$PREFIX/hamlib --enable-static --disable-shared --without-rpc-backends \
    --without-cxx-binding --without-perl-binding --without-tcl-binding --without-python-binding
    make && make install
    
  3. Create pkg-config symlinks:
    (cd $PREFIX/lib/pkgconfig; ln -s ../../hamlib/lib/pkgconfig/* .) 
    

Getting the source

Download the latest source tarball or check out the latest snapshot from the master branch of the GIT repository.

Compiling fldigi

At this point you will have a source tree (extracted from the tarball or cloned from GIT) containing a configure script. The following command will prepare the source for compilation:

./configure --enable-static --enable-optimizations=sse2 --disable-mac-universal --without-hamlib \
--host=$(gcc -dumpmachine) --target=$(gcc -dumpmachine) --build=$(gcc -dumpmachine)

The configure command generates the Makefiles that make uses to run the compiler and linker. configure has various options to fine-tune the build; you can see a list by running:

./configure --help

For more information about configure, required library versions, etc., refer to the INSTALL file contained in the source tree.

Some often-used configure switches for fldigi are listed below:

--prefix=/some/directory
Determines where fldigi will be installed (see next section). The default and recommended prefix is /usr/local.

Check the configuration summary printed by configure to ensure that fldigi will be built with the required features. If a feature that you want is disabled, you are probably just missing a library development package that can be found in your distribution's repositories.

When you are happy with the build configuration run this command to compile the binaries:

make

If you wish to run the fldigi binary on systems that do not have their own hamlib binaries, you will want to run this additional command:

make hamlib-static

This runs a script that re-links fldigi in a way that enables hamlib to open its rig backends at runtime despite being statically linked.

Installing the binaries

When the compilation is finished, run this command to install fldigi:

sudo make install

This command will install the fldigi and flarq binaries, manual pages, icons and desktop launchers. If you install to the default /usr/local (or other appropriate directory on your system), you should see icons for fldigi and flarq in your applications menu. This will need to be run as sudo or su.

Installing the binaries

You can install fldigi in the usual way but, if you prefer to use application bundles, the source tree contains a script that can build one and place it in a compressed disk image. Call it with:

make appbundle

The script builds two separate bundles and disk images:

  • The fldigi-X.YZ-nolibs.app bundle contains binaries only
  • The fldigi-X.YZ.app bundle also includes non-system libraries

The instructions above assume that you are building all libraries for static linking, in which case the two bundles will be equivalent. The second bundle is useful if you use dynamic linking (e.g. because you installed some libraries from a Mac repository).

Acknowledgements

The following people are thanked for their help with the OS X port:

  • Diane Bruce, VA3DB, for her initial porting work
  • Kok Chen, W7AY, for his help with the uHRouter PTT support
  • Justin Burket, KL1RL, for providing access to an OS X machine
  • Mike Haynes, N4ZNV, for maintaining a PPC/10.4 build machine for several fldigi release cycles
  • Brian Lloyd, WB6RQN, for giving us access to his x86_64/10.6 machine