buildbuild

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

This package creates ninja build files from source Builddesc files. The package documentation is currently a work in progress. Normally you do not use this package directly but rather use the seb tool to invoke it.

Index

Constants

View Source
const Builddesc = "Builddesc"

Variables

View Source
var (
	MissingOpenBracket   = errors.New("Missing open bracket in parameter")
	ConditionsNotAllowed = errors.New("Conditions are not allowed here")
)
View Source
var (
	UnknownSourceExtension = errors.New("Invalid source extension (not all extensions can be used in all Descriptors)")
	EnumWithoutGperf       = errors.New("Extension .enum without .gperf.enum")
	SourceNeedsLinker      = errors.New("Incompatible source type for this descriptor")
)
View Source
var (
	UnhandledBuildDirective = errors.New("Unhandled build directive")
	MissingOpenParen        = errors.New("Missing open parenthesis")
	MissingCloseParen       = errors.New("Missing close parenthesis")
	DuplicateConfig         = errors.New("Duplicate CONFIG or CONFIG wasn't first")
	UnexpectedEOF           = errors.New("Unexpected end of file")
)
View Source
var (
	RuledepsError            = errors.New("Bad ruledeps argument")
	FlavoredConfigUnknownArg = errors.New("Unrecognized flavored argument in CONFIG")
	ConfigMustBeFlavored     = errors.New("CONFIG argument must be flavored")
	ConfigUnknownArg         = errors.New("Unrecognized argument in CONFIG")
	BadFlavor                = errors.New("Flavor does not exist")
)
View Source
var (
	BadSrcoptsFormat  = errors.New("Bad srcopts format, need srcopts[src:opt]")
	BadSpecialSrcs    = errors.New("Bad specialsrcs format, need specialsrcs[rule:src,...:target] or specialsrcs[rule:src,...:target:var=val...]")
	UnhandledArgument = errors.New("Unknown argument")
)
View Source
var (
	// Descriptor defaults defined by plugins.
	PluginDescriptors = map[string]Descriptor{}
	// Params added by plugins that are allowed in all descriptors.
	PluginGeneralParams = map[string]ParseGeneralParam{}
	PluginLinkerParams  = map[string]ParseLinkerParam{}
	// File extensions added by plugins.
	PluginGeneralExtensions = map[string]CompileGeneralSrcFunc{}
	PluginLinkerExtensions  = map[string]CompileLinkerSrcFunc{}
	// Specialsrcs rules that plugin will process.
	PluginSpecialSrcs = map[string]CompileSpecialSrcFunc{}
)
View Source
var (
	BadSymlinkFormat = errors.New("Bad symlink format, need symlink[dst:target]")
)
View Source
var (
	CantFindBuildtools = errors.New("Can't find directory containing buildtools. Use seb -install to install them manually.")
)
View Source
var DefaultDescriptors = map[string]Descriptor{
	"PROG":          &ProgTemplate,
	"GOPROG":        &GoprogTemplate,
	"GOMODULE":      &GomoduleTemplate,
	"GOTEST":        &GotestTemplate,
	"TOOL_PROG":     &ToolProgTemplate,
	"TOOL_INSTALL":  &ToolInstallTemplate,
	"LIB":           &LibTemplate,
	"LINKERSET_LIB": &LinkersetLibTemplate,
	"MODULE":        &ModuleTemplate,
	"INSTALL":       &InstallTemplate,
}
View Source
var DestLookup = map[string]string{
	"obj":        "$objdir/",
	"objdir":     "$objdir/",
	"dest_inc":   "$incdir/",
	"dest_bin":   "$dest_bin/",
	"dest_tool":  "$buildtools/",
	"dest_lib":   "$libdir/",
	"dest_mod":   "$dest_mod/",
	"destroot":   "$destroot/",
	"builddir":   "$builddir/",
	"flavorroot": "$flavorroot/",
}
View Source
var GomoduleTemplate = GoProgDesc{
	Mode: "module",
	LinkDesc: LinkDesc{
		GeneralDesc: GeneralDesc{
			Destdir:       "dest_mod",
			TargetOptions: map[string]bool{"all": true, "incdeps": true, "libdeps": true},
		},
	},
}
View Source
var GoprogTemplate = GoProgDesc{
	Mode: "prog",
	LinkDesc: LinkDesc{
		GeneralDesc: GeneralDesc{
			Destdir:       "dest_bin",
			TargetOptions: map[string]bool{"all": true, "incdeps": true, "libdeps": true},
		},
	},
}
View Source
var GotestTemplate = GoTestDesc{
	LinkDesc: LinkDesc{
		GeneralDesc: GeneralDesc{
			Destdir:       "gotest",
			TargetOptions: map[string]bool{"all": true, "incdeps": true, "libdeps": true},
		},
	},
}
View Source
var InstallCommands = map[string]string{
	"conf":    "install_conf",
	"scripts": "install_script",
	"python":  "install_py",
	"php":     "install_php",
}
View Source
var InstallTemplate = InstallDesc{}
View Source
var LibTemplate = LibDesc{
	LinkDesc: LinkDesc{
		GeneralDesc: GeneralDesc{
			Destdir:       "dest_lib",
			TargetOptions: map[string]bool{"lib": true},
		},
		Picrules: true,
	},
	LinkSet: false,
}
View Source
var LinkersetLibTemplate = LibDesc{
	LinkDesc: LinkDesc{
		GeneralDesc: GeneralDesc{
			Destdir:       "dest_lib",
			TargetOptions: map[string]bool{"lib": true},
		},
		Picrules: true,
	},
	LinkSet: true,
}
View Source
var LoadedPlugins = map[string]Plugin{}
View Source
var ModuleTemplate = ModuleDesc{
	LinkDesc: LinkDesc{
		GeneralDesc: GeneralDesc{
			Destdir:       "dest_mod",
			TargetOptions: map[string]bool{"all": true},
		},
		Picrules: true,
		Link:     "link",
	},
}
View Source
var (
	MultipleDefinedTarget = errors.New("Multiple defined target. Rename your generated intermediate files.")
)
View Source
var (
	NoSuchPlugin = errors.New("Plugin doesn't exist in binary")
)
View Source
var ProgTemplate = ProgDesc{
	LinkDesc: LinkDesc{
		GeneralDesc: GeneralDesc{
			Destdir:       "dest_bin",
			TargetOptions: map[string]bool{"all": true},
		},
		Picrules: false,
		Link:     "link",
	},
}
View Source
var ToolInstallTemplate = InstallDesc{
	GeneralDesc: GeneralDesc{
		Destdir: "dest_tool",
	},
}
View Source
var ToolProgTemplate = ProgDesc{
	LinkDesc: LinkDesc{
		GeneralDesc: GeneralDesc{
			Destdir: "dest_tool",
		},
		Picrules: false,
		Link:     "link",
	},
}

