version = "3.4.1" revision = 1 description = "Cryptography and TLS library (OpenSSL)" license = "Apache-2.0" url = "https://www.openssl.org/" source = tarball( url=f"https://github.com/openssl/openssl/releases/download/openssl-{version}/openssl-{version}.tar.gz", sha256="002a2d6b30b58bf4bea46c43bdd96365aaf8daa6c428782aa4feee06da197df3", ) host_deps = ["binutils", "gcc"] deps = ["zlib"] ossl_targets = { "x86_64": "linux-x86_64", "aarch64": "linux-aarch64", "riscv64": "linux64-riscv64", } def configure(self): target = ossl_targets.get(self.arch) if target is None: raise ValueError(f"openssl: unsupported arch {self.arch}") self.run( self.source_dir / "Configure", target, f"--prefix={self.profile['prefix']}", "--openssldir=/etc/ssl", "--libdir=lib", "shared", "zlib", "no-tests", "no-static-engine", "enable-ktls", env={ "CC": f"{self.triple}-gcc", "AR": f"{self.triple}-ar", "RANLIB": f"{self.triple}-ranlib", "CFLAGS": self.profile["cflags"], "LDFLAGS": self.profile["ldflags"], }, ) def build(self): self.run("make", f"-j{self.jobs}") def install(self): # OpenSSL's Makefile assigns `DESTDIR=` itself, so an environment DESTDIR is # ignored; it must be passed as a make command-line variable to take effect. # Without this, the (glibc) target libs install straight into the musl # builder's /usr/lib and break it mid-install. self.run( "make", "install_sw", "install_ssldirs", f"DESTDIR={self.dest_dir}", )