106 lines
2.5 KiB
Python
106 lines
2.5 KiB
Python
import subprocess
|
|
import os
|
|
|
|
from lib import cpp, arch
|
|
from lib.make import *
|
|
|
|
|
|
version("4.1.0")
|
|
description("General purpose TLS and crypto library")
|
|
maintainer("sisungo <[email protected]>")
|
|
source_managed("github://openssl/openssl#openssl-4.1.0")
|
|
|
|
builddep("shortcut/c")
|
|
builddep("shortcut/autotools")
|
|
builddep("libz-dev @target")
|
|
builddep("libzstd-dev @target")
|
|
builddep("libbrotli-dev @target")
|
|
builddep("linux-dev @target")
|
|
builddep("perl")
|
|
|
|
|
|
def build():
|
|
subprocess.run(
|
|
[
|
|
"./Configure",
|
|
"enable-brotli-dynamic",
|
|
"no-deprecated",
|
|
"no-dtls1",
|
|
"no-dtls1-method",
|
|
"no-legacy",
|
|
"no-nextprotoneg",
|
|
"no-rc2",
|
|
"no-rc4",
|
|
"no-tls1",
|
|
"no-tls1-method",
|
|
"no-tls1_1",
|
|
"no-tls1_1-method",
|
|
"enable-zlib-dynamic",
|
|
"enable-zstd-dynamic",
|
|
"--prefix=/",
|
|
"--openssldir=/var/config/ssl",
|
|
],
|
|
check=True,
|
|
)
|
|
cpp.make()
|
|
cpp.make_install()
|
|
|
|
on_build(build)
|
|
|
|
|
|
def fix_pc(path, pkgname):
|
|
with open(path) as fd:
|
|
pc = fd.read()
|
|
pc = pc.replace("libdir=${exec_prefix}/lib", f"libdir={get_prefix(pkgname)}/lib")
|
|
pc = pc.replace("includedir=${prefix}/include", f"includedir={get_prefix('openssl-dev')}/include")
|
|
with open(path, "wt+") as fd:
|
|
fd.write(pc)
|
|
|
|
def pack_libcrypto(composer):
|
|
composer.makedir("lib")
|
|
composer.add("lib/libcrypto.so")
|
|
composer.add("lib/libcrypto.so.4")
|
|
|
|
def pack_libssl(composer):
|
|
composer.makedir("lib")
|
|
composer.add("lib/libssl.so")
|
|
composer.add("lib/libssl.so.4")
|
|
|
|
def pack_dev(composer):
|
|
fix_pc("lib/pkgconfig/libcrypto.pc", "openssl-libcrypto")
|
|
fix_pc("lib/pkgconfig/libssl.pc", "openssl-libssl")
|
|
composer.makedir("lib")
|
|
composer.add("lib/cmake")
|
|
composer.add("lib/pkgconfig")
|
|
composer.add("lib/libcrypto.a")
|
|
composer.add("lib/libssl.a")
|
|
composer.add("include")
|
|
|
|
def pack_docs(composer):
|
|
composer.add("share")
|
|
|
|
package("openssl-libcrypto")
|
|
dep("semi-libc @same-arch")
|
|
on_pack(pack_libcrypto)
|
|
|
|
package("openssl-libssl")
|
|
dep("openssl-libcrypto (same)")
|
|
dep("semi-libc @same-arch")
|
|
on_pack(pack_libssl)
|
|
|
|
package("openssl-tools")
|
|
dep("openssl-libcrypto (same)")
|
|
dep("openssl-libssl (same)")
|
|
dep("semi-libc @same-arch")
|
|
cpp.use_auto_pack(["bin"])
|
|
|
|
package("openssl-dev")
|
|
dep("openssl-libcrypto (same)")
|
|
dep("openssl-libssl (same)")
|
|
dep("semi-libc-dev @same-arch")
|
|
on_pack(pack_dev)
|
|
|
|
package("openssl-docs")
|
|
arch_any()
|
|
on_pack(pack_docs)
|