2010-01-05 23:57:58 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Tor < Formula
|
2010-01-05 23:57:58 +00:00
|
|
|
homepage 'https://www.torproject.org/'
|
2014-01-09 18:03:01 +00:00
|
|
|
url 'https://www.torproject.org/dist/tor-0.2.4.20.tar.gz'
|
|
|
|
sha1 '09ba4eda9a73c46852a277b721ed74c8263e8dba'
|
2010-04-07 05:58:35 +00:00
|
|
|
|
2013-11-25 01:36:03 +00:00
|
|
|
devel do
|
2013-12-18 16:38:31 +00:00
|
|
|
url 'https://www.torproject.org/dist/tor-0.2.5.1-alpha.tar.gz'
|
|
|
|
version '0.2.5.1-alpha'
|
|
|
|
sha1 'd10cb78e6a41657d970a1ce42105142bcfc315fb'
|
2013-11-25 01:36:03 +00:00
|
|
|
end
|
|
|
|
|
2014-01-04 05:21:13 +00:00
|
|
|
option "with-brewed-openssl", "Build with Homebrew's OpenSSL instead of the system version" if MacOS.version > :leopard
|
2013-06-26 01:01:26 +00:00
|
|
|
|
2010-01-05 23:57:58 +00:00
|
|
|
depends_on 'libevent'
|
2014-01-04 05:21:13 +00:00
|
|
|
depends_on 'openssl' if build.with?('brewed-openssl') || MacOS.version < :snow_leopard
|
2010-04-07 05:58:35 +00:00
|
|
|
|
2010-01-05 23:57:58 +00:00
|
|
|
def install
|
2013-12-28 21:24:47 +00:00
|
|
|
# Fix the path to the control cookie.
|
|
|
|
inreplace \
|
|
|
|
'contrib/tor-ctrl.sh',
|
|
|
|
'TOR_COOKIE="/var/lib/tor/data/control_auth_cookie"',
|
|
|
|
'TOR_COOKIE="$HOME/.tor/control_auth_cookie"'
|
|
|
|
|
2013-06-26 01:01:26 +00:00
|
|
|
args = %W[
|
|
|
|
--disable-dependency-tracking
|
|
|
|
--prefix=#{prefix}
|
|
|
|
]
|
|
|
|
|
2014-02-27 19:56:15 +00:00
|
|
|
args << "-with-ssl=#{Formula["openssl"].opt_prefix}" if build.with?("brewed-openssl") || MacOS.version < :snow_leopard
|
2013-06-26 01:01:26 +00:00
|
|
|
|
|
|
|
system "./configure", *args
|
2010-01-05 23:57:58 +00:00
|
|
|
system "make install"
|
2013-12-28 21:24:47 +00:00
|
|
|
|
|
|
|
bin.install "contrib/tor-ctrl.sh" => "tor-ctrl"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
system "tor", "--version"
|
2011-05-07 18:58:03 +00:00
|
|
|
end
|
|
|
|
|
2012-11-25 15:06:41 +00:00
|
|
|
def plist; <<-EOS.undent
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
|
|
<plist version="1.0">
|
|
|
|
<dict>
|
|
|
|
<key>Label</key>
|
|
|
|
<string>#{plist_name}</string>
|
|
|
|
<key>RunAtLoad</key>
|
|
|
|
<true/>
|
|
|
|
<key>KeepAlive</key>
|
|
|
|
<true/>
|
|
|
|
<key>ProgramArguments</key>
|
|
|
|
<array>
|
|
|
|
<string>#{opt_prefix}/bin/tor</string>
|
|
|
|
</array>
|
|
|
|
<key>WorkingDirectory</key>
|
|
|
|
<string>#{HOMEBREW_PREFIX}</string>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
2011-05-07 18:58:03 +00:00
|
|
|
EOS
|
2010-01-05 23:57:58 +00:00
|
|
|
end
|
|
|
|
end
|