Skip to content

Building from source

Martin Hebnes Pedersen edited this page Mar 15, 2016 · 28 revisions

Introduction

This document describes how to build the source code using the Go toolchain.

Pat is dependent on some C libraries, so a C compiler (gcc/clang) must be available in addition to the Go toolchain.

Requirements

  • Git
  • Latest stable Go (>=1.5) with cgo enabled
  • A configured GOPATH

The fast route

If you're building with Go 1.5, be sure to export GO15VENDOREXPERIMENT=1 before running go get. This is not needed with Go 1.6 or later.

$ go get -u github.com/la5nta/pat

go get will download the latest release of Pat (including dependencies), build and install the binary at $GOPATH/bin/pat.

The long route

The source code must live inside your Go workspace ($GOPATH). Clone the repository to $GOPATH/src/github.com/la5nta/pat:

git clone https://github.com/la5nta/pat $GOPATH/src/github.com/la5nta/pat
cd $GOPATH/src/github.com/la5nta/pat

The master branch is the stable branch for Pat, this is where you'll find the latest released Pat version.

Initialize and update all git submodules:

$ git submodule update --init --recursive

Build using the make.bash-script:

$ ./make.bash

The build output is ./pat which is a self-contained binary.

Build tags

Build tags can be used to enable additional features for the build:

  • libhamlib: Link against libhamlib for serial/usb rig control (no rigctld required).
  • libax25: Link against libax25 to enable Linux's AX.25 implementation.

To enable both features when using go get:

$ go get -tags 'libax25 libhamlib' github.com/la5nta/pat

make.bash uses the $TAGS environment variable for this purpose:

$ TAGS="libax25 libhamlib" ./make.bash

Debian packaging

dpkg-buildpackage -d -us -uc

Windows caveats

Because of the C dependencies (in perticular the LZHUF implementation), you will need to install a minimal unix environment like mingw with msys-base and mingw32-base.

# Setup PATH to include MinGW (including msys)
export PATH="$PATH:/c/MinGW/bin:/c/MinGW/msys/1.0/bin"

# Download build and install
go get -u -v github.com/la5nta/pat