homebrew-core/Formula/telegram-cli.rb

61 lines
2.0 KiB
Ruby

class TelegramCli < Formula
desc "Command-line interface for Telegram"
homepage "https://github.com/vysheng/tg"
url "https://github.com/vysheng/tg.git",
tag: "1.3.1",
revision: "5935c97ed05b90015418b5208b7beeca15a6043c"
license "GPL-2.0"
revision 4
head "https://github.com/vysheng/tg.git"
bottle do
rebuild 1
sha256 big_sur: "a2cf1d0764a462e736640449bb3ca11522ec0c38a4dfb2e54ff3ccc3556f7ff9"
sha256 catalina: "4c1a9d233c3b46d75badb6e89e007ff9763e55071474ce11d0e109e7ee24aefe"
sha256 mojave: "da9d09f1f4a317ed14c97e67fc2def18c4cd728a7023ab80424a8d548437ee74"
sha256 high_sierra: "410b56cc04620c7a1f495b500b41fa61339cc68444c1c65939bb4fb0c4cc96ef"
end
depends_on "pkg-config" => :build
depends_on "jansson"
depends_on "libconfig"
depends_on "libevent"
depends_on "openssl@1.1"
depends_on "readline"
uses_from_macos "zlib"
# Look for the configuration file under /usr/local/etc rather than /etc on OS X.
# Pull Request: https://github.com/vysheng/tg/pull/1306
patch do
url "https://github.com/vysheng/tg/commit/7fad505c344fdee68ea2af1096dc9357e50a8019.patch?full_index=1"
sha256 "1cdaa1f3e1f7fd722681ea4e02ff31a538897ed9d704c61f28c819a52ed0f592"
end
# Patch for OpenSSL 1.1 compatibility
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/129507e4ee3dc314156e179902ac375abd00c7fa/telegram-cli/openssl-1.1.diff"
sha256 "eb6243e1861c0b1595e8bdee705d1acdd2678e854f0919699d4b26c159e30b5e"
end
def install
args = %W[
--prefix=#{prefix}
CFLAGS=-I#{Formula["readline"].include}
CPPFLAGS=-I#{Formula["readline"].include}
LDFLAGS=-L#{Formula["readline"].lib}
--disable-liblua
]
system "./configure", *args
system "make"
bin.install "bin/telegram-cli" => "telegram"
(etc/"telegram-cli").install "server.pub"
end
test do
assert_match "messages_allocated", shell_output("echo stats | #{bin}/telegram")
end
end