File tree 3 files changed +34
-3
lines changed 3 files changed +34
-3
lines changed Original file line number Diff line number Diff line change 60
60
"type": "object",
61
61
"properties": {
62
62
"scm": { "$ref": "urn:barbican:scm" },
63
- "config": { "type": "string" }
63
+ "config": { "type": "string" },
64
+ "build": {
65
+ "type": "object",
66
+ "properties": {
67
+ "options": { "$ref": "urn:barbican:build#/properties/options" }
68
+ },
69
+ "required": [ "options" ]
70
+ }
64
71
},
65
72
"required": [ "scm", "config" ],
66
73
"additionalProperties": false
77
84
"type": "object",
78
85
"properties": {
79
86
"scm": { "$ref": "urn:barbican:scm" },
80
- "config": { "type": "string" }
87
+ "config": { "type": "string" },
88
+ "build": {
89
+ "type": "object",
90
+ "properties": {
91
+ "options": { "$ref": "urn:barbican:build#/properties/options" }
92
+ },
93
+ "required": [ "options" ]
94
+ }
81
95
},
82
96
"required": [ "scm", "config" ],
83
97
"additionalProperties": false
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ def build_options(self) -> list[str]:
18
18
opts .append ("--pkgconfig.relocatable" )
19
19
opts .append (f"--pkg-config-path={ self .pkgconfig_dir } " )
20
20
opts .append (f"-Dconfig={ str (self ._dotconfig )} " )
21
- opts .extend (self . _config [ "build_opts" ] if "build_opts" in self ._config else list () )
21
+ opts .extend ([ f"-D { k } = { str ( v ) } " for k , v in self ._extra_build_opts . items ()] )
22
22
return opts
23
23
24
24
@working_directory_attr ("src_dir" )
Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ def __getitem__(self, key):
50
50
class Package (ABC ):
51
51
__backend_factories : T .ClassVar [BackendFactoryMap ] = BackendFactoryMap ()
52
52
53
+ __built_in_options : T .ClassVar [list [str ]] = [
54
+ "static_pie" ,
55
+ ]
56
+
53
57
@unique
54
58
class Type (StrEnum ):
55
59
"""Package type enumerate."""
@@ -103,6 +107,19 @@ def __init__(
103
107
# XXX: Enforce path rel to project configs dir
104
108
self ._dotconfig = (Path (self ._parent .path .project_dir ) / dotconfig ).resolve (strict = True )
105
109
110
+ self ._built_in_build_opts = dict ()
111
+ self ._extra_build_opts = dict ()
112
+ if "build" in self ._config :
113
+ build_opts = (
114
+ self ._config ["build" ]["options" ] if "options" in self ._config ["build" ] else dict ()
115
+ )
116
+ self ._built_in_build_opts = dict (
117
+ filter (lambda key : key in self .__built_in_options , build_opts .items ())
118
+ )
119
+ self ._extra_build_opts = dict (
120
+ filter (lambda key : key not in self .__built_in_options , build_opts .items ())
121
+ )
122
+
106
123
@property
107
124
def name (self ) -> str :
108
125
return self ._name
You can’t perform that action at this time.
0 commit comments