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
- Variables
- func AddGodeps(t *Target, ops *GlobalOps)
- func BuildBuildArgs(args []string) string
- func BuildtoolDir() string
- func CheckConditions(condstr string, conditions map[string]bool) bool
- func CompileSrc(desc Descriptor, srcdir, src string)
- func InitPlugin(pkg string, plug Plugin)
- func LinkerExtra(extra ...string) []string
- func NormalizePath(basedir, p string) string
- type Analyser
- type Args
- type CompileGeneralSrcFunc
- type CompileLinkerSrcFunc
- type CompileSpecialSrcFunc
- type Config
- type DescParser
- type Descriptor
- type Finalizer
- type FlavorConfig
- type GeneralDesc
- func (g *GeneralDesc) AddMultiTarget(tnames []string, tgt *Target)
- func (desc *GeneralDesc) AddTarget(tname, rule string, srcs []string, destdir, srcdir string, extraargs []string, ...) *Target
- func (g *GeneralDesc) AllTargets() map[string]*Target
- func (g *GeneralDesc) CompileIn(srcdir, src, srcbase string)
- func (g *GeneralDesc) CompileSrc(srcdir, src, srcbase, ext string)
- func (g *GeneralDesc) DefaultObjectDir() string
- func (g *GeneralDesc) Finalize(ops *GlobalOps)
- func (g *GeneralDesc) GenericParse(desc Descriptor, ops *GlobalOps, realsrcdir string, args map[string][]string, ...) Descriptor
- func (g *GeneralDesc) GetBuilddesc() string
- func (defdesc *GeneralDesc) NewFromTemplate(bd, tname string, flavors []string) *GeneralDesc
- func (g *GeneralDesc) OutputHeader(w io.Writer, objdir string)
- func (g *GeneralDesc) ResolveDeps(ops *GlobalOps, tname string) []string
- func (g *GeneralDesc) ResolveOrderDeps(target *Target) []string
- func (g *GeneralDesc) ResolveSrcdir(src, tname string) string
- func (g *GeneralDesc) ResolveSrcs(ops *GlobalOps, tname string, srcs ...string) []string
- func (g *GeneralDesc) ValidForFlavor(flavor string) bool
- type GlobalOps
- func (ops *GlobalOps) BuildtoolDir() string
- func (ops *GlobalOps) DefaultCompiler()
- func (ops *GlobalOps) DefaultConfig()
- func (ops *GlobalOps) FindCompilerCC() error
- func (ops *GlobalOps) GlobDir(srcdir string, srcs []string) []string
- func (ops *GlobalOps) GodepsStamp() string
- func (ops *GlobalOps) LoadPlugin(bd, ppath string) (Plugin, error)
- func (ops *GlobalOps) OpenBuilddesc(file string) (s *Scanner, err error)
- func (ops *GlobalOps) OpenComponent(dir string) (s *Scanner, err error)
- func (ops *GlobalOps) OutputDescriptor(desc Descriptor, builddir, objdir string) (defaults []string)
- func (ops *GlobalOps) OutputFlavor(topdir, flavor string)
- func (ops *GlobalOps) OutputTop() (err error)
- func (ops *GlobalOps) ParseComponent(srcdir string, s *Scanner, flavors []string) ParseFunc
- func (ops *GlobalOps) ParseConfig(srcdir string, s *Scanner, flavors []string) ParseFunc
- func (ops *GlobalOps) ParseDescriptorEnd(srcdir string, s *Scanner, flavors []string) ParseFunc
- func (ops *GlobalOps) ParseDirective(srcdir string, s *Scanner, flavors []string) ParseFunc
- func (ops *GlobalOps) PluginDeps() (deps []PluginDep)
- func (ops *GlobalOps) ReadComponent(dir string, flavors []string) (err error)
- func (ops *GlobalOps) RecompileWithPlugins()
- func (ops *GlobalOps) RegisterGlob(srcdir, src string)
- func (ops *GlobalOps) ResolveCollectedVar(src string) string
- func (ops *GlobalOps) ResolveLibs(libs []string) []string
- func (ops *GlobalOps) ResolveLibsExternal(libs []string) []string
- func (ops *GlobalOps) ResolveLibsLinker(link string, libs []string) string
- func (ops *GlobalOps) ResolveLibsOur(libs []string) []LibDescriptor
- func (ops *GlobalOps) ResolveLibsOurPic(libs []string) []string
- func (ops *GlobalOps) ResolveLibsOurPicAsLib(libs []string) ([]string, []string)
- func (ops *GlobalOps) ResolveLibsOurStatic(libs []string) []string
- func (ops *GlobalOps) ResolveLibsOurStaticAsLib(libs []string) ([]string, []string)
- func (ops *GlobalOps) RunConfigScript(srcdir string, s *Scanner, flavors []string) ParseFunc
- func (ops *GlobalOps) RunFinalizers() (err error)
- func (ops *GlobalOps) SetBuildversion()
- func (ops *GlobalOps) StartPlugin(bd, ppath string) error
- func (ops *GlobalOps) StartupPlugins(srcdir string, s *Scanner, flavors []string) ParseFunc
- func (ops *GlobalOps) StatRulePath(pth string) bool
- func (ops *GlobalOps) TempDirWithPlugins(plugs []string) string
- type GoProgDesc
- type GoTestDesc
- type InstallDesc
- type LibDesc
- func (l *LibDesc) Finalize(ops *GlobalOps)
- func (l *LibDesc) IsDummyLib() bool
- func (l *LibDesc) LibDeps() []string
- func (l *LibDesc) LibName() string
- func (l *LibDesc) Linker() string
- func (l *LibDesc) NameAsLib() (string, bool)
- func (l *LibDesc) NameAsPiclib() (string, bool)
- func (tmpl *LibDesc) NewFromTemplate(bd, tname string, flavors []string) Descriptor
- func (l *LibDesc) Parse(ops *GlobalOps, realsrcdir string, args map[string][]string) Descriptor
- func (l *LibDesc) PiclibName() string
- type LibDescriptor
- type LinkDesc
- func (l *LinkDesc) CompileC(srcdir, src, srcbase string)
- func (l *LinkDesc) CompileCXX(srcdir, src, srcbase string)
- func (l *LinkDesc) CompileEnum(srcdir, src, srcbase string)
- func (l *LinkDesc) CompileGo(srcdir, src, srcbase string)
- func (l *LinkDesc) CompileGperf(srcdir, src, srcbase string)
- func (l *LinkDesc) CompileLL(srcdir, src, srcbase string)
- func (l *LinkDesc) CompileSrc(srcdir, src, srcbase, ext string)
- func (l *LinkDesc) CompileXs(srcdir, src, srcbase string)
- func (l *LinkDesc) CompileYY(srcdir, src, srcbase string)
- func (l *LinkDesc) FinalizeAnalyse(ops *GlobalOps)
- func (l *LinkDesc) FinalizeCC(ops *GlobalOps)
- func (l *LinkDesc) FinalizeGoSrcs(ops *GlobalOps, mode string) []string
- func (l *LinkDesc) FinalizeIncdeps(ops *GlobalOps)
- func (l *LinkDesc) LinkerParse(srcdir string, args map[string][]string)
- func (tmpl *LinkDesc) NewFromTemplate(bd, tname string, flavors []string) *LinkDesc
- func (l *LinkDesc) OutputHeader(w io.Writer, objdir string)
- func (l *LinkDesc) ResolveDeps(ops *GlobalOps, tname string) []string
- func (l *LinkDesc) ResolveIncdeps(ops *GlobalOps) []string
- func (l *LinkDesc) ResolveOrderDeps(target *Target) []string
- func (l *LinkDesc) SuffixedObjs(suff string, filter func(base string) bool) []string
- type ModuleDesc
- type ParseError
- type ParseFunc
- type ParseGeneralParam
- type ParseLinkerParam
- type Plugin
- type PluginDep
- type ProgDesc
- type Scanner
- type Target
Constants ¶
const Builddesc = "Builddesc"
Variables ¶
var ( MissingOpenBracket = errors.New("Missing open bracket in parameter") ConditionsNotAllowed = errors.New("Conditions are not allowed here") )
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") )
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") )
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") )
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") )
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{} )
var (
BadSymlinkFormat = errors.New("Bad symlink format, need symlink[dst:target]")
)
var (
CantFindBuildtools = errors.New("Can't find directory containing buildtools. Use seb -install to install them manually.")
)
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, }
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/",
}
var GomoduleTemplate = GoProgDesc{ Mode: "module", LinkDesc: LinkDesc{ GeneralDesc: GeneralDesc{ Destdir: "dest_mod", TargetOptions: map[string]bool{"all": true, "incdeps": true, "libdeps": true}, }, }, }
var GoprogTemplate = GoProgDesc{ Mode: "prog", LinkDesc: LinkDesc{ GeneralDesc: GeneralDesc{ Destdir: "dest_bin", TargetOptions: map[string]bool{"all": true, "incdeps": true, "libdeps": true}, }, }, }
var GotestTemplate = GoTestDesc{ LinkDesc: LinkDesc{ GeneralDesc: GeneralDesc{ Destdir: "gotest", TargetOptions: map[string]bool{"all": true, "incdeps": true, "libdeps": true}, }, }, }
var InstallCommands = map[string]string{
"conf": "install_conf",
"scripts": "install_script",
"python": "install_py",
"php": "install_php",
}
var InstallTemplate = InstallDesc{}
var LibTemplate = LibDesc{ LinkDesc: LinkDesc{ GeneralDesc: GeneralDesc{ Destdir: "dest_lib", TargetOptions: map[string]bool{"lib": true}, }, Picrules: true, }, LinkSet: false, }
var LinkersetLibTemplate = LibDesc{ LinkDesc: LinkDesc{ GeneralDesc: GeneralDesc{ Destdir: "dest_lib", TargetOptions: map[string]bool{"lib": true}, }, Picrules: true, }, LinkSet: true, }
var LoadedPlugins = map[string]Plugin{}
var ModuleTemplate = ModuleDesc{ LinkDesc: LinkDesc{ GeneralDesc: GeneralDesc{ Destdir: "dest_mod", TargetOptions: map[string]bool{"all": true}, }, Picrules: true, Link: "link", }, }
var (
MultipleDefinedTarget = errors.New("Multiple defined target. Rename your generated intermediate files.")
)
var (
NoSuchPlugin = errors.New("Plugin doesn't exist in binary")
)
var ProgTemplate = ProgDesc{ LinkDesc: LinkDesc{ GeneralDesc: GeneralDesc{ Destdir: "dest_bin", TargetOptions: map[string]bool{"all": true}, }, Picrules: false, Link: "link", }, }
var ToolInstallTemplate = InstallDesc{ GeneralDesc: GeneralDesc{ Destdir: "dest_tool", }, }
var ToolProgTemplate = ProgDesc{ LinkDesc: LinkDesc{ GeneralDesc: GeneralDesc{ Destdir: "dest_tool", }, Picrules: false, Link: "link", }, }
Functions ¶
func BuildBuildArgs ¶ added in v1.4.0
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 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 LinkerExtra ¶
Return keys handled by LinkDesc.Parse to pass to GenericParse
func NormalizePath ¶
Types ¶
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 ¶
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 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 }
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 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) 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 ¶
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 (*GlobalOps) GlobDir ¶
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 (*GlobalOps) OpenBuilddesc ¶
func (*GlobalOps) OpenComponent ¶
func (*GlobalOps) OutputDescriptor ¶
func (ops *GlobalOps) OutputDescriptor(desc Descriptor, builddir, objdir string) (defaults []string)
func (*GlobalOps) OutputFlavor ¶
func (*GlobalOps) ParseComponent ¶
func (*GlobalOps) ParseConfig ¶
func (*GlobalOps) ParseDescriptorEnd ¶
func (*GlobalOps) ParseDirective ¶
func (*GlobalOps) PluginDeps ¶
func (*GlobalOps) ReadComponent ¶
func (*GlobalOps) RecompileWithPlugins ¶
func (ops *GlobalOps) RecompileWithPlugins()
func (*GlobalOps) RegisterGlob ¶
func (*GlobalOps) ResolveCollectedVar ¶
func (*GlobalOps) ResolveLibs ¶
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 ¶
Resolves all external libs
func (*GlobalOps) ResolveLibsLinker ¶ added in v1.1.0
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 (*GlobalOps) ResolveLibsOurPicAsLib ¶
func (*GlobalOps) ResolveLibsOurStatic ¶
func (*GlobalOps) ResolveLibsOurStaticAsLib ¶
func (*GlobalOps) RunConfigScript ¶
func (*GlobalOps) RunFinalizers ¶
func (*GlobalOps) SetBuildversion ¶
func (ops *GlobalOps) SetBuildversion()
func (*GlobalOps) StartPlugin ¶
func (*GlobalOps) StartupPlugins ¶
func (*GlobalOps) StatRulePath ¶
func (*GlobalOps) TempDirWithPlugins ¶
type GoProgDesc ¶
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 ¶
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 ¶
func (*LibDesc) IsDummyLib ¶
func (*LibDesc) NameAsPiclib ¶
func (*LibDesc) NewFromTemplate ¶
func (tmpl *LibDesc) NewFromTemplate(bd, tname string, flavors []string) Descriptor
func (*LibDesc) PiclibName ¶
type LibDescriptor ¶
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) CompileCXX ¶
func (*LinkDesc) CompileEnum ¶
func (*LinkDesc) CompileGperf ¶
func (*LinkDesc) CompileSrc ¶
func (*LinkDesc) FinalizeAnalyse ¶
func (*LinkDesc) FinalizeCC ¶
func (*LinkDesc) FinalizeGoSrcs ¶
func (*LinkDesc) FinalizeIncdeps ¶
Some targets (GOPROG) might need incdeps without actually setting cc
func (*LinkDesc) LinkerParse ¶
func (*LinkDesc) NewFromTemplate ¶
func (*LinkDesc) ResolveDeps ¶
func (*LinkDesc) ResolveIncdeps ¶
func (*LinkDesc) ResolveOrderDeps ¶
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 ¶
func (*ParseError) Error ¶
func (e *ParseError) Error() string
type ParseGeneralParam ¶
type ParseGeneralParam func(ops *GlobalOps, g *GeneralDesc, args []string)
type ParseLinkerParam ¶
type ProgDesc ¶
type ProgDesc struct {
LinkDesc
}
func (*ProgDesc) NewFromTemplate ¶
func (tmpl *ProgDesc) NewFromTemplate(bd, tname string, flavors []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
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.