version = "1.3.2" 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 = "d7a0654783a4da529d1bb793b7ad9c3318020af77667bcae35f95d0e42a792f3", strip_components = 1, ) host_deps = ["binutils", "gcc"] deps = [options.libc] 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=" + options.prefix, "--libdir=" + options.libdir, "--sharedlibdir=" + options.libdir, ], 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})