configs

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "v0.0.0" // It would be set by build script.

Functions

func NewPkgCache

func NewPkgCache(ctx context.Context, dir string, writable bool) *pkgCache

func NewSetupArgs

func NewSetupArgs(repaire, installPorts bool) *setupArgs

Types

type CCache

type CCache struct {
	Enabled       bool   `toml:"enabled"`                  // ENV: CCACHE_ENABLED
	MaxSize       string `toml:"maxsize"`                  // ENV: CCACHE_MAXSIZE
	Dir           string `toml:"dir"`                      // ENV: CCACHE_DIR
	RemoteStorage string `toml:"remote_storage,omitempty"` // ENV: CCACHE_REMOTE_STORAGE
	RemoteOnly    bool   `toml:"remote_only,omitempty"`    // ENV: CCACHE_REMOTE_ONLY
}

func (CCache) Generate

func (c CCache) Generate(toolchain *strings.Builder) error

func (CCache) Setup

func (c CCache) Setup() error

Setup setup ccache.

type Celer

type Celer struct {
	// contains filtered or unexported fields
}

func NewCeler

func NewCeler() *Celer

func (*Celer) BuildType

func (c *Celer) BuildType() string

BuildType returns lower case build type.

func (*Celer) CCacheEnabled

func (c *Celer) CCacheEnabled() bool

func (*Celer) CloneConf

func (c *Celer) CloneConf(url, branch string, force bool) error

func (*Celer) CreatePlatform

func (c *Celer) CreatePlatform(platformName string) error

func (*Celer) CreatePort

func (c *Celer) CreatePort(nameVersion string) error

func (*Celer) CreateProject

func (c *Celer) CreateProject(projectName string) error

func (*Celer) Deploy

func (c *Celer) Deploy(force bool) error

func (*Celer) Downloads

func (c *Celer) Downloads() string

func (*Celer) ExprVars

func (c *Celer) ExprVars() *context.ExprVars

func (*Celer) GenerateToolchainFile

func (c *Celer) GenerateToolchainFile() error

func (*Celer) Init

func (c *Celer) Init() error

Init initializes celer with existing platform.

func (*Celer) InitWithPlatform

func (c *Celer) InitWithPlatform(platform string) error

InitWithPlatform initializes celer with platform.

func (*Celer) InstalledDevDir

func (c *Celer) InstalledDevDir() string

func (*Celer) InstalledDir

func (c *Celer) InstalledDir() string

func (*Celer) Jobs

func (c *Celer) Jobs() int

func (*Celer) Offline

func (c *Celer) Offline() bool

func (*Celer) PkgCache

func (c *Celer) PkgCache() context.PkgCache

func (*Celer) Platform

func (c *Celer) Platform() context.Platform

func (*Celer) Project

func (c *Celer) Project() context.Project

func (*Celer) ProxyHostPort

func (c *Celer) ProxyHostPort() (host string, port int)

func (*Celer) PythonConfig added in v0.2.0

func (c *Celer) PythonConfig() context.PythonConfig

func (*Celer) RootFS

func (c *Celer) RootFS() context.RootFS

func (*Celer) SetBuildType

func (c *Celer) SetBuildType(buildtype string) error

func (*Celer) SetCCacheDir

func (c *Celer) SetCCacheDir(dir string) error

func (*Celer) SetCCacheEnabled

func (c *Celer) SetCCacheEnabled(enabled bool) error

func (*Celer) SetCCacheMaxSize

func (c *Celer) SetCCacheMaxSize(maxSize string) error

func (*Celer) SetCCacheRemoteOnly

func (c *Celer) SetCCacheRemoteOnly(remoteOnly bool) error

func (*Celer) SetCCacheRemoteStorage

func (c *Celer) SetCCacheRemoteStorage(remoteStorage string) error

func (*Celer) SetDownloads

func (c *Celer) SetDownloads(downloads string) error

func (*Celer) SetJobs

func (c *Celer) SetJobs(jobs int) error

