class Strongswan < Formula desc "VPN based on IPsec" homepage "https://www.strongswan.org" license "GPL-2.0-or-later" stable do url "https://download.strongswan.org/strongswan-5.9.9.tar.bz2" sha256 "5e16580998834658c17cebfb31dd637e728669cf2fdd325460234a4643b8d81d" # Fix -flat_namespace being used on Big Sur and later. patch do url "https://raw.githubusercontent.com/Homebrew/formula-patches/03cf8088210822aa2c1ab544ed58ea04c897d9c4/libtool/configure-big_sur.diff" sha256 "35acd6aebc19843f1a2b3a63e880baceb0f5278ab1ace661e57a502d9d78c93c" end end livecheck do url "https://download.strongswan.org/" regex(/href=.*?strongswan[._-]v?(\d+(?:\.\d+)+[a-z]?)\.t/i) end bottle do sha256 arm64_ventura: "b807171b7233a19e5aff90c8e894fe13498ddf99cb91725282789a9307d47ef4" sha256 arm64_monterey: "8e3359440d4fb6cacdc441bc6012e961e600c2a1dc3fe3b3ed9139f94afdc24d" sha256 arm64_big_sur: "0842335933de43099b650a7f824e18969d06057038e2dae03550bf523e61847b" sha256 ventura: "525ca8f4645fa25890dd0274c1d52c6582cd4139bbee844bd9bbe1d81bfb6769" sha256 monterey: "7acb116d50bde511af63e743bb7ebfb77814ae80874768fae53a428ed9a9764c" sha256 big_sur: "9dca837e856c501e852870fac0b46dc83e838e4023ffb3f82717bf967620e9c8" end head do url "https://github.com/strongswan/strongswan.git", branch: "master" depends_on "autoconf" => :build depends_on "automake" => :build depends_on "bison" => :build depends_on "gettext" => :build depends_on "libtool" => :build depends_on "pkg-config" => :build end depends_on "openssl@3" def install args = %W[ --disable-dependency-tracking --prefix=#{prefix} --sbindir=#{bin} --sysconfdir=#{etc} --disable-defaults --enable-charon --enable-cmd --enable-constraints --enable-curve25519 --enable-eap-gtc --enable-eap-identity --enable-eap-md5 --enable-eap-mschapv2 --enable-ikev1 --enable-ikev2 --enable-kernel-pfkey --enable-nonce --enable-openssl --enable-pem --enable-pgp --enable-pkcs1 --enable-pkcs8 --enable-pki --enable-pubkey --enable-revocation --enable-scepclient --enable-socket-default --enable-sshkey --enable-stroke --enable-swanctl --enable-unity --enable-updown --enable-x509 --enable-xauth-generic ] args << "--enable-kernel-pfroute" << "--enable-osx-attr" if OS.mac? system "./autogen.sh" if build.head? system "./configure", *args system "make", "install" end def caveats <<~EOS You will have to run both "ipsec" and "charon-cmd" with "sudo". EOS end test do system "#{bin}/ipsec", "--version" system "#{bin}/charon-cmd", "--version" end end