More stuff

This commit is contained in:
2026-05-18 00:49:24 +02:00
parent 695f30d678
commit 98f3fee099
15 changed files with 333 additions and 132 deletions
+29 -12
View File
@@ -1,14 +1,35 @@
# Commonly used helpers, auto-loaded into every recipe.
def autotools_configure(ctx, extra_args = []):
def _toolchain_env(ctx):
sysroot_flag = " --sysroot=" + ctx.sysroot
return {
"CFLAGS": OPTIONS.cflags + sysroot_flag,
"CXXFLAGS": OPTIONS.cxxflags + sysroot_flag,
"LDFLAGS": OPTIONS.ldflags + sysroot_flag,
}
# Autotools
def autotools_configure(ctx, extra_args = [], extra_env = {}):
args = [
ctx.source_dir + "/configure",
"--prefix=" + ctx.prefix,
"--sysconfdir=/etc",
"--localstatedir=/var",
"--bindir=" + ctx.prefix + "/bin",
"--sbindir=" + ctx.prefix + "/bin",
"--libdir=" + ctx.prefix + "/lib",
"--with-sysroot=" + ctx.sysroot,
"--disable-static",
"--enable-shared",
]
args.append("--host=" + OPTIONS.target_triple)
args.extend(extra_args)
ctx.run(args, env = _toolchain_env(ctx))
envs = _toolchain_env(ctx)
envs.update(extra_env)
ctx.run(args, env = envs)
def autotools_build(ctx, extra_args = []):
args = ["make", "-j" + str(ctx.jobs)]
@@ -25,15 +46,17 @@ def autotools_install(ctx, pkg, extra_args = []):
args.extend(extra_args)
ctx.run(args)
def autotools(configure_args = [], build_args = [], install_args = []):
def autotools(configure_args = [], configure_env = [], build_args = [], install_args = []):
def _configure(ctx):
autotools_configure(ctx, extra_args = configure_args)
autotools_configure(ctx, extra_args = configure_args, extra_env = configure_env)
def _build(ctx):
autotools_build(ctx, extra_args = build_args)
def _install(ctx, pkg):
autotools_install(ctx, pkg, extra_args = install_args)
return _configure, _build, _install
# Meson
def meson_configure(ctx, extra_args = []):
args = [
"meson",
@@ -51,7 +74,6 @@ def meson_build(ctx):
def meson_install(ctx, pkg):
ctx.run(["meson", "install", "-C", ctx.build_dir, "--destdir", pkg.destdir])
def meson(configure_args = [], build_args = [], install_args = []):
def _configure(ctx):
meson_configure(ctx, extra_args = configure_args)
@@ -61,6 +83,8 @@ def meson(configure_args = [], build_args = [], install_args = []):
meson_install(ctx, pkg, extra_args = install_args)
return _configure, _build, _install
# Make
def make(ctx, target = None, extra_args = []):
args = ["make", "-C", ctx.source_dir, "O=" + ctx.build_dir,
"-j" + str(ctx.jobs)]
@@ -73,10 +97,3 @@ def make_install(ctx, pkg, extra_args = []):
args = ["make", "-C", ctx.build_dir, "DESTDIR=" + pkg.destdir, "install"]
args.extend(extra_args)
ctx.run(args)
def _toolchain_env(ctx):
env = {}
for key, var in [("cflags", "CFLAGS"), ("cxxflags", "CXXFLAGS"), ("ldflags", "LDFLAGS")]:
if key in ctx.options:
env[var] = ctx.options[key]
return env