func (*Celer) SetOffline

func (c *Celer) SetOffline(offline bool) error

func (*Celer) SetPkgCacheDir

func (c *Celer) SetPkgCacheDir(dir string) error

func (*Celer) SetPkgCacheWritable

func (c *Celer) SetPkgCacheWritable(writable bool) error

func (*Celer) SetPlatform

func (c *Celer) SetPlatform(platformName string) error

func (*Celer) SetProject

func (c *Celer) SetProject(projectName string) error

func (*Celer) SetProxyHost

func (c *Celer) SetProxyHost(host string) error

func (*Celer) SetProxyPort

func (c *Celer) SetProxyPort(port int) error

func (*Celer) SetVerbose

func (c *Celer) SetVerbose(vebose bool) error

func (*Celer) Verbose

func (c *Celer) Verbose() bool

func (*Celer) Version

func (c *Celer) Version() string

type InstallOptions

type InstallOptions struct {
	Force     bool
	Recursive bool
}

type Package

type Package struct {
	Url             string `toml:"url"`
	Ref             string `toml:"ref"`
	Checksum        string `toml:"checksum,omitempty"`
	CacheRepo       bool   `toml:"cache_repo,omitempty"`
	Depth           int    `toml:"depth,omitempty"`
	Archive         string `toml:"archive,omitempty"`
	SrcDir          string `toml:"src_dir,omitempty"`
	IgnoreSubmodule bool   `toml:"ignore_submodule,omitempty"`
	BuildTool       bool   `toml:"build_tool,omitempty"`
}

type Platform

type Platform struct {
	Toolchain  *Toolchain  `toml:"toolchain"`
	WindowsKit *WindowsKit `toml:"windows_kit"`
	RootFS     *RootFS     `toml:"rootfs"`

	// Internal fields.
	Name string `toml:"-"`
	// contains filtered or unexported fields
}

func (Platform) GetHostName

func (p Platform) GetHostName() string

func (Platform) GetName

func (p Platform) GetName() string

func (Platform) GetRootFS

func (p Platform) GetRootFS() context.RootFS

func (Platform) GetToolchain

func (p Platform) GetToolchain() context.Toolchain

func (*Platform) Init

func (p *Platform) Init(platformName string) error

func (*Platform) Setup

func (p *Platform) Setup() error

setup rootfs and toolchain

func (*Platform) Write

func (p *Platform) Write(platformPath string) error

type Port

type Port struct {
	Package      Package                    `toml:"package"`
	BuildConfigs []buildsystems.BuildConfig `toml:"build_configs"`

	// Internal fields.
	Name          string                    `toml:"-"`
	Version       string                    `toml:"-"`
	Parent        string                    `toml:"-"`
	DevDep        bool                      `toml:"-"` // Whether the port is a dev_dependences.
	HostDep       bool                      `toml:"-"` // Whether the port is a dependencies of a dev_dependencies.
	MatchedConfig *buildsystems.BuildConfig `toml:"-"`
	PackageDir    string                    `toml:"-"`
	InstalledDir  string                    `toml:"-"`
	// contains filtered or unexported fields
}

func (Port) CheckHostSupported

func (p Port) CheckHostSupported(nameVersion string) bool

CheckHostSupported Host supported means that the port can be built natively.

func (Port) Clone

func (p Port) Clone() error

func (Port) GenBuildToolsVersions

func (p Port) GenBuildToolsVersions(tools []string) (string, error)

func (Port) GenPlatformTomlString

func (c Port) GenPlatformTomlString() (string, error)

func (Port) GenPortTomlString

func (p Port) GenPortTomlString(nameVersion string, devDep bool) (string, error)

func (Port) GetBuildConfig

func (p Port) GetBuildConfig(nameVersion string, devDep bool) (*pkgcache.BuildConfig, error)

func (Port) GetCommitHash

func (p Port) GetCommitHash(nameVersion string, devDep bool) (string, error)

func (*Port) Init

func (p *Port) Init(ctx context.Context, nameVersion string) error

