82 lines
2.7 KiB
Ruby
82 lines
2.7 KiB
Ruby
class I2pd < Formula
|
|
desc "Full-featured C++ implementation of I2P client"
|
|
homepage "https://i2pd.website/"
|
|
url "https://github.com/PurpleI2P/i2pd/archive/2.38.0.tar.gz"
|
|
sha256 "8452f5323795a1846d554096c08fffe5ac35897867b93a5079605df8f80a3089"
|
|
license "BSD-3-Clause"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, big_sur: "4bea71d5c8dde3e276e828b87c9a520318fa8a196baffe47f9a6abfb0b685a1d"
|
|
sha256 cellar: :any, catalina: "9aaba9ce0fbda3d1df8b21ec9ef63706e20b375e44861594652f943842645eaa"
|
|
sha256 cellar: :any, mojave: "9ec34112c5582b03b9016ee599d85ea95c8c69ed2d89d88be7132e68729e668b"
|
|
end
|
|
|
|
depends_on "boost"
|
|
depends_on "miniupnpc"
|
|
depends_on "openssl@1.1"
|
|
|
|
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 doesn't exist,
|
|
# create the directory and create symlinks to certificates and configs.
|
|
# Certificates can be updated between releases, so we must recreate symlinks
|
|
# to the latest version 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
|