version = "3.4.1" revision = 1 metadata = meta( description = "Cryptography and TLS library (OpenSSL)", license = "Apache-2.0", website = "https://www.openssl.org/", ) source = tarball_source( url = f"https://github.com/openssl/openssl/releases/download/openssl-{version}/openssl-{version}.tar.gz", sha256 = "?", strip_components = 1, ) host_deps = ["binutils", "gcc"] deps = ["zlib"] def configure(ctx): # OpenSSL uses its own perl-based Configure script. The first argument is # the OpenSSL "target" — pick the one matching our triple. if options.target_arch == "x86_64": ossl_target = "linux-x86_64" elif options.target_arch == "aarch64": ossl_target = "linux-aarch64" elif options.target_arch == "riscv64": ossl_target = "linux64-riscv64" else: fail("openssl: unsupported target_arch " + options.target_arch) ctx.run([ ctx.source_dir / "Configure", ossl_target, "--prefix=" + options.prefix, "--openssldir=/etc/ssl", "--libdir=lib", "shared", "zlib", "no-tests", "no-static-engine", "enable-ktls", ], 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_sw", "install_ssldirs"], env = {"DESTDIR": pkg.dest_dir})