-
Notifications
You must be signed in to change notification settings - Fork 63
/
options.go
90 lines (78 loc) · 2.35 KB
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// 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.
package lib
import "kraftkit.sh/make"
type LibraryOption func(*LibraryConfig) error
// WithInternal marks the library as a part of the Unikraft core.
func WithIsInternal(internal bool) LibraryOption {
return func(lc *LibraryConfig) error {
lc.internal = internal
return nil
}
}
// WithName sets the name of this library component.
func WithName(name string) LibraryOption {
return func(lc *LibraryConfig) error {
lc.name = name
return nil
}
}
// WithSource sets the library's source which indicates where it was retrieved
// and in component context and not the origin.
func WithSource(source string) LibraryOption {
return func(lc *LibraryConfig) error {
lc.source = source
return nil
}
}
// WithVersion sets the version of this library component.
func WithVersion(version string) LibraryOption {
return func(lc *LibraryConfig) error {
lc.version = version
return nil
}
}
// WithCFlags sets the C flags of this library component.
func WithCFlags(cflags []*make.ConditionalValue) LibraryOption {
return func(lc *LibraryConfig) error {
lc.cflags = cflags
return nil
}
}
// WithLicense sets the license of this library component.
func WithLicense(license string) LibraryOption {
return func(lc *LibraryConfig) error {
lc.license = license
return nil
}
}
// WithCompiler sets the compiler of this library component.
func WithCompiler(compiler string) LibraryOption {
return func(lc *LibraryConfig) error {
lc.compiler = compiler
return nil
}
}
// WithCompileDate sets the compile date of this library component.
func WithCompileDate(compileDate string) LibraryOption {
return func(lc *LibraryConfig) error {
lc.compileDate = compileDate
return nil
}
}
// WithCompiledBy sets the user who compiled this library component.
func WithCompiledBy(compiledBy string) LibraryOption {
return func(lc *LibraryConfig) error {
lc.compiledBy = compiledBy
return nil
}
}
// WithCompiledByAssoc sets the association of the user who compiled this library component.
func WithCompiledByAssoc(compiledByAssoc string) LibraryOption {
return func(lc *LibraryConfig) error {
lc.compiledByAssoc = compiledByAssoc
return nil
}
}