build_deps
This commit is contained in:
+2
-2
@@ -12,7 +12,7 @@ deps = [profile["libc"]]
|
|||||||
|
|
||||||
build_if = profile["arch"] in ("x86_64", "aarch64", "riscv64", "loongarch64")
|
build_if = profile["arch"] in ("x86_64", "aarch64", "riscv64", "loongarch64")
|
||||||
|
|
||||||
_arch_args = {
|
arch_args = {
|
||||||
"x86_64": [
|
"x86_64": [
|
||||||
"--enable-uefi-x86-64",
|
"--enable-uefi-x86-64",
|
||||||
"--enable-uefi-ia32",
|
"--enable-uefi-ia32",
|
||||||
@@ -25,7 +25,7 @@ _arch_args = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
configure, build, install = autotools(
|
configure, build, install = autotools(
|
||||||
configure_args=["--enable-uefi-cd", *_arch_args.get(profile["arch"], [])],
|
configure_args=["--enable-uefi-cd", *arch_args[profile["arch"]]],
|
||||||
configure_env={"TOOLCHAIN_FOR_TARGET": profile["triple"] + "-"},
|
configure_env={"TOOLCHAIN_FOR_TARGET": profile["triple"] + "-"},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -40,7 +40,6 @@ def _info_args(
|
|||||||
|
|
||||||
def mkpkg_base(container: Container, recipe: Recipe, arch: str) -> None:
|
def mkpkg_base(container: Container, recipe: Recipe, arch: str) -> None:
|
||||||
name = recipe.name
|
name = recipe.name
|
||||||
deps = list(recipe.deps) + list(recipe.run_deps)
|
|
||||||
args = [
|
args = [
|
||||||
"apk",
|
"apk",
|
||||||
"mkpkg",
|
"mkpkg",
|
||||||
@@ -58,7 +57,7 @@ def mkpkg_base(container: Container, recipe: Recipe, arch: str) -> None:
|
|||||||
recipe.license,
|
recipe.license,
|
||||||
recipe.url,
|
recipe.url,
|
||||||
recipe.maintainer,
|
recipe.maintainer,
|
||||||
deps,
|
list(recipe.deps),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
container.exec(args)
|
container.exec(args)
|
||||||
|
|||||||
+1
-1
@@ -204,7 +204,7 @@ def _finalize_host(c: Container, layout: Layout, r: Recipe) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def _sysroot_sync(c: Container, r: Recipe) -> None:
|
def _sysroot_sync(c: Container, r: Recipe) -> None:
|
||||||
direct_deps = list(r.deps)
|
direct_deps = list(dict.fromkeys((*r.deps, *r.build_deps)))
|
||||||
if not direct_deps:
|
if not direct_deps:
|
||||||
return
|
return
|
||||||
initdb = not apk.sysroot_initialized(c)
|
initdb = not apk.sysroot_initialized(c)
|
||||||
|
|||||||
+20
-13
@@ -111,6 +111,21 @@ def build_plan(
|
|||||||
seen: dict[str, Recipe] = {}
|
seen: dict[str, Recipe] = {}
|
||||||
ts: graphlib.TopologicalSorter[str] = graphlib.TopologicalSorter()
|
ts: graphlib.TopologicalSorter[str] = graphlib.TopologicalSorter()
|
||||||
forced: set[str] = set()
|
forced: set[str] = set()
|
||||||
|
target_outputs: dict[str, Recipe] = {}
|
||||||
|
|
||||||
|
for tr in rs.target.values():
|
||||||
|
for out in tr.outputs:
|
||||||
|
if out in target_outputs:
|
||||||
|
raise ValueError(f"duplicate target output: {out}")
|
||||||
|
target_outputs[out] = tr
|
||||||
|
|
||||||
|
def target_dep(owner: str, name: str) -> Recipe:
|
||||||
|
tr = target_outputs.get(name)
|
||||||
|
if tr is None:
|
||||||
|
raise KeyError(f"{owner}: unknown target dep {name!r}")
|
||||||
|
if not tr.enabled:
|
||||||
|
raise ValueError(f"{owner}: dep {name!r} disabled by build_if")
|
||||||
|
return tr
|
||||||
|
|
||||||
def add(r: Recipe) -> None:
|
def add(r: Recipe) -> None:
|
||||||
k = _key(r)
|
k = _key(r)
|
||||||
@@ -127,22 +142,14 @@ def build_plan(
|
|||||||
add(hr)
|
add(hr)
|
||||||
deps.append(_key(hr))
|
deps.append(_key(hr))
|
||||||
if r.kind == "target":
|
if r.kind == "target":
|
||||||
for d in (*r.deps, *r.run_deps):
|
for d in (*r.deps, *r.build_deps):
|
||||||
tr = rs.target.get(d)
|
tr = target_dep(r.name, d)
|
||||||
if tr is None:
|
|
||||||
raise KeyError(f"{r.name}: unknown dep {d!r}")
|
|
||||||
if not tr.enabled:
|
|
||||||
raise ValueError(f"{r.name}: dep {d!r} disabled by build_if")
|
|
||||||
add(tr)
|
add(tr)
|
||||||
deps.append(_key(tr))
|
deps.append(_key(tr))
|
||||||
else:
|
else:
|
||||||
# host recipes may declare target `deps` that need to land in /sysroot
|
# host recipes may declare target deps that need to land in /sysroot
|
||||||
for d in r.deps:
|
for d in (*r.deps, *r.build_deps):
|
||||||
tr = rs.target.get(d)
|
tr = target_dep(f"host:{r.name}", d)
|
||||||
if tr is None:
|
|
||||||
raise KeyError(f"host:{r.name}: unknown target dep {d!r}")
|
|
||||||
if not tr.enabled:
|
|
||||||
raise ValueError(f"host:{r.name}: dep {d!r} disabled by build_if")
|
|
||||||
add(tr)
|
add(tr)
|
||||||
deps.append(_key(tr))
|
deps.append(_key(tr))
|
||||||
ts.add(k, *deps)
|
ts.add(k, *deps)
|
||||||
|
|||||||
+3
-3
@@ -28,8 +28,8 @@ class Recipe:
|
|||||||
maintainer: str
|
maintainer: str
|
||||||
sources: dict[str | None, Tarball | src_mod.Git] # key=None for single source
|
sources: dict[str | None, Tarball | src_mod.Git] # key=None for single source
|
||||||
host_deps: tuple[str, ...]
|
host_deps: tuple[str, ...]
|
||||||
|
build_deps: tuple[str, ...]
|
||||||
deps: tuple[str, ...]
|
deps: tuple[str, ...]
|
||||||
run_deps: tuple[str, ...]
|
|
||||||
subpackages: tuple[Subpackage, ...]
|
subpackages: tuple[Subpackage, ...]
|
||||||
phases: dict[str, Callable[[Any], None]]
|
phases: dict[str, Callable[[Any], None]]
|
||||||
enabled: bool
|
enabled: bool
|
||||||
@@ -163,8 +163,8 @@ def _load_one(
|
|||||||
)
|
)
|
||||||
|
|
||||||
host_deps = tuple(getattr(mod, "host_deps", ()) or ())
|
host_deps = tuple(getattr(mod, "host_deps", ()) or ())
|
||||||
|
build_deps = tuple(getattr(mod, "build_deps", ()) or ())
|
||||||
deps = tuple(getattr(mod, "deps", ()) or ())
|
deps = tuple(getattr(mod, "deps", ()) or ())
|
||||||
run_deps = tuple(getattr(mod, "run_deps", ()) or ())
|
|
||||||
subs = tuple(getattr(mod, "subpackages", ()) or ())
|
subs = tuple(getattr(mod, "subpackages", ()) or ())
|
||||||
for s in subs:
|
for s in subs:
|
||||||
if not isinstance(s, Subpackage):
|
if not isinstance(s, Subpackage):
|
||||||
@@ -200,8 +200,8 @@ def _load_one(
|
|||||||
maintainer=maintainer,
|
maintainer=maintainer,
|
||||||
sources=sources,
|
sources=sources,
|
||||||
host_deps=host_deps,
|
host_deps=host_deps,
|
||||||
|
build_deps=build_deps,
|
||||||
deps=deps,
|
deps=deps,
|
||||||
run_deps=run_deps,
|
|
||||||
subpackages=subs,
|
subpackages=subs,
|
||||||
phases=phases,
|
phases=phases,
|
||||||
enabled=enabled,
|
enabled=enabled,
|
||||||
|
|||||||
Reference in New Issue
Block a user