File tree Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Original file line number Diff line number Diff line change 6060 "type": "object",
6161 "properties": {
6262 "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+ }
6471 },
6572 "required": [ "scm", "config" ],
6673 "additionalProperties": false
7784 "type": "object",
7885 "properties": {
7986 "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+ }
8195 },
8296 "required": [ "scm", "config" ],
8397 "additionalProperties": false
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ def build_options(self) -> list[str]:
1818 opts .append ("--pkgconfig.relocatable" )
1919 opts .append (f"--pkg-config-path={ self .pkgconfig_dir } " )
2020 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 ()] )
2222 return opts
2323
2424 @working_directory_attr ("src_dir" )
Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ def __getitem__(self, key):
5050class Package (ABC ):
5151 __backend_factories : T .ClassVar [BackendFactoryMap ] = BackendFactoryMap ()
5252
53+ __built_in_options : T .ClassVar [list [str ]] = [
54+ "static_pie" ,
55+ ]
56+
5357 @unique
5458 class Type (StrEnum ):
5559 """Package type enumerate."""
@@ -103,6 +107,19 @@ def __init__(
103107 # XXX: Enforce path rel to project configs dir
104108 self ._dotconfig = (Path (self ._parent .path .project_dir ) / dotconfig ).resolve (strict = True )
105109
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+
106123 @property
107124 def name (self ) -> str :
108125 return self ._name
You can’t perform that action at this time.
0 commit comments