Manifest

Top level

TableContentsRequiredDescription
[package]packageyes
[[lib]]target[]Libraries. A package that depends on this one links all of them, and none of its other targets are built
[[bin]]target[]
[[tool]]target[]Executables built only on request, by name or with --tool. They link [deps.tool], not [deps.package]
[[test]]target[]Executables that spn test runs. They also link [deps.test]
[[example]]target[]Executables built into example/ in the build directory
[[toolchain]]toolchain_decl[]Compilers to add to the built in ones. Read from the root package only
[[index]]index[]Package indexes, searched before the user config's. Read from the root package only
[profile.<name>]map of profileBuild settings, selected with --profile. default is the base of every other profile. Read from the root package only
[options.<name>]map of optionOptions this package offers. Each name is also a key for when
[deps]deps
[config.<name>]map of config_entrySettings for the dependency called <name>. Read from the root package only
[patch.<name>]map of patch_entryPatches for the source of the dependency called <name>. An error anywhere but the root package
[stage]stageRead from the root package only

package

FieldTypeRequiredDescription
namestringyes
versionstringyesA semantic version
repostring
authorstring
maintainerstring
upstreamupstreamThe Git repository holding the source, for a manifest that lives apart from the code it builds
include(source_entry | string)[]Include directories for every target. Dependents don't get them; see publish
define(value_entry | string)[]Preprocessor definitions for every target. Dependents don't get them; see publish
system_deps(system_dep_entry | string)[]System libraries for every target
host_deps(host_dep_entry | string)[]Libraries installed on the build machine, for every target. An error when cross compiling, and with a toolchain that doesn't link against the machine's own libraries, like the bundled zig
macosplatform_macos
buildbuild_scriptThe build metaprogram, holding the functions that nodes call. It links [deps.build]
configurebuild_scriptThe configure metaprogram, which runs on every build and declares nodes. It links no dependencies
publishpublish

target

FieldTypeRequiredDefaultDescription
namestringyes
kindsstring[]["static"][[lib]] only. Any of static and shared
source(source_entry | string)[]Files and globs to compile. The language comes from each file's extension
include(source_entry | string)[]Include directories. Dependents don't get them
define(value_entry | string)[]Preprocessor definitions, spelled for whichever compiler is in use. Dependents don't get them
flags(value_entry | string)[]Compiler flags, passed as written
link_flags(value_entry | string)[]Linker flags, passed as written, for this target's own link. On a [[lib]] they require shared in kinds
linker_script(source_entry | string)[]Linker scripts for this target's own link. On a [[lib]] they require shared in kinds
shared(shared_entry | string)[][[lib]] only. Prebuilt shared libraries to use in place of source and kinds
system_deps(system_dep_entry | string)[]System libraries to link. A static library's follow it to whatever links it
host_deps(host_dep_entry | string)[]Libraries installed on the build machine. See host_deps in [package]
deps(target_dep_entry | string)[]Libraries of this package to link. Other packages come from [deps]
embed(embed_entry | string)[]Files to embed in the binary, declared in <name>.embed.h
linkbooltrue[[lib]] only. false compiles the library but links it into nothing
cxxcxx_options
macosplatform_macos
windowsplatform_windows
publishtarget_publish

toolchain_decl

FieldTypeDescription
namestringRequired. A built in toolchain of the same name is replaced
versionstring
compilerstringRequired. The C compiler
linkergnu | lld | ld64 | msvc
link_argsstring[]Arguments added to every link
archiverstringRequired
drivergcc | clang | msvc | zigRequired. The command line the compiler speaks
cxxstringThe C++ compiler
detectmsvcFind the toolchain through a Visual Studio installation. Excludes host
hostmap of artifactThe hosts the toolchain runs on, keyed like x86_64-linux
mirrorsstringURL of a list of mirrors to download from
mirror_snapshotstringThe mirror list to use when mirrors can't be fetched
target(toolchain_target | string)[]What the toolchain can build for. Without it, only the host

