homebrew-core/Formula/tor.rb

70 lines
2.1 KiB
Ruby

class Tor < Formula
desc "Anonymizing overlay network for TCP"
homepage "https://www.torproject.org/"
url "https://www.torproject.org/dist/tor-0.4.6.7.tar.gz"
mirror "https://www.torservers.net/mirrors/torproject.org/dist/tor-0.4.6.7.tar.gz"
sha256 "ff665ce121b2952110bd98b9c8741b5593bf6c01ac09033ad848ed92c2510f9a"
# Complete list of licenses:
# https://gitweb.torproject.org/tor.git/plain/LICENSE
license all_of: [
"BSD-2-Clause",
"BSD-3-Clause",
"MIT",
"NCSA",
]
livecheck do
url "https://dist.torproject.org/"
regex(/href=.*?tor[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_big_sur: "5ff952446a3fa7b577ff894eaf7924c8b4b16408b321ff2d4d4759a8e3b52a75"
sha256 big_sur: "07b5cb200302bb21aa031f86bf3e00247954c176bcb6c932f86f450a7ad62b67"
sha256 catalina: "4446f16f1efce667ceedd801b51cbdf541cdeb52e2311b44d2d12ec5ff95bf91"
sha256 mojave: "d64ff6e3ff8b258694d277a805ebe975c8fcdcbc033983974ee09dec01ab14cc"
sha256 x86_64_linux: "69425b9125943c55d0b8b31d78a77ea18a22ada3f9c01b5241278829f17d3a48"
end
depends_on "pkg-config" => :build
depends_on "libevent"
depends_on "libscrypt"
depends_on "openssl@1.1"
uses_from_macos "zlib"
def install
args = %W[
--disable-dependency-tracking
--disable-silent-rules
--prefix=#{prefix}
--sysconfdir=#{etc}
--localstatedir=#{var}
--with-openssl-dir=#{Formula["openssl@1.1"].opt_prefix}
]
system "./configure", *args
system "make", "install"
end
service do
run opt_bin/"tor"
keep_alive true
working_dir HOMEBREW_PREFIX
log_path var/"log/tor.log"
error_log_path var/"log/tor.log"
end
test do
on_macos do
pipe_output("script -q /dev/null #{bin}/tor-gencert --create-identity-key", "passwd\npasswd\n")
end
on_linux do
pipe_output("script -q /dev/null -e -c \"#{bin}/tor-gencert --create-identity-key\"", "passwd\npasswd\n")
end
assert_predicate testpath/"authority_certificate", :exist?
assert_predicate testpath/"authority_signing_key", :exist?
assert_predicate testpath/"authority_identity_key", :exist?
end
end