Documentation ¶
Overview ¶
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.
Index ¶
- Constants
- func MatchAddition(line string) (match bool, composite, flag, condition string, matches []string)
- func MatchRegistrationLine(line string) (match bool, plat *string, libname string, condition *string)
- func NewFromDir(ctx context.Context, dir string, opts ...LibraryOption) (map[string]*LibraryConfig, error)
- func TransformMapFromSchema(ctx context.Context, data interface{}) (interface{}, error)
- type Library
- type LibraryConfig
- func (lib LibraryConfig) ASFlags() []*make.ConditionalValue
- func (lib LibraryConfig) ASIncludes() []*make.ConditionalValue
- func (lib LibraryConfig) CFlags() []*make.ConditionalValue
- func (lib LibraryConfig) CIncludes() []*make.ConditionalValue
- func (lib LibraryConfig) CXXFlags() []*make.ConditionalValue
- func (lib LibraryConfig) CXXIncludes() []*make.ConditionalValue
- func (lc LibraryConfig) CompileDate() string
- func (lc LibraryConfig) CompiledBy() string
- func (lc LibraryConfig) CompiledByAssoc() string
- func (lc LibraryConfig) Compiler() string
- func (lib LibraryConfig) Exportsyms() []string
- func (lib LibraryConfig) IsInternal() bool
- func (lc LibraryConfig) IsUnpacked() bool
- func (lc LibraryConfig) KConfig() kconfig.KeyValueMap
- func (lc LibraryConfig) KConfigTree(_ context.Context, env ...*kconfig.KeyValue) (*kconfig.KConfigFile, error)
- func (lc LibraryConfig) License() string
- func (lc LibraryConfig) MarshalYAML() (interface{}, error)
- func (lc LibraryConfig) Name() string
- func (lib LibraryConfig) ObjCFlags() []*make.ConditionalValue
- func (lib LibraryConfig) Objs() []*make.ConditionalValue
- func (lc LibraryConfig) Path() string
- func (lib LibraryConfig) Platform() *string
- func (lc LibraryConfig) PrintInfo(ctx context.Context) string
- func (lc *LibraryConfig) SetKConfig(config kconfig.KeyValueMap) *LibraryConfig
- func (lc LibraryConfig) Source() string
- func (lib LibraryConfig) Srcs() []*make.ConditionalValue
- func (lc LibraryConfig) String() string
- func (lib LibraryConfig) Syscalls() []*unikraft.ProvidedSyscall
- func (lc LibraryConfig) Type() unikraft.ComponentType
- func (lc LibraryConfig) Version() string
- type LibraryOption
- func WithCFlags(cflags []*make.ConditionalValue) LibraryOption
- func WithCompileDate(compileDate string) LibraryOption
- func WithCompiledBy(compiledBy string) LibraryOption
- func WithCompiledByAssoc(compiledByAssoc string) LibraryOption
- func WithCompiler(compiler string) LibraryOption
- func WithIsInternal(internal bool) LibraryOption
- func WithLicense(license string) LibraryOption
- func WithName(name string) LibraryOption
- func WithSource(source string) LibraryOption
- func WithVersion(version string) LibraryOption
Constants ¶
const ( EvalCallAddLib = "$(eval $(call addlib," EvalCallAddLibSwitch = "$(eval $(call addlib_s," EvalCallAddPlatLib = "$(eval $(call addplatlib," EvalCallAddPlatLibSwitch = "$(eval $(call addplatlib_s," EvalCallClone = "$(eval $(call clone," EvalCallFetch = "$(eval $(call fetch," EvalCallFetch2 = "$(eval $(call fetch2," EvalCallFetchAs = "$(eval $(call fetchas," EvalCallFetchAs2 = "$(eval $(call fetchas2," EvalCallPatch = "$(eval $(call patch," EvalCallUnarchive = "$(eval $(call unarchive," ASFLAGS = "ASFLAGS" ASINCLUDES = "ASINCLUDES" CFLAGS = "CFLAGS" CINCLUDES = "CINCLUDES" CXXFLAGS = "CXXFLAGS" CXXINCLUDES = "CXXINCLUDES" OBJS = "OBJS" OBJCFLAGS = "OBJCFLAGS" SRCS = "SRCS" )
Variables ¶
This section is empty.
Functions ¶
func MatchAddition ¶ added in v0.4.0
MatchAddition is a general-purpose mechanism for matching a standard Unikraft `Makefile.uk` file line which consists of an append for an additional file or flag to a composite. A composite is usually a library, e.g. `LIBKVMPLAT`.
This method is EXPERIMENTAL since the format of `Makefile.uk` files may include non-standard and Make-specific language traits (so use with caution as it is incomplete in its parsing mechanism). The method is helpful in gaining a picture of the source files and flags which are used within a specific Unikraft library.
func MatchRegistrationLine ¶ added in v0.4.0
func MatchRegistrationLine(line string) (match bool, plat *string, libname string, condition *string)
MatchRegistrationLine detects if the line represents a library registration.
The MatchRegistrationLine method should be used on a line-by-line basis when parsing a standard Unikraft `Makefile.uk` file. The input line is checked against a number of Make-based methods which are used to register the library with the Unikraft core build system.
The method returns `match` as `true` if the line consists of a registration along with additional information indicate how the library is registered. For example, the library could be platform-specific and so `plat` will return a non-nil value consisting of the platform's canonoical name. The library's name `libname` will always return with a value and `condition` will return non-nil if a KConfig boolean "switch" can be used to enable the detected library.
func NewFromDir ¶ added in v0.4.0
func NewFromDir(ctx context.Context, dir string, opts ...LibraryOption) (map[string]*LibraryConfig, error)
NewFromDir returns all the registering libraries from a given directory. The method can return multiple libraries if they are detected from a top-level Makefile.uk/Config.uk pair which can arbitrarily register any number of libraries.
func TransformMapFromSchema ¶ added in v0.4.0
TransformMapFromSchema
Types ¶
type Library ¶
type Library interface { component.Component // Exportsyms contains the list of exported symbols the library makes // available via the standard `exportsyms.uk` file. Exportsyms() []string // Syscalls contains the list of provided syscalls by the library. Syscalls() []*unikraft.ProvidedSyscall // IsInternal dictates whether the library comes from the Unikraft core // repository. IsInternal() bool // Platform is a pointer to a string, which indicates whether the library is a // "platform library" and therefore specific to a platform. When nil, it is // not specific to a platform. Platform() *string // ASFlags ASFlags() []*make.ConditionalValue // ASIncludes ASIncludes() []*make.ConditionalValue // CFlags CFlags() []*make.ConditionalValue // CIncludes CIncludes() []*make.ConditionalValue // CXXFlags CXXFlags() []*make.ConditionalValue // CXXIncludes CXXIncludes() []*make.ConditionalValue // Objs Objs() []*make.ConditionalValue // ObjCFlags ObjCFlags() []*make.ConditionalValue // Srcs Srcs() []*make.ConditionalValue }
type LibraryConfig ¶
type LibraryConfig struct {
// contains filtered or unexported fields
}
func NewLibraryConfigFromOptions ¶ added in v0.7.1
func NewLibraryConfigFromOptions(opts ...LibraryOption) (*LibraryConfig, error)
NewLibraryConfigFromOptions is a constructor for LibraryConfig.
func TransformFromSchema ¶ added in v0.4.0
func TransformFromSchema(ctx context.Context, name string, props interface{}) (LibraryConfig, error)
TransformFromSchema parses an input schema and returns an instantiated LibraryConfig
func (LibraryConfig) ASFlags ¶ added in v0.4.0
func (lib LibraryConfig) ASFlags() []*make.ConditionalValue
func (LibraryConfig) ASIncludes ¶ added in v0.4.0
func (lib LibraryConfig) ASIncludes() []*make.ConditionalValue
func (LibraryConfig) CFlags ¶ added in v0.4.0
func (lib LibraryConfig) CFlags() []*make.ConditionalValue
func (LibraryConfig) CIncludes ¶ added in v0.4.0
func (lib LibraryConfig) CIncludes() []*make.ConditionalValue
func (LibraryConfig) CXXFlags ¶ added in v0.4.0
func (lib LibraryConfig) CXXFlags() []*make.ConditionalValue
func (LibraryConfig) CXXIncludes ¶ added in v0.4.0
func (lib LibraryConfig) CXXIncludes() []*make.ConditionalValue
func (LibraryConfig) CompileDate ¶ added in v0.7.1
func (lc LibraryConfig) CompileDate() string
func (LibraryConfig) CompiledBy ¶ added in v0.7.1
func (lc LibraryConfig) CompiledBy() string
func (LibraryConfig) CompiledByAssoc ¶ added in v0.7.1
func (lc LibraryConfig) CompiledByAssoc() string
func (LibraryConfig) Compiler ¶ added in v0.7.1
func (lc LibraryConfig) Compiler() string
func (LibraryConfig) Exportsyms ¶ added in v0.4.0
func (lib LibraryConfig) Exportsyms() []string
func (LibraryConfig) IsInternal ¶ added in v0.4.0
func (lib LibraryConfig) IsInternal() bool
func (LibraryConfig) IsUnpacked ¶ added in v0.4.0
func (lc LibraryConfig) IsUnpacked() bool
func (LibraryConfig) KConfig ¶ added in v0.4.0
func (lc LibraryConfig) KConfig() kconfig.KeyValueMap
func (LibraryConfig) KConfigTree ¶ added in v0.4.0
func (lc LibraryConfig) KConfigTree(_ context.Context, env ...*kconfig.KeyValue) (*kconfig.KConfigFile, error)
func (LibraryConfig) License ¶ added in v0.7.1
func (lc LibraryConfig) License() string
func (LibraryConfig) MarshalYAML ¶ added in v0.6.4
func (lc LibraryConfig) MarshalYAML() (interface{}, error)
MarshalYAML makes LibraryConfig implement yaml.Marshaller
func (LibraryConfig) Name ¶
func (lc LibraryConfig) Name() string
func (LibraryConfig) ObjCFlags ¶ added in v0.4.0
func (lib LibraryConfig) ObjCFlags() []*make.ConditionalValue
func (LibraryConfig) Objs ¶ added in v0.4.0
func (lib LibraryConfig) Objs() []*make.ConditionalValue
func (LibraryConfig) Path ¶ added in v0.4.0
func (lc LibraryConfig) Path() string
func (LibraryConfig) Platform ¶ added in v0.4.0
func (lib LibraryConfig) Platform() *string
func (*LibraryConfig) SetKConfig ¶ added in v0.7.1
func (lc *LibraryConfig) SetKConfig(config kconfig.KeyValueMap) *LibraryConfig
func (LibraryConfig) Source ¶
func (lc LibraryConfig) Source() string
func (LibraryConfig) Srcs ¶ added in v0.4.0
func (lib LibraryConfig) Srcs() []*make.ConditionalValue
func (LibraryConfig) String ¶ added in v0.7.0
func (lc LibraryConfig) String() string
func (LibraryConfig) Syscalls ¶ added in v0.4.0
func (lib LibraryConfig) Syscalls() []*unikraft.ProvidedSyscall
func (LibraryConfig) Type ¶
func (lc LibraryConfig) Type() unikraft.ComponentType
func (LibraryConfig) Version ¶
func (lc LibraryConfig) Version() string
type LibraryOption ¶ added in v0.4.0
type LibraryOption func(*LibraryConfig) error
func WithCFlags ¶ added in v0.7.1
func WithCFlags(cflags []*make.ConditionalValue) LibraryOption
WithCFlags sets the C flags of this library component.
func WithCompileDate ¶ added in v0.7.1
func WithCompileDate(compileDate string) LibraryOption
WithCompileDate sets the compile date of this library component.
func WithCompiledBy ¶ added in v0.7.1
func WithCompiledBy(compiledBy string) LibraryOption
WithCompiledBy sets the user who compiled this library component.
func WithCompiledByAssoc ¶ added in v0.7.1
func WithCompiledByAssoc(compiledByAssoc string) LibraryOption
WithCompiledByAssoc sets the association of the user who compiled this library component.
func WithCompiler ¶ added in v0.7.1
func WithCompiler(compiler string) LibraryOption
WithCompiler sets the compiler of this library component.
func WithIsInternal ¶ added in v0.4.0
func WithIsInternal(internal bool) LibraryOption
WithInternal marks the library as a part of the Unikraft core.
func WithLicense ¶ added in v0.7.1
func WithLicense(license string) LibraryOption
WithLicense sets the license of this library component.
func WithName ¶ added in v0.4.0
func WithName(name string) LibraryOption
WithName sets the name of this library component.
func WithSource ¶ added in v0.4.0
func WithSource(source string) LibraryOption
WithSource sets the library's source which indicates where it was retrieved and in component context and not the origin.
func WithVersion ¶ added in v0.4.0
func WithVersion(version string) LibraryOption
WithVersion sets the version of this library component.