index

FieldTypeRequiredDescription
namestringyes
urlstringA Git repository of releases
pathstringA directory of <name>/spn.toml packages, relative to the file that declares the index
protocolgit | http | dirDefaults to dir when path is set, and git otherwise
revstringA commit to hold a Git index at. A pinned index is never refreshed, and can't be published to
publish_urlstringWhere spn publish pushes, when it isn't url

profile

Fields that take a list are tried in order. The first entry whose when matches wins, only the last may omit when, and when accepts only os and arch.

FieldTypeDefaultDescription
static_depsboolfalseFail the build if a dependency can only be linked as a shared library. One set to shared in [config] is still allowed
runtime(value_entry | string)[]static or shared. How the compiler runtime, the C++ standard library, and the Windows CRT are linked
libc(value_entry | string)[]static or shared. How the C library is linked
standard(value_entry | string)[]c11The C standard for every package in the build: c89, c99, c11, gnu89, gnu99, or gnu11
toolchain(value_entry | string)[]Name of the toolchain to use. Without it, spn takes the first that can build the target
mode(value_entry | string)[]debugdebug or release
opt(value_entry | string)[]0, 1, 2, 3, s, or z. Defaults to 0 in debug and 2 in release
strip(value_entry | string)[]none, debuginfo, or symbols. Defaults to none in debug and debuginfo in release
sanitize(address | thread | undefined | memory | leak)[]
emit(shared | static)[]Which kinds to build this package's own libraries as, for a library that offers both. Without it, static
oswindows | linux | macos | wasi | freestandingDefaults to the host's
archx86_64 | aarch64 | wasm32Defaults to the host's
abi(value_entry | string)[]gnu, musl, msvc, apple, none, or elf. Required when cross compiling to an OS that has more than one
msvcmsvc_request
optionswhenValues for this package's own options

option

FieldTypeRequiredDefaultDescription
typebool | enumyes
valuesstring[]The allowed values. Required for enum, and not allowed for bool
defaultoption_defaultsA bool with no default is false
additiveboolfalsebool only. The option is on if any package asks for it, where requests would otherwise have to agree
definestringbool only. A macro defined for this package's own compiles while the option is on
publicboolfalseDefine the macro for dependents too. Requires define

deps

FieldTypeDescription
packagemap of dep | stringLinked into every target but tools
testmap of dep | stringLinked into [[test]] targets as well. Read from the root package only
buildmap of dep | stringLinked into the build metaprogram only
toolmap of dep | stringLinked into [[tool]] targets. Read from the root package only

config_entry

FieldTypeDefaultDescription
kindshared | staticWhich kind of the dependency's libraries to link. Without it, static when the library offers it
optionswhenOption values for the dependency. They win over every other request
defaultsbooltruefalse ignores the dependency's own option defaults

patch_entry

FieldTypeRequiredDescription
filesstring[]yesPatches in Git's diff format, relative to this manifest, applied in order

stage

Copies metaprogram outputs into the project after a successful build.

FieldType
copystage_entry[]

upstream

FieldTypeRequiredDescription
urlstringyes
commitstringyesThe full 40 character hash. spn publish refuses anything shorter

source_entry

FieldTypeRequiredDefaultDescription
pathstringyesRelative, with no .. segments. In source it may be a glob, where * matches within one directory and ** at any depth
treemanifest | source | worksource
whenwhen

value_entry

FieldTypeRequired
valuestringyes
whenwhen

system_dep_entry

Exactly one of lib and framework.

FieldTypeDescription
libstringThe name as you'd pass it to -l
frameworkstringA macOS framework. Ignored for every other target
whenwhen

host_dep_entry

FieldTypeRequired
libstringyes
whenwhen

platform_macos

FieldTypeDescription
min_osos_versionOldest macOS the binary runs on. A binary takes the highest value among everything linked into it

build_script

