79 lines
2.4 KiB
Ruby
79 lines
2.4 KiB
Ruby
class ShadowsocksLibev < Formula
|
|
desc "Libev port of shadowsocks"
|
|
homepage "https://github.com/shadowsocks/shadowsocks-libev"
|
|
url "https://github.com/shadowsocks/shadowsocks-libev/archive/v2.2.1.tar.gz"
|
|
sha256 "c8013bc56e507855913dd8972f3c629c1b0c58a7012c4c459186d7f6a0cfe953"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "0d17f73152f9dc3cef85222a2c5ce2ed0b557e0aee528b736e7d7048a2211f90" => :yosemite
|
|
sha256 "ce02156eef98449192b89ddf461af130e692c008984f7763a33047b455fe96a9" => :mavericks
|
|
sha256 "70a1ec155396732f9e99278ffaad8951c7916d84febb40c80d225e199627ad1d" => :mountain_lion
|
|
end
|
|
|
|
head "https://github.com/shadowsocks/shadowsocks-libev.git"
|
|
|
|
option "with-polarssl", "Use PolarSSL instead of OpenSSL"
|
|
|
|
depends_on "polarssl" => :optional
|
|
depends_on "openssl" if build.without? "polarssl"
|
|
|
|
def install
|
|
args = ["--prefix=#{prefix}"]
|
|
|
|
if build.with? "polarssl"
|
|
polarssl = Formula["polarssl"]
|
|
|
|
args << "--with-crypto-library=polarssl"
|
|
args << "--with-polarssl=#{polarssl.opt_prefix}"
|
|
end
|
|
|
|
system "./configure", *args
|
|
system "make"
|
|
|
|
bin.install "src/ss-local"
|
|
bin.install "src/ss-tunnel"
|
|
|
|
(buildpath/"shadowsocks-libev.json").write <<-EOS.undent
|
|
{
|
|
"server":"localhost",
|
|
"server_port":8388,
|
|
"local_port":1080,
|
|
"password":"barfoo!",
|
|
"timeout":600,
|
|
"method":null
|
|
}
|
|
EOS
|
|
etc.install "shadowsocks-libev.json"
|
|
|
|
inreplace "shadowsocks-libev.8", "/etc/shadowsocks-libev/config.json", "#{etc}/shadowsocks-libev.json"
|
|
man8.install "shadowsocks-libev.8"
|
|
end
|
|
|
|
plist_options :manual => "#{HOMEBREW_PREFIX}/opt/shadowsocks-libev/bin/ss-local -c #{HOMEBREW_PREFIX}/etc/shadowsocks-libev.json"
|
|
|
|
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>ProgramArguments</key>
|
|
<array>
|
|
<string>#{opt_bin}/ss-local</string>
|
|
<string>-c</string>
|
|
<string>#{etc}/shadowsocks-libev.json</string>
|
|
</array>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>KeepAlive</key>
|
|
<dict>
|
|
<key>SuccessfulExit</key>
|
|
<false/>
|
|
</dict>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
end
|