2018-09-04 08:06:31 +00:00
|
|
|
class I2pd < Formula
|
|
|
|
desc "Full-featured C++ implementation of I2P client"
|
|
|
|
homepage "https://i2pd.website/"
|
|
|
|
url "https://github.com/PurpleI2P/i2pd/archive/2.21.0.tar.gz"
|
|
|
|
sha256 "96c15cf7b51feacd5bb3f7032c7d961961325102574a1a4d6cb8dd794e906e5b"
|
|
|
|
|
2018-10-04 16:17:14 +00:00
|
|
|
bottle do
|
|
|
|
sha256 "2008ead2c7d8d07a60db40c984dec8d4cbb6def0fd957f061e50e95477c0fc29" => :mojave
|
|
|
|
sha256 "922bc7f4dc47a96aa8f568eb56b9aa72cfbe2991b060ef95b511e5531a9b4029" => :high_sierra
|
|
|
|
sha256 "0e85e4e0608cb647707f14369c153565fc36b09d7b355719e96884f5a716547e" => :sierra
|
|
|
|
end
|
|
|
|
|
2018-09-04 08:06:31 +00:00
|
|
|
depends_on "boost"
|
|
|
|
depends_on "miniupnpc"
|
|
|
|
depends_on "openssl@1.1"
|
|
|
|
|
|
|
|
needs :cxx11
|
|
|
|
|
|
|
|
def install
|
|
|
|
system "make", "install", "DEBUG=no", "HOMEBREW=1", "USE_UPNP=yes", "USE_AENSI=no", "USE_AVX=no", "PREFIX=#{prefix}"
|
|
|
|
|
|
|
|
# preinstall to prevent overwriting changed by user configs
|
|
|
|
confdir = etc/"i2pd"
|
|
|
|
rm_rf prefix/"etc"
|
|
|
|
confdir.install doc/"i2pd.conf", doc/"subscriptions.txt", doc/"tunnels.conf"
|
|
|
|
end
|
|
|
|
|
|
|
|
def post_install
|
|
|
|
# i2pd uses datadir from variable below. If that path not exists, create that directory and create symlinks to certificates and configs.
|
|
|
|
# Certificates can be updated between releases, so we must re-create symlinks to latest version of it on upgrade.
|
|
|
|
datadir = var/"lib/i2pd"
|
|
|
|
if datadir.exist?
|
|
|
|
rm datadir/"certificates"
|
|
|
|
datadir.install_symlink pkgshare/"certificates"
|
|
|
|
else
|
|
|
|
datadir.dirname.mkpath
|
|
|
|
datadir.install_symlink pkgshare/"certificates", etc/"i2pd/i2pd.conf", etc/"i2pd/subscriptions.txt", etc/"i2pd/tunnels.conf"
|
|
|
|
end
|
|
|
|
|
|
|
|
(var/"log/i2pd").mkpath
|
|
|
|
end
|
|
|
|
|
|
|
|
plist_options :manual => "i2pd"
|
|
|
|
|
|
|
|
def plist; <<~EOS
|
|
|
|
<?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>ProgramArguments</key>
|
|
|
|
<array>
|
|
|
|
<string>#{opt_bin}/i2pd</string>
|
|
|
|
<string>--datadir=#{var}/lib/i2pd</string>
|
|
|
|
<string>--conf=#{etc}/i2pd/i2pd.conf</string>
|
|
|
|
<string>--tunconf=#{etc}/i2pd/tunnels.conf</string>
|
|
|
|
<string>--log=file</string>
|
|
|
|
<string>--logfile=#{var}/log/i2pd/i2pd.log</string>
|
|
|
|
<string>--pidfile=#{var}/run/i2pd.pid</string>
|
|
|
|
</array>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
pid = fork do
|
|
|
|
exec "#{bin}/i2pd", "--datadir=#{testpath}", "--daemon"
|
|
|
|
end
|
|
|
|
sleep 5
|
|
|
|
Process.kill "TERM", pid
|
|
|
|
assert_predicate testpath/"router.keys", :exist?, "Failed to start i2pd"
|
|
|
|
end
|
|
|
|
end
|