Skip to content

Building from source

Martin Hebnes Pedersen edited this page Oct 18, 2023 · 28 revisions

Introduction

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

Requirements

  • Git
  • Latest stable Go (>=1.19)

With certain build configurations, Pat is dependent on some C libraries. Having a C compiler (gcc/clang) available in addition to the Go toolchain is recommended to ensure you'll get the full feature set in your build.

The fast route

go install github.com/la5nta/pat@latest

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

The proper route

Clone the repository:

git clone https://github.com/la5nta/pat
cd pat

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

Linux only: download and build libax25

$ ./make.bash libax25

Build using the make.bash-script:

$ ./make.bash

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

Faster web development

# Start webpack-dev-server
cd web
npm start

# Run pat http pointing to the dev server
PAT_WEB_DEV_ADDR="http://localhost:8081" go run . http

Note: The static web resources (./web/dist/) are bundled by the Go compiler at build time using the embed package.

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

MacOS packaging

Install Packages, then run ./make.bash. Along with the pat executable, make.bash will generate another file pat_$VERSION_darwin_amd64_unsigned.pkg.