aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhang Yi2014-04-25 14:12:01 +0800
committerAdam Vandenberg2014-05-06 17:23:46 -0700
commit0ca6bf04d85696b855fb1d1ff0b48da0c840d11e (patch)
treef17d0a88d11911dea6e77368b95693d362684f9c
parent35cbe4df53d92f1253f7380bbd2d3d65877d1d35 (diff)
downloadhomebrew-0ca6bf04d85696b855fb1d1ff0b48da0c840d11e.tar.bz2
shadowsocks-libev 1.4.5
Closes #28699. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
-rw-r--r--Library/Formula/shadowsocks-libev.rb81
1 files changed, 81 insertions, 0 deletions
diff --git a/Library/Formula/shadowsocks-libev.rb b/Library/Formula/shadowsocks-libev.rb
new file mode 100644
index 000000000..c745ed945
--- /dev/null
+++ b/Library/Formula/shadowsocks-libev.rb
@@ -0,0 +1,81 @@
+require "formula"
+
+class ShadowsocksLibev < Formula
+ homepage "https://github.com/madeye/shadowsocks-libev"
+
+ stable do
+ url "https://github.com/madeye/shadowsocks-libev/archive/v1.4.5.tar.gz"
+ sha1 "d5333f6a749c521826f8e6b866e04d20fbe842fe"
+ patch do
+ url "https://github.com/madeye/shadowsocks-libev/commit/5d0696.diff"
+ sha1 "8b4c8912ad2f56c0ebe63512ee62185ba4c93873"
+ end
+ end
+
+ head "https://github.com/madeye/shadowsocks-libev.git"
+
+ option "with-polarssl", "Use PolarSSL instead of OpenSSL"
+
+ depends_on "libev"
+ if build.with? "polarssl"
+ depends_on "polarssl"
+ else
+ depends_on "openssl"
+ end
+
+ 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", "install"
+
+ (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.8", "/etc/shadowsocks/config.json", "#{etc}/shadowsocks-libev.json"
+ man8.install "shadowsocks.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