func (*Port) Install

func (p *Port) Install(options InstallOptions) (installedFrom string, retErr error)

Install install a port and tell me where it was installed from.

func (*Port) InstallFromPackage

func (p *Port) InstallFromPackage(options InstallOptions) (bool, error)

func (*Port) InstallFromPackageCache

func (p *Port) InstallFromPackageCache(options InstallOptions) (bool, error)

func (*Port) InstallFromSource

func (p *Port) InstallFromSource(options InstallOptions) error

func (Port) Installed

func (p Port) Installed() (bool, error)

func (Port) IsHostSupported

func (p Port) IsHostSupported() bool

func (Port) NameVersion

func (p Port) NameVersion() string

func (Port) PackageFiles

func (p Port) PackageFiles(packageDir, platformName, projectName string) ([]string, error)

func (Port) Remove

func (p Port) Remove(options RemoveOptions) error

func (Port) RemoveLogs

func (p Port) RemoveLogs() error

func (Port) Write

func (p Port) Write(portPath string) error

type Project

type Project struct {
	TargetPlatform string   `toml:"target_platform,omitempty"`
	BuildType      string   `toml:"build_type"`
	IncludeDirs    []string `toml:"include_dirs,omitempty"`
	LibDirs        []string `toml:"lib_dirs,omitempty"`
	Ports          []string `toml:"ports"`
	Vars           []string `toml:"vars"`
	Envs           []string `toml:"envs"`
	Macros         []string `toml:"macros"`

	// Internal fields.
	Name string `toml:"-"`
	// contains filtered or unexported fields
}

func (Project) GetName

func (p Project) GetName() string

func (Project) GetPorts

func (p Project) GetPorts() []string

func (Project) GetTargetPlatform

func (p Project) GetTargetPlatform() string

func (*Project) Init

func (p *Project) Init(ctx context.Context, projectName string) error

func (Project) Write

func (p Project) Write(platformPath string, override bool) error

type Proxy

type Proxy struct {
	Host string `toml:"host"`
	Port int    `toml:"port"`
}

type Python added in v0.2.0

type Python struct {
	Version        string   `toml:"version,omitempty"`
	IndexUrl       string   `toml:"index_url,omitempty"`
	ExtraIndexUrls []string `toml:"extra_index_urls,omitempty"`
	TrustedHosts   []string `toml:"trusted_hosts,omitempty"`
}

func (*Python) GetExtraIndexUrls added in v0.2.0

func (p *Python) GetExtraIndexUrls() []string

func (*Python) GetIndexUrl added in v0.2.0

func (p *Python) GetIndexUrl() string

func (*Python) GetTrustedHosts added in v0.2.0

func (p *Python) GetTrustedHosts() []string

func (*Python) GetVersion added in v0.2.0

func (p *Python) GetVersion() string

type RemoveOptions

type RemoveOptions struct {
	Purge      bool
	Recursive  bool
	BuildCache bool
}

type RootFS

type RootFS struct {
	Url           string   `toml:"url"`               // Download url.
	SHA256        string   `toml:"sha256"`            // SHA256 of the toolchain archive, used for verification and caching.
	Archive       string   `toml:"archive,omitempty"` // Archive can be changed to avoid conflict.
	Path          string   `toml:"path"`              // Runtime path of tool, it's relative path  and would be converted to absolute path later.
	PkgConfigPath []string `toml:"pkg_config_path"`
	IncludeDirs   []string `toml:"include_dirs"`
	LibDirs       []string `toml:"lib_dirs"`
	// contains filtered or unexported fields
}

func (*RootFS) CheckAndRepair

func (r *RootFS) CheckAndRepair() error

func (RootFS) Generate

func (r RootFS) Generate(toolchain *strings.Builder) error

func (RootFS) GetAbsDir

func (r RootFS) GetAbsDir() string

func (RootFS) GetIncludeDirs

func (r RootFS) GetIncludeDirs() []string

func (RootFS) GetLibDirs