when on these entries accepts build facts only, not options.

FieldTypeDescription
source(source_entry | string)[]C only
include(source_entry | string)[]
define(value_entry | string)[]
flags(value_entry | string)[]

publish

What packages that depend on this one get. Not related to spn publish.

FieldTypeDescription
includepublish_entry[]Headers to copy into the include directory dependents compile against
sharepublish_entry[]Files to copy into the package's share directory
system_deps(system_dep_entry | string)[]System libraries that dependents link
define(value_entry | string)[]Preprocessor definitions that dependents compile with

shared_entry

A prebuilt shared library. At most one entry may match a build.

FieldTypeDefaultDescription
pathstringThe shared library. It's copied next to the executables that link it
stubstringWhat to link against in place of path. Required where linking goes through an import library, as on Windows. With no path, nothing is copied and the library has to be on the machine at run time
treemanifest | source | worksource
whenwhen

target_dep_entry

FieldTypeRequiredDescription
libstringyesName of a [[lib]] in this package
whenwhen

embed_entry

FieldTypeRequiredDefaultDescription
pathstringyes
treemanifest | source | worksource
dirboolfalseEmbed every file under path
deststringPath the file is embedded as, which also names its symbol. Defaults to path
data_typestringunsigned charC type of the array's elements
size_typestringunsigned long longC type of the size symbol
whenwhen

cxx_options

FieldTypeDefaultDescription
standardc++11 | c++14 | c++17 | c++20 | c++23c++17
exceptionsbooltrueOff by default on WebAssembly
rttibooltrue

platform_windows

FieldTypeDefault
subsystemconsole | windowsconsole

target_publish

FieldTypeDescription
includepublish_entry[][[lib]] only. Same as include in [package.publish]
sharepublish_entry[]

artifact

FieldTypeDescription
urlstringAn archive of the toolchain for spn to download
sha256stringRequired with url

toolchain_target

FieldTypeDescription
kindstringhost is the only kind: the machine the toolchain runs on. It takes no other fields
archx86_64 | aarch64 | wasm32
oswindows | linux | macos | wasi | freestanding
abignu | musl | msvc | apple | none | elf
sdkstringPath to the SDK or sysroot for this target
spellingstringThe triple to pass to the compiler, when it isn't spn's spelling
exceptionstoolchain_exceptionsFlags that turn C++ exceptions on, for a target that has them off by default
runtimetoolchain_runtime
sanitizerstoolchain_sanitizersThe sanitizers the toolchain has for this target

msvc_request

FieldType
toolsetstring
sdkstring

dep

FieldTypeDefaultDescription
versionstringA version requirement. A bare version means compatible with it, so 1.4.2 allows >=1.4.2, <2.0.0. Excludes path
pathstringDirectory holding the dependency's spn.toml, relative to this manifest. Excludes version
publicboolfalsePass the dependency's headers and definitions on to packages that depend on this one
whenwhen
optionswhenOption values to ask the dependency for. Every package that asks must agree

stage_entry

FieldTypeRequiredDescription
fromstringyesA declared node output, file or directory, relative to the work tree
tostringyesDestination, relative to the project directory

publish_entry

FieldTypeRequiredDefaultDescription
fromstringyesA file or a glob. Matching nothing fails the build
treemanifest | source | worksourcework isn't allowed
tostringSubdirectory to copy into. A file keeps its name, and a glob match keeps its path below the glob's fixed prefix
whenwhen

toolchain_exceptions

FieldType
flagsstring[]
link_flagsstring[]

toolchain_runtime

FieldType
supported(static | shared)[]
cstring[]
cxxstring[]

toolchain_sanitizers

FieldType
supported(address | thread | undefined | memory | leak)[]
addressstring[]
threadstring[]
undefinedstring[]
memorystring[]
leakstring[]

Extern types

These values are validated by spn itself, outside the manifest schema:

  • when
  • option_defaults
  • os_version