buildscript

package
v0.0.0-...-a033c93 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package buildscript turns a recipe's build/test node into the shell script brewkit runs, a faithful port of libpkgx's usePantry.getScript: moustache expansion, `if:` guards evaluated against the build TARGET, platform-reduced env, working-directory wrapping and prop/fixture here-docs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(node any, opts Options) (string, error)

Generate renders node (a recipe's build or test value) into a shell script.

func Wrap

func Wrap(o WrapOptions) string

Wrap assembles the complete, runnable build script: a sanitized env, the dependency environment (`eval "$(pkgx +…)"`), target-specific compiler/linker FLAGS, a per-host TMPDIR, then the user script run from SRCROOT.

func WriteLibexec

func WriteLibexec(dir string) error

func WriteLibexecFor

func WriteLibexecFor(dir string, libcPkgx bool, triple, platform, arch string) error

WriteLibexecFor is WriteLibexec plus the compiler shims when libcPkgx is set.

Types

type Options

type Options struct {
	Target     target.Target     // the build-for platform/arch (guards key on this)
	PkgVersion string            // used to evaluate semver `if:` guards
	Tokens     []moustache.Token // prefix/version/deps/hw/pkgx/srcroot/props, pre-assembled
}

Options carries everything script generation needs beyond the node itself.

type WrapOptions

type WrapOptions struct {
	UserScript  string        // the pantry script, already rendered by Generate
	Deps        []string      // dependency pkgspecs for `pkgx +<spec>` (runtime + build)
	Target      target.Target // what we build FOR — drives FLAGS
	Host        target.Target // where we run — drives TMPDIR
	Home        string        // a fresh HOME for the build
	SrcRoot     string        // the build directory (also SRCROOT / cd target)
	PkgxDir     string        // $PKGX_DIR — the rpath root and CMAKE_PREFIX_PATH
	Install     string        // the final install prefix ($PKGX_DIR/project/vX.Y.Z)
	Project     string        // the project being built, so we never preset a tool IT provides
	BrewkitPath string        // dir prepended to PATH for the build shims (optional)
	PkgxBin     string        // path to the pkgx binary (for the deps eval + $PKGX)
	BashPath    string        // shebang interpreter (default /bin/bash)
	HasCompiler bool          // a compiler (llvm.org / gnu.org/gcc) is already a dep
	HasBinutils bool          // gnu.org/binutils is a dep (darwin AR/RANLIB workaround)
	// LibcPkgx targets the pkgx gnu.org/glibc bottle instead of the build
	// container's system glibc (linux only): the output links its crt objects,
	// libc and dynamic linker from the bottle, so the bottle owes nothing to the
	// debian build container — the sovereign FROM-scratch end state. Opt-in
	// (default off); the caller also adds gnu.org/glibc to Deps so the bottle is
	// present in the eval. C-only for now: the pkgx llvm.org bottle ships no
	// libc++/libunwind, so C++ recipes still need the system libstdc++.
	LibcPkgx bool
	// Glibc, when set (with LibcPkgx), pins the exact pkgx gnu.org/glibc version
	// used as the sysroot — so the output links THAT glibc's symbols and runs on
	// any host whose kernel satisfies it (a chosen HPC floor, e.g. "2.27.0").
	// Empty = newest available. wrapFlags then resolves that sole installed
	// version dir, so no change is needed there.
	Glibc string
}

WrapOptions carries the environment the porcelain wrapper sets up around the user script (the output of Generate). It is a port of libpkgx brewkit's make_build_script.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL