version = "1.3.1" revision = 1 metadata = meta( description = "Lossless data-compression library", license = "Zlib", website = "https://zlib.net/", ) source = tarball_source( url = f"https://zlib.net/zlib-{version}.tar.xz", sha256 = "?", strip_components = 1, ) host_deps = ["binutils", "gcc"] def configure(ctx): # zlib ships its own ./configure that does not understand the usual # autoconf flags (no --host, --build, etc.), so it is invoked directly. ctx.run([ ctx.source_dir / "configure", "--prefix=" + ctx.prefix, "--libdir=" + ctx.prefix / "lib", "--sharedlibdir=" + ctx.prefix / "lib", ], env = { "CC": options.target_triple + "-gcc", "AR": options.target_triple + "-ar", "RANLIB": options.target_triple + "-ranlib", "CFLAGS": options.cflags, "LDFLAGS": options.ldflags, }) def build(ctx): ctx.run(["make", "-j" + str(ctx.jobs)]) def install(ctx, pkg): ctx.run(["make", "install"], env = {"DESTDIR": pkg.dest_dir})