import os import lib.cpp as cpp from lib.make import * version("5.5.0") description("a general-purpose cryptographic library maintained by the AWS Cryptography team") maintainer("sisungo ") source_url("https://github.com/aws/aws-lc/archive/refs/tags/v5.5.0.tar.gz") builddep("shortcut/c++") builddep("shortcut/cmake") def _fix_pc(name, prefix): filepath = f"lib/pkgconfig/{name}.pc" with open(filepath, "r") as f: content = f.read() new_content = content.replace("prefix=/", f"prefix={prefix}").replace("libdir=${prefix}/usr/lib", "libdir=${prefix}/lib") with open(filepath, "w") as f: f.write(new_content) def build(): cpp.cmake( [ "-DBUILD_SHARED_LIBS=1", "-DBUILD_TESTING=OFF", "-DDISABLE_GO=ON", "-DDISABLE_PERL=ON", "-DCMAKE_INSTALL_PREFIX=/", f"-DCMAKE_INSTALL_INCLUDEDIR={get_prefix('aws-lc-dev')}/include", ] ) cpp.ninja() cpp.ninja_install() _fix_pc("libssl", get_prefix("aws-lc-libssl")) _fix_pc("libcrypto", get_prefix("aws-lc-libcrypto")) on_build(build) def pack_libcrypto(composer): composer.makedir("lib") composer.addfile("lib/libcrypto.so", "lib/libcrypto.so") def pack_libssl(composer): composer.makedir("lib") composer.addfile("lib/libssl.so", "lib/libssl.so") package("aws-lc-libcrypto") on_pack(pack_libcrypto) dep("semi-libc @same-arch") provide("libcrypto@same-arch") package("aws-lc-libssl") on_pack(pack_libssl) dep("aws-lc-libcrypto (same)") provide("libssl@same-arch") package("aws-lc-tools") cpp.use_auto_pack(["bin"]) dep("aws-lc-libcrypto (same)") dep("aws-lc-libssl (same)") dep("libcxx @same-arch") package("aws-lc-dev") cpp.use_auto_pack(["dev"]) dep("aws-lc-libcrypto (same)") dep("aws-lc-libssl (same)") provide("libcrypto-dev@same-arch") provide("libssl-dev@same-arch")