Building from Source on Apple Mac
=================================
You will need Xcode, MacPorts, HomeBrew, CMake and, Qt. The Xcode install
instructions are included in the MacPorts documentation.
Xcode
——–
There are two parts to install Xcode one is just to install from the Mac AppStore. Then also from
the command line from the MacPorts website to install needed Xcode utils run the following command
$ xcode-select –install
You will need to agree to the Xcode license agreement by issuing the following command:
$ sudo xcodebuild -license
HomeBrew
——–
Install Homebrew with the following command.
$ /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”
$ (echo; echo ‘eval “$(/usr/local/bin/brew shellenv)”‘) >> /Users/michaelmorgan/.zprofile
$ eval “$(/usr/local/bin/brew shellenv)”
Then install the following:
$ brew install gcc@9
MacPorts
——–
Install MacPorts from instructions here:
The ports that need to be installed are:
$ sudo port install autoconf
$ sudo port install automake
$ sudo port install libtool
$ sudo port install pkgconfig
$ sudo port install texinfo
$ sudo port install fftw-3-single +gcc9
$ sudo port install asciidoc
$ sudo port install asciidoctor
$ sudo port install libusb-devel
$ sudo port install boost
$ sudo port install qt5
$ sudo port install qt5-qtmultimedia
$ sudo port install qt5-qtwebsockets
Hamlib
——
First fetch hamlib from the repository, in this case my fork of Hamlib
3 until the official repository has all the fixes we need:
$ mkdir -p ~/hamlib-prefix/build
$ cd ~/hamlib-prefix
$ git clone git://git.code.sf.net/p/jtdx/hamlib src
$ cd src
$ ./bootstrap
To build:
$ cd ~/hamlib-prefix/build
$ ../src/configure \
–enable-shared \
–disable-static \
–disable-winradio \
–prefix=$HOME/hamlib-prefix \
–without-readline \
–without-indi \
–without-cxx-binding \
CFLAGS=”-g -O2 -mmacosx-version-min=10.13 -I/opt/local/include” \
LIBUSB_LIBS=”-L/opt/local/lib -lusb-1.0″
$ make
$ make install-strip
The above commands will build hamlib and install it into
~/hamlib-prefix. If `make install-strip` fails, try `make install`.
CMake
—–
Download the latest CMake universal 64-bit DMG from
http://www.cmake.org/download/ open the DMG then drag and drop the
application bundle onto the supplied /Applications link.
To complete the install process you need to run the CMake-gui
application as root from a terminal shell as follows:
$ sudo “/Applications/CMake.app/Contents/MacOS/cmake” –install
JTDX
——
First fetch the source from the repository:
$ mkdir -p ~/jtdx-prefix/build
$ cd ~/jtdx-prefix
$ git clone git://git.code.sf.net/p/jtdx/code src
$ cd ~/jtdx-prefix/build
For my Intel Mac:
$ FC=/usr/local/Cellar/gcc@9/9.5.0/bin/gfortran-9 \
cmake \
-D CMAKE_PREFIX_PATH=”/opt/local/libexec/qt5;~/hamlib-prefix;/opt/local” \
-D CMAKE_INSTALL_PREFIX=~/jtdx-prefix \
-D CMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk \
~/jtdx-prefix/src
For my M1 Mac:
FC=gfortran \
cmake \
-D CMAKE_PREFIX_PATH=”/opt/local/libexec/qt5;~/hamlib-prefix;/opt/local” \
-D CMAKE_INSTALL_PREFIX=~/jtdx-prefix \
-D CMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.sdk \
~/jtdx-prefix/src
Substitute the Mac OS X SDK version you have installed in the above
command if you have a different version from 10.15.
Also make sure you have the path to right Fortran in the first line above.
The CMAKE_PREFIX_PATH variable specifies where CMake should look first
for other packages, the two elements may be different depending where
you have installed Qt and what version you have (~/local/qt-macx-clang
if you have built Qt from sources as described above in the Qt
section) and where you installed Hamlib (i.e. the –prefix configure
option above in the Hamlib section).
If you already have the fftw3-dev package installed on your system it
may well get selected in preference to the one you built above in the
MacPorts installation. It is unlikely that a prior installation of
libfftw3f is correctly configured for use in a JTDX package, the
CMAKE_PREFIX_PATH above is augmented with the MacPorts installation
location (/opt/local) to ensure the correct libfftw3f.dylib and
headers are located.
To build:
$ cmake –build .
$ cmake –build . –target install
$ cmake –build . –target package — -kj
sudo mkdir gcc-devel
sudo ln /opt/homebrew/lib/gcc/12/libquadmath.0.dylib /opt/local/lib/gcc-devel/libquadmath.0.dylib
sudo ln /opt/homebrew/lib/gcc/12/libgcc_s.1.1.dylib /opt/local/lib/gcc-devel/libgcc_s.1.1.dylib
which installs the JTDX application bundle into ~/jtdx-prefix
Updating and Rebuilding Hamlib
==============================
From time to time new fixes will be pushed to the Hamlib fork
repository integration branch. To pick them up type:
$ cd ~/hamlib-prefix/src
$ git pull
To rebuild hamlib with the changed sources:
$ cd ~/hamlib-prefix/build
$ make
$ make install-strip
Updating and Rebuilding JTDX
==============================
To update to the latest sources type:
$ cd ~/jtdx-prefix/src
$ git pull
$ cd ~/jtdx-prefix/build
$ cmake –build .
$ cmake –build . –target install
codesign -s “Mac Developer: charles morgan (G89EBN4PSS)” –deep -f ~/jtdx-prefix/jtdx.app/
M1 Mac Notes
For WSJTX
cd ~
git clone git@github.com:iains/gcc-darwin-arm64.git
cd gcc-darwin-arm64
mkdir build
cd build
../configure –build=aarch64-apple-darwin21 –disable-nls –enable-checking=release –enable-languages=c,c++,objc,obj-c++,fortran –program-suffix=-10 –with-gmp=/opt/homebrew/opt/gmp –with-mpfr=/opt/homebrew/opt/mpfr –with-mpc=/opt/homebrew/opt/libmpc –with-isl=/opt/homebrew/opt/isl –with-system-zlib –disable-multilib –with-native-system-header-dir=/usr/include –disable-darwin-at-rpath –with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
make
sudo make install