More stuff, didn't test
This commit is contained in:
+84
-5
@@ -8,15 +8,15 @@ def autotools_configure(ctx, extra_args = [], extra_env = {}):
|
||||
}
|
||||
env.update(extra_env)
|
||||
ctx.run([
|
||||
ctx.source_dir + "/configure",
|
||||
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",
|
||||
"--bindir=" + ctx.prefix / "bin",
|
||||
"--sbindir=" + ctx.prefix / "bin",
|
||||
"--libdir=" + ctx.prefix / "lib",
|
||||
"--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"] + extra_args, env = {"DESTDIR": pkg.dest_dir})
|
||||
ctx.run(["make", "install", "DESTDIR=" + pkg.dest_dir] + extra_args)
|
||||
|
||||
def autotools(configure_args = [], configure_env = {}, build_args = [], install_args = []):
|
||||
def _configure(ctx):
|
||||
@@ -35,3 +35,82 @@ def autotools(configure_args = [], configure_env = {}, build_args = [], install_
|
||||
def _install(ctx, pkg):
|
||||
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
|
||||
|
||||
def cmake_configure(ctx, extra_args = [], extra_env = {}, host = False):
|
||||
if host:
|
||||
env = {
|
||||
"CFLAGS": options.host_cflags,
|
||||
"CXXFLAGS": options.host_cxxflags,
|
||||
"LDFLAGS": options.host_ldflags,
|
||||
}
|
||||
toolchain_args = []
|
||||
else:
|
||||
env = {
|
||||
"CFLAGS": options.cflags,
|
||||
"CXXFLAGS": options.cxxflags,
|
||||
"LDFLAGS": options.ldflags,
|
||||
}
|
||||
toolchain_args = [
|
||||
"-DCMAKE_SYSTEM_NAME=Linux",
|
||||
"-DCMAKE_SYSTEM_PROCESSOR=" + options.target_arch,
|
||||
"-DCMAKE_SYSROOT=" + ctx.sysroot,
|
||||
"-DCMAKE_C_COMPILER=" + options.target_triple + "-gcc",
|
||||
"-DCMAKE_CXX_COMPILER=" + options.target_triple + "-g++",
|
||||
"-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER",
|
||||
"-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY",
|
||||
"-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY",
|
||||
"-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY",
|
||||
]
|
||||
env.update(extra_env)
|
||||
ctx.run([
|
||||
"cmake",
|
||||
"-S", ctx.source_dir,
|
||||
"-B", ctx.build_dir,
|
||||
"-G", "Ninja",
|
||||
"-DCMAKE_BUILD_TYPE=Release",
|
||||
"-DCMAKE_INSTALL_PREFIX=" + ctx.prefix,
|
||||
"-DCMAKE_INSTALL_SYSCONFDIR=/etc",
|
||||
"-DCMAKE_INSTALL_LOCALSTATEDIR=/var",
|
||||
] + toolchain_args + extra_args, env = env)
|
||||
|
||||
def cmake_build(ctx, extra_args = []):
|
||||
ctx.run(["cmake", "--build", ctx.build_dir, "-j", str(ctx.jobs)] + extra_args)
|
||||
|
||||
def cmake_install(ctx, pkg, extra_args = []):
|
||||
ctx.run(
|
||||
["cmake", "--install", ctx.build_dir] + extra_args,
|
||||
env = {"DESTDIR": pkg.dest_dir},
|
||||
)
|
||||
|
||||
def cmake(configure_args = [], configure_env = {}, build_args = [], install_args = [], host = False):
|
||||
def _configure(ctx):
|
||||
cmake_configure(ctx, extra_args = configure_args, extra_env = configure_env, host = host)
|
||||
def _build(ctx):
|
||||
cmake_build(ctx, extra_args = build_args)
|
||||
def _install(ctx, pkg):
|
||||
cmake_install(ctx, pkg, extra_args = install_args)
|
||||
return _configure, _build, _install
|
||||
|
||||
Reference in New Issue
Block a user