Functions

func AddGodeps

func AddGodeps(t *Target, ops *GlobalOps)

func BuildBuildArgs added in v1.4.0

func BuildBuildArgs(args []string) string

Strips args of anything after -- and returns it joined. In the future might remove some arguments before -- as well.

func BuildtoolDir added in v1.5.0

func BuildtoolDir() string

Buildtooldir figures out what directory contains the sebuild ninja runtime. First it tries to import the go package and check for sources, if that fails it looks for a directory based on the binary path. If that also fails it checks $HOME/.seb/

func CheckConditions

func CheckConditions(condstr string, conditions map[string]bool) bool

func CompileSrc

func CompileSrc(desc Descriptor, srcdir, src string)

Sources in the srcs argument are compiled based on their file extension. What extensions are allowed depend on the descriptor. The only extension allowed anywhere is .in, which generates a file with the in.pl script.

Descriptors that link a binary allow several more extensions: .c, .cc, .cxx, .ll, .yy, .gperf, .gperf.enum, .xs and .go

Plugins might add additional extensions.

The produced objects are put in the object directory of the descriptor, where they can be referenced by other arguments or used in the descriptor target.

If a source generates a C file or similar, it is typically compiled all the way to an object file and then added to the linked objects. Other sources, e.g. in files, have to be used manually by other arguments or they will be discarded.

func InitPlugin

func InitPlugin(pkg string, plug Plugin)

func LinkerExtra

func LinkerExtra(extra ...string) []string

Return keys handled by LinkDesc.Parse to pass to GenericParse

