name = "binutils" version = "2.46.0" revision = 1 description = "GNU binutils cross-compiled for the target triple" license = "GPL-3.0-or-later" source = { "url": "https://ftp.gnu.org/gnu/binutils/binutils-" + version + ".tar.xz", "sha256": "d75a94f4d73e7a4086f7513e67e439e8fcdcbb726ffe63f4661744e6256b2cf2", "strip_components": 1, } host_deps = [] def configure(ctx): triple = ctx.options["target_triple"] ctx.run([ ctx.source_dir + "/configure", "--prefix=" + ctx.prefix, "--target=" + triple, "--with-sysroot=" + ctx.prefix + "/" + triple, "--disable-nls", "--disable-werror", "--enable-deterministic-archives", "--enable-ld=default", "--enable-plugins", "--enable-threads", "--with-system-zlib", # gprofng's libcollector does not build against musl/recent gcc. "--disable-gprofng", ], env = { "CFLAGS": ctx.options["host_cflags"], "CXXFLAGS": ctx.options["host_cxxflags"], "LDFLAGS": ctx.options["host_ldflags"], }) def build(ctx): ctx.run(["make", "-j" + str(ctx.jobs)]) def install(ctx, pkg): ctx.run(["make", "DESTDIR=" + pkg.destdir, "install"]) # Drop static archives we don't need on the cross side. ctx.run(["sh", "-c", "rm -f " + pkg.destdir + ctx.prefix + "/lib/*.a"])