homebrew-core/Formula/shadowsocks-libev.rb
2015-09-14 19:57:56 -07:00

69 lines
2.1 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.3.2.tar.gz"
sha256 "789b42e45efce85bdc983574282cab0092f32443630d7fedda667cfbf85e5b40"
head "https://github.com/shadowsocks/shadowsocks-libev.git"
bottle do
cellar :any
sha256 "3adefa985247603c32b2deb7b23055717aa467c7d123cadeda940876d9c8eab8" => :yosemite
sha256 "e4471fb4bafbd8db32b4a2f344e1d1f6ae1b27a17dc4261f72f142b881ae5942" => :mavericks
sha256 "787cd61add6520f45242cef060903bc3a53b25279181b753da32592f79e27688" => :mountain_lion
end
depends_on "openssl"
def install
args = ["--prefix=#{prefix}"]
system "./configure", *args
system "make"
bin.install "src/ss-local", "src/ss-tunnel", "src/ss-server", "src/ss-manager"
(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"
rm "man/ss-redir.1"
inreplace Dir["man/*"], "/etc/shadowsocks-libev/config.json", "#{etc}/shadowsocks-libev.json"
man8.install Dir["man/*.8"]
man1.install Dir["man/*.1"]
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