class Botan < Formula desc "Cryptographic algorithms and formats library in C++" homepage "https://botan.randombit.net/" url "https://botan.randombit.net/releases/Botan-3.10.0.tar.xz" sha256 "fde194236f6d5434f136ea0a0627f6cc9d26af8b96e9f1e1c7d8c82cd90f4f24" license "BSD-2-Clause" head "https://github.com/randombit/botan.git", branch: "master" livecheck do url :homepage regex(/href=.*?Botan[._-]v?(\d+(?:\.\d+)+)\.t/i) end bottle do rebuild 1 sha256 arm64_tahoe: "32f2c66243cdfd507fbd1b28768e647716f6f77decb9b1922af09263eb8f2889" sha256 arm64_sequoia: "1b1d2290e77fe91f98703ff2dd9effd39b3b1fe5b327f5db0adf565eabf32608" sha256 arm64_sonoma: "61857dcd72fb2dcf2d037b463de04651db31cda9c4489d0221603afed58555f1" sha256 sonoma: "1d76b19d3422e05b369d9c2def10133f445cbe9e2a7c8f748865f8e62f7febc5" sha256 arm64_linux: "3ba7b0588137b5f257fb83732be8f06d977c85223c23da074ef8c3a997783fb8" sha256 x86_64_linux: "21e6d3e5fe931d7a421faca93ce4b5688380121b103c682f6335e46dbfab554c" end depends_on "pkgconf" => :build depends_on "ca-certificates" depends_on "python@3.14" depends_on "sqlite" uses_from_macos "bzip2" on_macos do depends_on "llvm" if DevelopmentTools.clang_build_version <= 1400 end on_linux do depends_on "zlib-ng-compat" end fails_with :clang do build 1400 cause "Requires C++20" end def python3 which("python3.14") end def install ENV.runtime_cpu_detection args = %W[ --prefix=#{prefix} --docdir=share/doc --with-zlib --with-bzip2 --with-sqlite3 --system-cert-bundle=#{Formula["ca-certificates"].pkgetc}/cert.pem ] args << "--with-commoncrypto" if OS.mac? if OS.mac? && DevelopmentTools.clang_build_version <= 1400 ldflags = %W[-L#{Formula["llvm"].opt_lib}/c++ -L#{Formula["llvm"].opt_lib}/unwind -lunwind] args << "--ldflags=#{ldflags.join(" ")}" end system python3, "configure.py", *args system "make", "install" end test do text = "Homebrew" base64_enc = pipe_output("#{bin}/botan base64_enc -", text) refute_empty base64_enc assert_equal text, pipe_output("#{bin}/botan base64_dec -", base64_enc).chomp end end