name = "gcc" version = "16.1.0" revision = 1 description = "GNU GCC cross-compiler (bootstrap stage, C/C++ only)" license = "GPL-3.0-or-later" source = { "url": f"https://ftp.gnu.org/gnu/gcc/gcc-{version}/gcc-{version}.tar.xz", "sha256": "50efb4d94c3397aff3b0d61a5abd748b4dd31d9d3f2ab7be05b171d36a510f79", "strip_components": 1, } host_deps = ["binutils"] def configure(ctx): triple = ctx.options["target_triple"] ctx.run([ ctx.source_dir + "/configure", "--prefix=" + ctx.prefix, "--target=" + triple, "--with-sysroot=" + ctx.prefix + "/" + triple, "--without-headers", "--with-newlib", "--enable-languages=c,c++", "--enable-default-pie", "--enable-default-ssp", "--disable-nls", "--disable-shared", "--disable-threads", "--disable-libssp", "--disable-libgomp", "--disable-libquadmath", "--disable-libatomic", "--disable-libvtv", "--disable-multilib", ], env = { "CFLAGS": ctx.options["host_cflags"], "CXXFLAGS": ctx.options["host_cxxflags"], "LDFLAGS": ctx.options["host_ldflags"], }) def build(ctx): jobs = "-j" + str(ctx.jobs) ctx.run(["make", jobs, "all-gcc"]) ctx.run(["make", jobs, "all-target-libgcc"]) def install(ctx, pkg): ctx.run(["make", "DESTDIR=" + pkg.destdir, "install-gcc"]) ctx.run(["make", "DESTDIR=" + pkg.destdir, "install-target-libgcc"])