func (r RootFS) GetLibDirs() []string

func (RootFS) GetPkgConfigPath

func (r RootFS) GetPkgConfigPath() []string

func (RootFS) GetSHA256

func (r RootFS) GetSHA256() string

func (*RootFS) Validate

func (r *RootFS) Validate() error

type SetupArgs

type SetupArgs interface {
	Repair() bool
	InstallPorts() bool
}

type Toolchain

type Toolchain struct {
	Url             string `toml:"url"`                       // Download url or local file url.
	SHA256          string `toml:"sha256"`                    // SHA256 of the toolchain archive, used for verification and caching.
	Name            string `toml:"name"`                      // It should be "gcc", "msvc", "clang-cl", "clang" and "msys2".
	Version         string `toml:"version"`                   // It should be version of gcc/msvc/clang.
	Archive         string `toml:"archive,omitempty"`         // Archive can be changed to avoid conflict.
	Path            string `toml:"path"`                      // Runtime path of tool, it's relative path and would be converted to absolute path later.
	SystemName      string `toml:"system_name"`               // It would be "Windows", "Linux", "Android" and so on.
	SystemProcessor string `toml:"system_processor"`          // It would be "x86_64", "aarch64" and so on.
	Host            string `toml:"host"`                      // It would be "x86_64-linux-gnu", "aarch64-linux-gnu" and so on.
	EmbeddedSystem  bool   `toml:"embedded_system,omitempty"` // Whether it's for embedded system, like mcu or bare-metal.
	CrosstoolPrefix string `toml:"crosstool_prefix"`          // It would be like "x86_64-linux-gnu-"

	// C/C++ standard.
	CStandard   string `toml:"c_standard,omitempty"`
	CXXStandard string `toml:"cxx_standard,omitempty"`

	// Mandatory fields.
	CC  string `toml:"cc"`  // C language compiler.
	CXX string `toml:"cxx"` // C++ language compiler.

	// Optional compiler target triplets for toolchains that require explicit target selection.
	CCompilerTarget   string `toml:"c_compiler_target,omitempty"`
	CXXCompilerTarget string `toml:"cxx_compiler_target,omitempty"`

	// Core compiler tools (Essential).
	CPP string `toml:"cpp,omitempty"` // C preprocessor.
	AR  string `toml:"ar,omitempty"`  // Archive static library.
	LD  string `toml:"ld,omitempty"`  // Link executable.
	AS  string `toml:"as,omitempty"`  // Assemble assembly code.

	// Object file manipulation tools.
	OBJCOPY string `toml:"objcopy,omitempty"` // Copy object file.
	OBJDUMP string `toml:"objdump,omitempty"` // Dump object file.
	STRIP   string `toml:"strip,omitempty"`   // Strip executable and library.
	READELF string `toml:"readelf,omitempty"` // Read ELF file.
	SIZE    string `toml:"size,omitempty"`    // Display file size.
	STRINGS string `toml:"strings,omitempty"` // Display strings in file.

	// Symbol and archive tools.
	NM     string `toml:"nm,omitempty"`     // List symbols in object file.
	RANLIB string `toml:"ranlib,omitempty"` // Index static library.

	// Code coverage tools.
	GCOV string `toml:"gcov,omitempty"` // Gcov code coverage.

	// Debug and analysis tools.
	ADDR2LINE string `toml:"addr2line,omitempty"` // Convert address to line number.
	CXXFILT   string `toml:"cxxfilt,omitempty"`   // C++ symbol demangler.

	// Additional compiler tools.
	FC string `toml:"fc,omitempty"` // Compile Fortran code.

	// Platform-aware envs, flags.
	Envs           []string `toml:"envs"`
	CFlags         []string `toml:"cflags"`
	CXXFlags       []string `toml:"cxxflags"`
	LinkFlags      []string `toml:"linkflags"`
	CFlagsDebug    []string `toml:"cflags_debug"`
	CXXFlagsDebug  []string `toml:"cxxflags_debug"`
	LinkFlagsDebug []string `toml:"linkflags_debug"`

	// Internal fields.
	MSVC context.MSVC `toml:"-"`
	// contains filtered or unexported fields
}

