38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
# Commonly used helpers.
|
|
|
|
def autotools_configure(ctx, extra_args = [], extra_env = {}):
|
|
env = {
|
|
"CFLAGS": options.cflags,
|
|
"CXXFLAGS": options.cxxflags,
|
|
"LDFLAGS": options.ldflags,
|
|
}
|
|
env.update(extra_env)
|
|
ctx.run([
|
|
ctx.source_dir / "configure",
|
|
"--host=" + options.target_triple,
|
|
"--with-sysroot=" + ctx.sysroot,
|
|
"--prefix=" + ctx.prefix,
|
|
"--sysconfdir=/etc",
|
|
"--localstatedir=/var",
|
|
"--bindir=" + ctx.prefix + "/bin",
|
|
"--sbindir=" + ctx.prefix + "/bin",
|
|
"--libdir=" + ctx.prefix + "/lib",
|
|
"--disable-static",
|
|
"--enable-shared",
|
|
] + extra_args, env = env)
|
|
|
|
def autotools_build(ctx, extra_args = []):
|
|
ctx.run(["make", "-j" + str(ctx.jobs)] + extra_args)
|
|
|
|
def autotools_install(ctx, pkg, extra_args = []):
|
|
ctx.run(["make", "install"] + extra_args, env = {"DESTDIR": pkg.destdir})
|
|
|
|
def autotools(configure_args = [], configure_env = [], build_args = [], install_args = []):
|
|
def _configure(ctx):
|
|
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
|