build

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SHN_UNDEF     = 0x0000 // Undefined section
	SHN_LORESERVE = 0xFF00 // Start of reserved indices
	SHN_ABS       = 0xFFF1 // Absolute values
	SHN_COMMON    = 0xFFF2 // Common symbols
	SHN_XINDEX    = 0xFFFF // Escape value for extended section indices
)

ELF special section indices (from ELF specification)

Variables

This section is empty.

Functions

func Clean added in v0.3.0

func Clean(patterns []string, conf *Config)

func IsDbgEnabled added in v0.11.0

func IsDbgEnabled() bool

func IsDbgSymsEnabled added in v0.11.0

func IsDbgSymsEnabled() bool

func IsFullRpathEnabled added in v0.11.6

func IsFullRpathEnabled() bool

func IsOptimizeEnabled added in v0.9.8

func IsOptimizeEnabled() bool

func IsStdioNobuf added in v0.11.1

func IsStdioNobuf() bool

func IsTraceEnabled added in v0.11.0

func IsTraceEnabled() bool

func IsWasiThreadsEnabled added in v0.11.1

func IsWasiThreadsEnabled() bool

func ValidateBuildMode added in v0.11.6

func ValidateBuildMode(mode string) error

ValidateBuildMode checks if the build mode is valid

func WasmRuntime added in v0.11.1

func WasmRuntime() string

Types

type AbiMode added in v0.11.6

type AbiMode = cabi.Mode

type BuildMode added in v0.11.6

type BuildMode string
const (
	BuildModeExe      BuildMode = "exe"
	BuildModeCArchive BuildMode = "c-archive"
	BuildModeCShared  BuildMode = "c-shared"
)

type Config

type Config struct {
	Goos          string
	Goarch        string
	Target        string // target name (e.g., "rp2040", "wasi") - takes precedence over Goos/Goarch
	BinPath       string
	AppExt        string  // ".exe" on Windows, empty on Unix
	OutFile       string  // only valid for ModeBuild when len(pkgs) == 1
	OutFmts       OutFmts // Output format specifications (only for Target != "")
	CompileOnly   bool    // compile test binary but do not run it (only valid for ModeTest)
	Emulator      bool    // run in emulator mode
	Port          string  // target port for flashing
	BaudRate      int     // baudrate for serial communication
	RunArgs       []string
	Mode          Mode
	BuildMode     BuildMode // Build mode: exe, c-archive, c-shared
	AbiMode       AbiMode
	GenExpect     bool // only valid for ModeCmpTest
	Verbose       bool
	GenLL         bool // generate pkg .ll files
	CheckLLFiles  bool // check .ll files valid
	CheckLinkArgs bool // check linkargs valid
	ForceEspClang bool // force to use esp-clang
	ForceRebuild  bool // force rebuilding of packages that are already up-to-date
	Tags          string
	SizeReport    bool   // print size report after successful build
	SizeFormat    string // size report format: text,json (default text)
	SizeLevel     string // size aggregation level: full,module,package (default module)
	CompilerHash  string // metadata hash for the running compiler (development builds only)
	// GlobalRewrites specifies compile-time overrides for global string variables.
	// Keys are fully qualified package paths (e.g. "main" or "github.com/user/pkg").
	// Each Rewrites entry maps variable names to replacement string values. Only
	// string-typed globals are supported and "main" applies to all root main
	// packages in the current build.
	GlobalRewrites map[string]Rewrites
}

func NewDefaultConf

func NewDefaultConf(mode Mode) *Config

type Mode

type Mode int
const (
	ModeBuild Mode = iota
	ModeInstall
	ModeRun
	ModeTest
	ModeCmpTest
	ModeGen
)

type OutFmtDetails added in v0.11.6

type OutFmtDetails struct {
	Out string // Base output file path
	Bin string // Binary output file path (.bin)
	Hex string // Intel hex output file path (.hex)
	Img string // Image output file path (.img)
	Uf2 string // UF2 output file path (.uf2)
	Zip string // ZIP/DFU output file path (.zip)
}

OutFmtDetails contains detailed output file paths for each format

func (*OutFmtDetails) ToEnvMap added in v0.11.6

func (details *OutFmtDetails) ToEnvMap() map[string]string

ToEnvMap converts OutFmtDetails to a map for template substitution

type OutFmts added in v0.11.6

type OutFmts struct {
	Bin bool // Generate binary output (.bin)
	Hex bool // Generate Intel hex output (.hex)
	Img bool // Generate image output (.img)
	Uf2 bool // Generate UF2 output (.uf2)
	Zip bool // Generate ZIP/DFU output (.zip)
}

OutFmts contains output format specifications for embedded targets

type OutputCfg added in v0.11.6

type OutputCfg struct {
	OutPath   string // Final output file path
	IntPath   string // Intermediate file path (for two-stage conversion)
	OutExt    string // Output file extension
	FileFmt   string // File format (from conf.FileFormat or extracted from emulator)
	BinFmt    string // Binary format for firmware conversion (may have -img suffix)
	NeedFwGen bool   // Whether firmware image generation is needed
	DirectGen bool   // True if can generate firmware directly without intermediate file
}

OutputCfg contains the generated output paths and conversion configuration

type Package added in v0.9.8

type Package = *aPackage

func Do

func Do(args []string, conf *Config) ([]Package, error)

type Rewrites added in v0.11.6

type Rewrites map[string]string

Jump to

Keyboard shortcuts

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