func (*Toolchain) CheckAndRepair

func (t *Toolchain) CheckAndRepair(silent bool) error

func (Toolchain) ClearEnvs

func (t Toolchain) ClearEnvs()

func (*Toolchain) Detect

func (t *Toolchain) Detect(platformName string) error

Detect detect local installed gcc.

func (Toolchain) GetADDR2LINE

func (t Toolchain) GetADDR2LINE() string

func (Toolchain) GetAR

func (t Toolchain) GetAR() string

func (Toolchain) GetAS

func (t Toolchain) GetAS() string

func (Toolchain) GetAbsDir

func (t Toolchain) GetAbsDir() string

func (Toolchain) GetCC

func (t Toolchain) GetCC() string

func (Toolchain) GetCFlags

func (t Toolchain) GetCFlags() []string

func (Toolchain) GetCPP

func (t Toolchain) GetCPP() string

func (Toolchain) GetCStandard

func (t Toolchain) GetCStandard() string

func (Toolchain) GetCXX

func (t Toolchain) GetCXX() string

func (Toolchain) GetCXXFILT

func (t Toolchain) GetCXXFILT() string

func (Toolchain) GetCXXFlags

func (t Toolchain) GetCXXFlags() []string

func (Toolchain) GetCXXStandard

func (t Toolchain) GetCXXStandard() string

func (Toolchain) GetCrosstoolPrefix

func (t Toolchain) GetCrosstoolPrefix() string

func (Toolchain) GetCrosstoolPrefixPath

func (t Toolchain) GetCrosstoolPrefixPath() string

func (Toolchain) GetFC

func (t Toolchain) GetFC() string

func (Toolchain) GetGCOV

func (t Toolchain) GetGCOV() string

func (Toolchain) GetHost

func (t Toolchain) GetHost() string

func (Toolchain) GetLD

func (t Toolchain) GetLD() string

func (Toolchain) GetLinkFlags

func (t Toolchain) GetLinkFlags() []string

func (Toolchain) GetMSVC

func (t Toolchain) GetMSVC() *context.MSVC

func (Toolchain) GetNM

func (t Toolchain) GetNM() string

func (Toolchain) GetName

func (t Toolchain) GetName() string

func (Toolchain) GetOBJCOPY

func (t Toolchain) GetOBJCOPY() string

func (Toolchain) GetOBJDUMP

func (t Toolchain) GetOBJDUMP() string

func (Toolchain) GetRANLIB

func (t Toolchain) GetRANLIB() string

func (Toolchain) GetREADELF

func (t Toolchain) GetREADELF() string

func (Toolchain) GetRootDir

func (t Toolchain) GetRootDir() string

func (Toolchain) GetSHA256

func (t Toolchain) GetSHA256() string

func (Toolchain) GetSIZE

func (t Toolchain) GetSIZE() string

func (Toolchain) GetSTRINGS

func (t Toolchain) GetSTRINGS() string

func (Toolchain) GetSTRIP

func (t Toolchain) GetSTRIP() string

func (Toolchain) GetSystemName

func (t Toolchain) GetSystemName() string

func (Toolchain) GetSystemProcessor

func (t Toolchain) GetSystemProcessor() string

func (Toolchain) GetVersion

func (t Toolchain) GetVersion() string

func (Toolchain) SetEnvs

func (t Toolchain) SetEnvs(rootfs context.RootFS, buildsystem string)

func (*Toolchain) Validate

func (t *Toolchain) Validate() error

type WindowsKit

type WindowsKit struct {
	InstalledDir string `toml:"installed_dir"`
	Version      string `toml:"version"`
}

func (*WindowsKit) Detect

func (w *WindowsKit) Detect(msvc *context.MSVC) error

Detect no msvc in linux.

Jump to

Keyboard shortcuts

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