func NormalizePath

func NormalizePath(basedir, p string) string

Types

type Analyser

type Analyser struct {
	TargetName     string
	OnlyForFlavors []string
}

type Args

type Args struct {
	Unflavored map[string][]string
	Flavored   map[string]map[string][]string
	Flavors    map[string]map[string][]string
}

Arguments are a key and a list of elements. After the key you use a bracket pair [] and put the white space separated elements inside. Many arguments can only contain one element, those will either join a list into a single string, or use only the first element. Some arguments take no values, but the brackets are still required. Arguments are things like: srcs, includes, libs, deps, etc.

After the key you can use a colon : and a flavor. If used, the argument applies to that flavor only. You can then but another color and a comma separated list of conditions that need to match. Conditions can be negated by prefixing them with an exclamation sign !. You can leave the flavor empty if you wish to apply conditions without chosing a flavor.

Examples: srcs[a.c b.c] copts:prof[-pg] libs::linux[rt]

func (*Args) Parse

func (args *Args) Parse(s *Scanner, conditions map[string]bool) (haveEnabled bool)

Parse from s until a ) token is found, indicating the end of a descriptor. Fills in *args with the arguments found, if the conditions set on the argument match the ones given (if no conditions are set it's always a match).

Returns true if a `enabled` argument was found, regardless if it was saved or not. Returning true and then not finding enabled in the arguments would imply the descriptor should be skipped.

type CompileGeneralSrcFunc

type CompileGeneralSrcFunc func(g *GeneralDesc, srcdir, src, srcbase string)

type CompileLinkerSrcFunc

type CompileLinkerSrcFunc func(l *LinkDesc, srcdir, src, srcbase string)

type CompileSpecialSrcFunc

type CompileSpecialSrcFunc func(desc Descriptor, tname, rule string, srcs []string, destdir, srcdir string, extraargs []string, options map[string]bool) Descriptor

type Config

type Config struct {
	Seen bool

	Conditions  map[string]bool
	Buildparams []string

	AllFlavors    map[string]bool
	ActiveFlavors []string // Flavors left after filtering --with-flavors and --without-flavors.

	Plugins    []string
	Configvars []string // Files with ninja variables, available to invars.
	Rules      []string // Files with ninja rules.
	Extravars  []string

	CompilerRuleDir       string
	FlavorRuleDir         string
	CompilerFlavorRuleDir string

	Ruledeps   map[string][]string // Additional dependencies for particular rules.
	Buildvars  []string
	Compiler   []string
	Godeps     []string
	GodepsRule string

	BuildversionScript string
	Buildpath          string
	ConfigScript       string
}

The CONFIG descriptor must be the first one encountered either in Builddesc.top or the top level Builddesc. It contains global configuration for the build, for example valid flavors and enabled plugins.

For many projects, the defaults are fine, and the CONFIG descriptor can then be skipped.

Arguments:

buildversion_script - script that outputs one number which is the version of what's being built. It's highly recommended that the version number is unique for at least every commit to your repository.

compiler - Override the compiler used, set it to the C compiler, C++ one will be guessed with some heuristics.

flavors - Various build environments needed to build your site. The usual is to build prod and regress.

rules - Global compilation rules. These ninja files gets included globally.

configvars - Global ninja variables. These ninja files gets included globally, and are also passed as arguments to the invars script.

extravars - Per flavor-included ninja files. This means they can depend on the variables defined in the flavor files. Can be flavored.

buildpath - Where the build files are put. See other sections of this document to see how files are organized.

buildvars - attributes in other build descriptors that are copied into ninja files as variables. As in this example, those are various variables we want to be able to specify in build decsriptors that override default variables.

ruledeps - Per-rule dependencies. Targets built with a certain rule will depend on those additional target. In this example everything built with the in rule will also depend on $inconf.

prefix:flavor - Set a prefix for the installed files for the specified flavor. Must be flavored.

config_script - Run a script whenever build-build is run and parse its output as variables or conditions.

cflags:flavor - CFLAGS for a flavor. Must be flavored.

compiler_rule_dir, flavor_rule_dir, compiler_flavor_rule_dir - Directories containing ninja files included based on current compiler and/or flavor.

type DescParser

type DescParser struct {
	Ops     *GlobalOps
	DefDesc Descriptor
}

func (*DescParser) Parse

func (dp *DescParser) Parse(srcdir string, s *Scanner, flavors []string) ParseFunc

type Descriptor

type Descriptor interface {
	NewFromTemplate(bd, tname string, flavors []string) Descriptor
	GetBuilddesc() string

	Parse(ops *GlobalOps, realsrcdir string, args map[string][]string) Descriptor
	Finalize(ops *GlobalOps)

	CompileSrc(srcdir, src, srcbase, ext string)

	AddTarget(tname, rule string, srcs []string, destdir, srcdir string, extraargs []string, options map[string]bool) *Target
	AddMultiTarget(tnames []string, target *Target)
	AllTargets() map[string]*Target

	ResolveSrcs(ops *GlobalOps, tname string, srcs ...string) []string
	ResolveDeps(ops *GlobalOps, tname string) []string
	ResolveOrderDeps(target *Target) []string

	ValidForFlavor(flavor string) bool
	DefaultObjectDir() string
	OutputHeader(w io.Writer, objdir string)
}

func CompileSpecial

func CompileSpecial(desc Descriptor, tname, rule string, srcs []string, destdir, srcdir string, extraargs []string, options map[string]bool) Descriptor

This is like AddTarget, but allow plugins to intercept in case they do some special processing. It also splits tname on comma and sets a multi target if more than one element.

type Finalizer

type Finalizer func(*GlobalOps, Descriptor)

type FlavorConfig

type FlavorConfig struct {
	Prefix    string
	Extravars []string
	Cflags    string
}

type GeneralDesc

type GeneralDesc struct {
	Destdir       string          // Destination for the target.
	TargetOptions map[string]bool // Default options for the target (see Descriptor.AddTarget)

	Srcdir    string
	Builddesc string

	TargetName     string
	OnlyForFlavors []string

	Targets          map[string]*Target
	Srcdirs          map[string]string   // The directory where we've seen the first reference to a source to a source file. If the source file is not generated by something else it will be in this directory.
	Deps             map[string][]string // src->dependency dependencies.
	Srcopts          map[string][]string
	Gendeps          []string // Global dependencies.
	CollectTargetVar []string

	Extravars []string
	Buildvars map[string][]string
}

Operations on different build descriptors. A number of default descriptors are defined, when a descriptor is matched, that default one is copied and the Parse function called. It will then fill in the rest of the struct, including the target map.

func (*GeneralDesc) AddMultiTarget added in v1.8.0

func (g *GeneralDesc) AddMultiTarget(tnames []string, tgt *Target)

func (*GeneralDesc) AddTarget

func (desc *GeneralDesc) AddTarget(tname, rule string, srcs []string, destdir, srcdir string, extraargs []string, options map[string]bool) *Target

func (*GeneralDesc) AllTargets

func (g *GeneralDesc) AllTargets() map[string]*Target

func (*GeneralDesc) CompileIn

func (g *GeneralDesc) CompileIn(srcdir, src, srcbase string)

func (*GeneralDesc) CompileSrc

func (g *GeneralDesc) CompileSrc(srcdir, src, srcbase, ext string)

func (*GeneralDesc) DefaultObjectDir

func (g *GeneralDesc) DefaultObjectDir() string

func (*GeneralDesc) Finalize

func (g *GeneralDesc) Finalize(ops *GlobalOps)

func (*GeneralDesc) GenericParse

func (g *GeneralDesc) GenericParse(desc Descriptor, ops *GlobalOps, realsrcdir string, args map[string][]string, extra []string) Descriptor

func (*GeneralDesc) GetBuilddesc

func (g *GeneralDesc) GetBuilddesc() string

func (*GeneralDesc) NewFromTemplate

func (defdesc *GeneralDesc) NewFromTemplate(bd, tname string, flavors []string) *GeneralDesc

func (*GeneralDesc) OutputHeader

func (g *GeneralDesc) OutputHeader(w io.Writer, objdir string)

func (*GeneralDesc) ResolveDeps

func (g *GeneralDesc) ResolveDeps(ops *GlobalOps, tname string) []string

func (*GeneralDesc) ResolveOrderDeps

func (g *GeneralDesc) ResolveOrderDeps(target *Target) []string

func (*GeneralDesc) ResolveSrcdir

func (g *GeneralDesc) ResolveSrcdir(src, tname string) string

func (*GeneralDesc) ResolveSrcs

func (g *GeneralDesc) ResolveSrcs(ops *GlobalOps, tname string, srcs ...string) []string

func (*GeneralDesc) ValidForFlavor

func (g *GeneralDesc) ValidForFlavor(flavor string) bool

type GlobalOps

type GlobalOps struct {
	// Command line options.
	Options struct {
		WithFlavors    map[string]bool
		WithoutFlavors map[string]bool
		Debug          bool
		Quiet          bool
	}
	// Result of parsing CONFIG.
	Config        Config
	FlavorConfigs map[string]*FlavorConfig

	// If non-nil, called after parsing CONFIG.
	PostConfigFunc func(ops *GlobalOps) error

	// List of Builddesc files that were parsed to generate this. Might contain duplicates.
	Builddescs []string

	// Cached output of BuildversionScript
	Buildversion string

	// All defined descriptors, some are for all flavors, some are duplicated for each flavor.
	Descriptors []Descriptor
	// Descriptors for internal libraries (dummy or not). XXX what about flavored libs?
	Libs map[string]LibDescriptor
	// Some descriptors also generate analyse targets, stored here.
	Analyses []*Analyser

	// Version checks, e.g. to verify C compiler.
	VersionChecks  map[string]func() error
	CC             string
	CXX            string
	CompilerFlavor string

	// Targets can be collected in variables and then used in other targets.
	CollectedVars map[string][]string

	// Callback to build plugins. As of go 1.8beta1, plugins can only be loaded from "main" package.
	// See https://github.com/golang/go/issues/18120
	BuildPlugin func(ops *GlobalOps, ppath string) error
}

Global build configuration.

After the initial parsing we'll only have one GlobalOps. Each ops descriptor will contain any possible flavorings. Before finalize we create flavor_ops for each flavor. The way to consolidate targets that are untainted by a flavor is to:

* Create a global flavor

* Install unflavored includes and libs in the global flavor

* Install includes and libs in each flavor

* Link final targets in the flavored directories only.

* Create $tool_ variables automagically

Resolving flavor should be a matter of walking dependencies and seeing if the dependency is flavored. Flavored dependencies spread the flavor to whatever depends on them. Flavor taint is triggered on:

* specialsrcs: Unknown rules (or in).

* .in: The quintessential flavoring.

* extravars: Always

* deps, copts, cflags, cwarnflags, conlyflags, cxxflags, indirs: If contain $

func NewGlobalOps

func NewGlobalOps() *GlobalOps

func (*GlobalOps) BuildtoolDir

func (ops *GlobalOps) BuildtoolDir() string

Buildtooldir calls the package level BuildtoolDir. Kept for v1 compatibility only.

func (*GlobalOps) DefaultCompiler

func (ops *GlobalOps) DefaultCompiler()

func (*GlobalOps) DefaultConfig

func (ops *GlobalOps) DefaultConfig()

func (*GlobalOps) FindCompilerCC

func (ops *GlobalOps) FindCompilerCC() error

func (*GlobalOps) GlobDir

func (ops *GlobalOps) GlobDir(srcdir string, srcs []string) []string

Expands globs relative to a source directory. Strings that aren't globs or don't match will be returned unchanged. If we get a glob match we register the directory as a dependency for rebuilding the build files.

func (*GlobalOps) GodepsStamp

func (ops *GlobalOps) GodepsStamp() string

func (*GlobalOps) LoadPlugin

func (ops *GlobalOps) LoadPlugin(bd, ppath string) (Plugin, error)

func (*GlobalOps) OpenBuilddesc

func (ops *GlobalOps) OpenBuilddesc(file string) (s *Scanner, err error)

func (*GlobalOps) OpenComponent

func (ops *GlobalOps) OpenComponent(dir string) (s *Scanner, err error)

func (*GlobalOps) OutputDescriptor

func (ops *GlobalOps) OutputDescriptor(desc Descriptor, builddir, objdir string) (defaults []string)

func (*GlobalOps) OutputFlavor

func (ops *GlobalOps) OutputFlavor(topdir, flavor string)

func (*GlobalOps) OutputTop

func (ops *GlobalOps) OutputTop() (err error)

func (*GlobalOps) ParseComponent

func (ops *GlobalOps) ParseComponent(srcdir string, s *Scanner, flavors []string) ParseFunc

func (*GlobalOps) ParseConfig

func (ops *GlobalOps) ParseConfig(srcdir string, s *Scanner, flavors []string) ParseFunc

func (*GlobalOps) ParseDescriptorEnd

func (ops *GlobalOps) ParseDescriptorEnd(srcdir string, s *Scanner, flavors []string) ParseFunc

func (*GlobalOps) ParseDirective

func (ops *GlobalOps) ParseDirective(srcdir string, s *Scanner, flavors []string) ParseFunc

func (*GlobalOps) PluginDeps

func (ops *GlobalOps) PluginDeps() (deps []PluginDep)

func (*GlobalOps) ReadComponent

func (ops *GlobalOps) ReadComponent(dir string, flavors []string) (err error)

func (*GlobalOps) RecompileWithPlugins

func (ops *GlobalOps) RecompileWithPlugins()

func (*GlobalOps) RegisterGlob

func (ops *GlobalOps) RegisterGlob(srcdir, src string)

func (*GlobalOps) ResolveCollectedVar

func (ops *GlobalOps) ResolveCollectedVar(src string) string

func (*GlobalOps) ResolveLibs

func (ops *GlobalOps) ResolveLibs(libs []string) []string

Topological sort of library dependencies. Implemented as a depth-first descent of the dependencies. The return value is in dependency order. This is only really necessary for resolving link order static libraries, but it also allows us to generate a deduplicated list of depedencies.

func (*GlobalOps) ResolveLibsExternal

func (ops *GlobalOps) ResolveLibsExternal(libs []string) []string

Resolves all external libs

func (*GlobalOps) ResolveLibsLinker added in v1.1.0

func (ops *GlobalOps) ResolveLibsLinker(link string, libs []string) string

func (*GlobalOps) ResolveLibsOur

func (ops *GlobalOps) ResolveLibsOur(libs []string) []LibDescriptor

Resolve non-dummy libs that we build. Dummy libs are libs that don't have objs.

func (*GlobalOps) ResolveLibsOurPic

func (ops *GlobalOps) ResolveLibsOurPic(libs []string) []string

func (*GlobalOps) ResolveLibsOurPicAsLib

func (ops *GlobalOps) ResolveLibsOurPicAsLib(libs []string) ([]string, []string)

func (*GlobalOps) ResolveLibsOurStatic

func (ops *GlobalOps) ResolveLibsOurStatic(libs []string) []string

func (*GlobalOps) ResolveLibsOurStaticAsLib

func (ops *GlobalOps) ResolveLibsOurStaticAsLib(libs []string) ([]string, []string)

func (*GlobalOps) RunConfigScript

func (ops *GlobalOps) RunConfigScript(srcdir string, s *Scanner, flavors []string) ParseFunc

func (*GlobalOps) RunFinalizers

func (ops *GlobalOps) RunFinalizers() (err error)

func (*GlobalOps) SetBuildversion

func (ops *GlobalOps) SetBuildversion()

func (*GlobalOps) StartPlugin

func (ops *GlobalOps) StartPlugin(bd, ppath string) error

func (*GlobalOps) StartupPlugins

func (ops *GlobalOps) StartupPlugins(srcdir string, s *Scanner, flavors []string) ParseFunc

func (*GlobalOps) StatRulePath

func (ops *GlobalOps) StatRulePath(pth string) bool

func (*GlobalOps) TempDirWithPlugins

func (ops *GlobalOps) TempDirWithPlugins(plugs []string) string

type GoProgDesc

type GoProgDesc struct {
	LinkDesc
	Pkg    string
	Mode   string
	NoCgo  bool
	GOOS   string
	GOARCH string
}

func (*GoProgDesc) Finalize

func (g *GoProgDesc) Finalize(ops *GlobalOps)

func (*GoProgDesc) NewFromTemplate

func (tmpl *GoProgDesc) NewFromTemplate(bd, tname string, flavors []string) Descriptor

func (*GoProgDesc) Parse

func (g *GoProgDesc) Parse(ops *GlobalOps, realsrcdir string, args map[string][]string) Descriptor

type GoTestDesc

type GoTestDesc struct {
	LinkDesc
	Pkg        string
	Benchflags string
}

func (*GoTestDesc) Finalize

func (g *GoTestDesc) Finalize(ops *GlobalOps)

func (*GoTestDesc) NewFromTemplate

func (tmpl *GoTestDesc) NewFromTemplate(bd, tname string, flavors []string) Descriptor

func (*GoTestDesc) Parse

func (g *GoTestDesc) Parse(ops *GlobalOps, realsrcdir string, args map[string][]string) Descriptor

type InstallDesc

type InstallDesc struct {
	GeneralDesc

	Installs map[string][]string
	Symlinks [][2]string
}

func (*InstallDesc) Finalize

func (id *InstallDesc) Finalize(ops *GlobalOps)

func (*InstallDesc) NewFromTemplate

func (tmpl *InstallDesc) NewFromTemplate(bd, tname string, flavors []string) Descriptor

func (*InstallDesc) Parse

func (id *InstallDesc) Parse(ops *GlobalOps, realsrcdir string, args map[string][]string) Descriptor

type LibDesc

type LibDesc struct {
	LinkDesc
	LinkSet bool
}

func (*LibDesc) Finalize

func (l *LibDesc) Finalize(ops *GlobalOps)

func (*LibDesc) IsDummyLib

func (l *LibDesc) IsDummyLib() bool

func (*LibDesc) LibDeps

func (l *LibDesc) LibDeps() []string

func (*LibDesc) LibName

func (l *LibDesc) LibName() string

func (*LibDesc) Linker added in v1.1.0

func (l *LibDesc) Linker() string

func (*LibDesc) NameAsLib

func (l *LibDesc) NameAsLib() (string, bool)

func (*LibDesc) NameAsPiclib

func (l *LibDesc) NameAsPiclib() (string, bool)

func (*LibDesc) NewFromTemplate

func (tmpl *LibDesc) NewFromTemplate(bd, tname string, flavors []string) Descriptor

func (*LibDesc) Parse

func (l *LibDesc) Parse(ops *GlobalOps, realsrcdir string, args map[string][]string) Descriptor

func (*LibDesc) PiclibName

func (l *LibDesc) PiclibName() string

type LibDescriptor

type LibDescriptor interface {
	IsDummyLib() bool
	LibName() string
	PiclibName() string
	NameAsLib() (name string, islib bool)
	NameAsPiclib() (name string, islib bool)
	LibDeps() []string
	Linker() string
}

type LinkDesc

type LinkDesc struct {
	GeneralDesc

	Picrules bool
	Link     string

	Incdirs  []string
	Objs     []string
	Libs     []string
	Includes []string
	Incdeps  []string // Include file dependecies. Either include files we install into the global include directory or include files generated by us.
	GoSrc    []string

	NoAnalyse   bool
	DontAnalyse map[string]bool

	IncdepsGenerated []string
}

func (*LinkDesc) CompileC

func (l *LinkDesc) CompileC(srcdir, src, srcbase string)

func (*LinkDesc) CompileCXX

func (l *LinkDesc) CompileCXX(srcdir, src, srcbase string)

func (*LinkDesc) CompileEnum

func (l *LinkDesc) CompileEnum(srcdir, src, srcbase string)

func (*LinkDesc) CompileGo

func (l *LinkDesc) CompileGo(srcdir, src, srcbase string)

func (*LinkDesc) CompileGperf

func (l *LinkDesc) CompileGperf(srcdir, src, srcbase string)

func (*LinkDesc) CompileLL

func (l *LinkDesc) CompileLL(srcdir, src, srcbase string)

func (*LinkDesc) CompileSrc

func (l *LinkDesc) CompileSrc(srcdir, src, srcbase, ext string)

func (*LinkDesc) CompileXs

func (l *LinkDesc) CompileXs(srcdir, src, srcbase string)

func (*LinkDesc) CompileYY

func (l *LinkDesc) CompileYY(srcdir, src, srcbase string)

func (*LinkDesc) FinalizeAnalyse

func (l *LinkDesc) FinalizeAnalyse(ops *GlobalOps)

func (*LinkDesc) FinalizeCC

func (l *LinkDesc) FinalizeCC(ops *GlobalOps)

func (*LinkDesc) FinalizeGoSrcs

func (l *LinkDesc) FinalizeGoSrcs(ops *GlobalOps, mode string) []string

func (*LinkDesc) FinalizeIncdeps

func (l *LinkDesc) FinalizeIncdeps(ops *GlobalOps)

Some targets (GOPROG) might need incdeps without actually setting cc

func (*LinkDesc) LinkerParse

func (l *LinkDesc) LinkerParse(srcdir string, args map[string][]string)

func (*LinkDesc) NewFromTemplate

func (tmpl *LinkDesc) NewFromTemplate(bd, tname string, flavors []string) *LinkDesc

func (*LinkDesc) OutputHeader

func (l *LinkDesc) OutputHeader(w io.Writer, objdir string)

func (*LinkDesc) ResolveDeps

func (l *LinkDesc) ResolveDeps(ops *GlobalOps, tname string) []string

func (*LinkDesc) ResolveIncdeps

func (l *LinkDesc) ResolveIncdeps(ops *GlobalOps) []string

func (*LinkDesc) ResolveOrderDeps

func (l *LinkDesc) ResolveOrderDeps(target *Target) []string

func (*LinkDesc) SuffixedObjs

func (l *LinkDesc) SuffixedObjs(suff string, filter func(base string) bool) []string

type ModuleDesc

type ModuleDesc struct {
	LinkDesc
}

func (*ModuleDesc) Finalize

func (m *ModuleDesc) Finalize(ops *GlobalOps)

func (*ModuleDesc) NewFromTemplate

func (tmpl *ModuleDesc) NewFromTemplate(bd, tname string, flavors []string) Descriptor

func (*ModuleDesc) Parse

func (m *ModuleDesc) Parse(ops *GlobalOps, realsrcdir string, args map[string][]string) Descriptor

type ParseError

type ParseError struct {
	Err       error
	Token     string
	Builddesc string
}

func (*ParseError) Error

func (e *ParseError) Error() string

type ParseFunc

type ParseFunc func(string, *Scanner, []string) ParseFunc

type ParseGeneralParam

type ParseGeneralParam func(ops *GlobalOps, g *GeneralDesc, args []string)

type ParseLinkerParam

type ParseLinkerParam func(l *LinkDesc, args []string)

type Plugin

type Plugin interface {
	Startup(ops *GlobalOps) error
}

type PluginDep

type PluginDep struct {
	os.FileInfo
	// contains filtered or unexported fields
}

type ProgDesc

type ProgDesc struct {
	LinkDesc
}

func (*ProgDesc) Finalize

func (p *ProgDesc) Finalize(ops *GlobalOps)

func (*ProgDesc) NewFromTemplate

func (tmpl *ProgDesc) NewFromTemplate(bd, tname string, flavors []string) Descriptor

func (*ProgDesc) Parse

func (p *ProgDesc) Parse(ops *GlobalOps, realsrcdir string, args map[string][]string) Descriptor

type Scanner

type Scanner struct {
	*bufio.Scanner
	io.Closer
	Filename string
	// contains filtered or unexported fields
}

func NewScanner

func NewScanner(r io.ReadCloser, file string) *Scanner

func (*Scanner) Splitter

func (s *Scanner) Splitter(data []byte, atEOF bool) (advance int, token []byte, err error)

type Target

type Target struct {
	Rule      string   // Rule to generate the target.
	Sources   []string // Source files, path unresolved.
	Deps      []string
	Srcopts   []string
	Destdir   string          // Destination directory, might be an alias defined in DestLookup
	Extraargs []string        // Various extra arguments like "cflags = -O0"
	Options   map[string]bool // Various output options, notably "all" makes this a default target.
	CollectAs string

	IncdepsExcept map[string]bool

	MultiTarget []string // A single build generating multiple targets.
}

Targets we want to generate.

func (*Target) ResolveDest

func (target *Target) ResolveDest() string

Jump to

Keyboard shortcuts

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