Open plinto
Docs›Languages

Your own scripts

Language·3 min read
In one sentence

CustomBuild builds a project with your own scripts/build.sh, with the tools and releases your group pins on hand, for anything plinto has no build system for.

Build systemCustomBuild
Start oneplinto create custom-build HelloTool
Ships aswhatever your script writes

The project

HelloTool/
  plinto.conf
  scripts/build.sh   writes the release into $PLINTO_OUT (required)
  scripts/test.sh    runs the tests (optional)

Both run with bash, in the project's folder.

plinto.conf
{
  name = HelloTool
  version = 1.0
  build = CustomBuild

  build-dependencies: {
    CustomBuild = 1.0
    Gcc = 15             # a tool: its bin/ on the scripts' PATH
  }
  dependencies: {
    LibOne = 1.0         # its release in $PLINTO_DEPENDENCIES/LibOne
  }
}

What the scripts get

Variable What it holds
PLINTO_OUT the folder the release goes into
PLINTO_TOOLS/<Name> each build dependency, with its bin/ on the PATH
PLINTO_DEPENDENCIES/<Name> each dependency's release
PLINTO_PROJECT, PLINTO_VERSION the project's name and version
PLINTO_PLATFORM the platform it builds for
PLINTO_RELEASE, PLINTO_SKIP_TESTS whether it is a release, and whether tests are skipped

They also run with SOURCE_DATE_EPOCH, TZ=UTC and LC_ALL=C.UTF-8 set, so tools that honour them make the same files every time.

Settings

configuration/CustomBuild.config takes platform = host, the default, for a release made for the machine that builds it, or platform = any for one that runs anywhere.

build.sh runs once, for $PLINTO_PLATFORM: what it compiles is for the machine building, and a custom build has no list of platforms, as Go's platforms is. plinto's build service builds on linux-x64, so a platform = host release runs on x86-64 servers only. For ARM64 servers too, release what runs anywhere with platform = any, and have each archive carry its platform's programs as tools: see A service.

What it releases

What the script writes to $PLINTO_OUT, as HelloTool-1.0.tar.gz.

A service

A project with a scripts/run.sh is a service: plinto run starts it, and a deployment starts it on your servers. The Archive packager packs what build.sh made as the archive's app/, with your scripts/, and run.sh gets these:

Variable What it holds
APP_HOME the release's folder on the server; the project's folder with plinto run
APP_DIR what build.sh made: app/ on the server, build/out with plinto run
APP_TOOLS the tools Archive.tools lists, one folder each: tools/ on the server, the build's tools with plinto run

A program a tool brings is for one platform, so leave it out of your release and let each archive carry its own. With platform = any in configuration/CustomBuild.config, Archive makes an archive per platform, each with the tools' releases for that platform:

plinto.conf
Archive: { platforms = [linux-x64, linux-aarch64], tools = [Caddy, CaddyAgent] }

run.sh then starts "$APP_TOOLS/Caddy/caddy", the server's own. A tool's release has to be made for each platform listed, and a tool released in your workspace is packed for your machine's platform only.