homebrew-core/Formula/openvpn.rb

76 lines
2.6 KiB
Ruby

class Openvpn < Formula
desc "SSL/TLS VPN implementing OSI layer 2 or 3 secure network extension"
homepage "https://openvpn.net/community/"
url "https://swupdate.openvpn.org/community/releases/openvpn-2.5.5.tar.xz"
mirror "https://build.openvpn.net/downloads/releases/openvpn-2.5.5.tar.xz"
sha256 "119bd69fa0210838f6cdaa273696dc738efa200f454dbe11eb6dfb75dfb6003b"
license "GPL-2.0-only" => { with: "openvpn-openssl-exception" }
livecheck do
url "https://openvpn.net/community-downloads/"
regex(/href=.*?openvpn[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_monterey: "a2264f62d09a653daea89ec5ac30b28b4a7962eccffad9fbc9f3ae61a7beaedd"
sha256 arm64_big_sur: "030fcca8c518d8ff6a7f3e833e0857107b4c41cf7e602f8a5c5138cf89d2e1c3"
sha256 monterey: "f9ca844aaeec83b4103c76d2f6014e73a06af08528c9a45410dbf24b31d510db"
sha256 big_sur: "9d3302dffbde6fdba5911018279fdac0f82f6cc063fac443b890b0e3b136a465"
sha256 catalina: "064035e7e302c36a719b661a45901a1269c15faf958c87be2f26beebcffed86c"
sha256 x86_64_linux: "d977d1238016b6889de69b10db33453dfc652b92ee07247f1ce420af73c2e8c9"
end
depends_on "pkg-config" => :build
depends_on "lz4"
depends_on "lzo"
depends_on "openssl@1.1"
depends_on "pkcs11-helper"
on_linux do
depends_on "linux-pam"
depends_on "net-tools"
end
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--with-crypto-library=openssl",
"--enable-pkcs11",
"--prefix=#{prefix}"
inreplace "sample/sample-plugins/Makefile" do |s|
if OS.mac?
s.gsub! Superenv.shims_path/"pkg-config", Formula["pkg-config"].opt_bin/"pkg-config"
else
s.gsub! Superenv.shims_path/"ld", "ld"
end
end
system "make", "install"
inreplace "sample/sample-config-files/openvpn-startup.sh",
"/etc/openvpn", etc/"openvpn"
(doc/"samples").install Dir["sample/sample-*"]
(etc/"openvpn").install doc/"samples/sample-config-files/client.conf"
(etc/"openvpn").install doc/"samples/sample-config-files/server.conf"
# We don't use mbedtls, so this file is unnecessary & somewhat confusing.
rm doc/"README.mbedtls"
end
def post_install
(var/"run/openvpn").mkpath
end
plist_options startup: true
service do
run [opt_sbin/"openvpn", "--config", etc/"openvpn/openvpn.conf"]
keep_alive true
working_dir etc/"openvpn"
end
test do
system sbin/"openvpn", "--show-ciphers"
end
end