Build Scripts

I have some home-grown automation that I use to test and publish software across multiple platforms. For each repository where I use this automation, project-specific build steps are stored as a collection of bash scripts in a directory called buildscripts.

If you are distributing or hacking on any of these projects, feel free to ignore the build scripts completely. I try to stick to "normal" project structures that will build and run without any additional ceremony. Nonetheless on this page I will describe how the scripts work, mostly as a reference for my future self. If you are trying to work out how the downloadable artefacts are created then you might also find it interesting.

Operations

Scripts are expected to return a 0 exit code on success, some other exit code on failure, and emit their logs (successful or not) to stdout/stderr.

Parameters

$PLATFORM indicates the target platform we are building for. This needs to be specified because a given build host may be able to target multiple platforms, e.g., both x86 and Apple Silicon.

$TAG is the version string, something like v0.5.0, which will be embedded in the filenames of the artefacts. I call it the tag because it's expected to be the name of the git tag for the release that we are publishing, though in reality any valid string will do.

Dist Artefacts

The two dist scripts will emit specially-formatted lines to stdout describing files that should be downloaded from the build server before cleaning it up.

PLATFORM_ARTIFACT|$PATH

GENERIC_ARTIFACT|$PATH|$DESCRIPTION

URL|$DESCRIPTION|$URL|$LINKTEXT

The program that consumes this output is neither public nor particularly interesting.

Notarisation on Mac

dist.sh may check for two environment variables, CODESIGNCMD and NOTARISECMD, which are set on the Mac builder.

Bash on Windows

The Windows build host uses the same bash scripts as other platforms. This is done using the Git Bash environment that comes with Git for Windows. Happily, it is possible to configure OpenSSH on Windows so that SSHing into that Windows machine gives you a Git Bash shell, just as if it was a Linux host.