things
This commit is contained in:
+13
-34
@@ -1,4 +1,4 @@
|
||||
# Commonly used helpers.
|
||||
# Autotools
|
||||
|
||||
def autotools_configure(ctx, extra_args = [], extra_env = {}):
|
||||
env = {
|
||||
@@ -11,12 +11,12 @@ def autotools_configure(ctx, extra_args = [], extra_env = {}):
|
||||
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",
|
||||
"--prefix=" + options.prefix,
|
||||
"--sysconfdir=" + options.sysconfdir,
|
||||
"--localstatedir=" + options.localstatedir,
|
||||
"--bindir=" + options.bindir,
|
||||
"--sbindir=" + options.sbindir,
|
||||
"--libdir=" + options.libdir,
|
||||
"--disable-static",
|
||||
"--enable-shared",
|
||||
] + extra_args, env = env)
|
||||
@@ -25,7 +25,7 @@ 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", "DESTDIR=" + pkg.dest_dir] + extra_args)
|
||||
ctx.run(["make", "install"] + extra_args, env = { "DESTDIR": pkg.dest_dir })
|
||||
|
||||
def autotools(configure_args = [], configure_env = {}, build_args = [], install_args = []):
|
||||
def _configure(ctx):
|
||||
@@ -36,29 +36,7 @@ def autotools(configure_args = [], configure_env = {}, build_args = [], install_
|
||||
autotools_install(ctx, pkg, extra_args = install_args)
|
||||
return _configure, _build, _install
|
||||
|
||||
def host_autotools_configure(ctx, extra_args = [], extra_env = {}):
|
||||
env = {
|
||||
"CFLAGS": options.host_cflags,
|
||||
"CXXFLAGS": options.host_cxxflags,
|
||||
"LDFLAGS": options.host_ldflags,
|
||||
}
|
||||
env.update(extra_env)
|
||||
ctx.run([
|
||||
ctx.source_dir / "configure",
|
||||
"--prefix=" + ctx.prefix,
|
||||
"--sysconfdir=/etc",
|
||||
"--localstatedir=/var",
|
||||
"--disable-nls",
|
||||
] + extra_args, env = env)
|
||||
|
||||
def host_autotools(configure_args = [], configure_env = {}, build_args = [], install_args = []):
|
||||
def _configure(ctx):
|
||||
host_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
|
||||
# CMake
|
||||
|
||||
def cmake_configure(ctx, extra_args = [], extra_env = {}, host = False):
|
||||
if host:
|
||||
@@ -92,9 +70,9 @@ def cmake_configure(ctx, extra_args = [], extra_env = {}, host = False):
|
||||
"-B", ctx.build_dir,
|
||||
"-G", "Ninja",
|
||||
"-DCMAKE_BUILD_TYPE=Release",
|
||||
"-DCMAKE_INSTALL_PREFIX=" + ctx.prefix,
|
||||
"-DCMAKE_INSTALL_SYSCONFDIR=/etc",
|
||||
"-DCMAKE_INSTALL_LOCALSTATEDIR=/var",
|
||||
"-DCMAKE_INSTALL_PREFIX=" + options.prefix,
|
||||
"-DCMAKE_INSTALL_SYSCONFDIR=" + options.sysconfdir,
|
||||
"-DCMAKE_INSTALL_LOCALSTATEDIR=" + options.localstatedir,
|
||||
] + toolchain_args + extra_args, env = env)
|
||||
|
||||
def cmake_build(ctx, extra_args = []):
|
||||
@@ -114,3 +92,4 @@ def cmake(configure_args = [], configure_env = {}, build_args = [], install_args
|
||||
def _install(ctx, pkg):
|
||||
cmake_install(ctx, pkg, extra_args = install_args)
|
||||
return _configure, _build, _install
|
||||
|
||||
|
||||
Reference in New Issue
Block a user