79 lines
2.9 KiB
Ruby
79 lines
2.9 KiB
Ruby
class Ser2net < Formula
|
|
desc "Allow network connections to serial ports"
|
|
homepage "https://ser2net.sourceforge.io"
|
|
url "https://downloads.sourceforge.net/project/ser2net/ser2net/ser2net-4.3.7.tar.gz"
|
|
sha256 "542915e240ae8b5c7dcec8d1589e6067818532900d45cfef226cea9f0e671d13"
|
|
license "GPL-2.0-only"
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(%r{url=.*?/ser2net[._-]v?(\d+(?:\.\d+)+)\.t}i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "478d2d033dad56f9e7f11fdec2f786c0bb8246e0fa9f7cbff4400b3fe148cb19"
|
|
sha256 cellar: :any, arm64_big_sur: "0c7d34915a068db44e06987940dc12e5da49504fb1191f815946e602dbd68854"
|
|
sha256 cellar: :any, monterey: "1e86776ad9e978b137459051aa43b4995ba9fbdacf2599e68be260faec993f14"
|
|
sha256 cellar: :any, big_sur: "5ead0d0c70dd03263066499077f993c89af65d52b956a1dfcf24eeb55ec8c853"
|
|
sha256 cellar: :any, catalina: "0951c70ff774cad29273636d9dbfca9e8faad0cbae0c2609202662035ec0e2e8"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "663750bd9c9dd3c100327c4ba3f7bb8d3396ea773e6eed0211eed42756301343"
|
|
end
|
|
|
|
depends_on "libyaml"
|
|
|
|
resource "gensio" do
|
|
url "https://downloads.sourceforge.net/project/ser2net/ser2net/gensio-2.4.1.tar.gz"
|
|
sha256 "949438b558bdca142555ec482db6092eca87447d23a4fb60c1836e9e16b23ead"
|
|
|
|
# Fix -flat_namespace being used on Big Sur and later.
|
|
patch do
|
|
url "https://raw.githubusercontent.com/Homebrew/formula-patches/03cf8088210822aa2c1ab544ed58ea04c897d9c4/libtool/configure-big_sur.diff"
|
|
sha256 "35acd6aebc19843f1a2b3a63e880baceb0f5278ab1ace661e57a502d9d78c93c"
|
|
end
|
|
end
|
|
|
|
def install
|
|
resource("gensio").stage do
|
|
system "./configure", "--disable-dependency-tracking",
|
|
"--prefix=#{libexec}/gensio",
|
|
"--with-python=no",
|
|
"--with-tcl=no"
|
|
system "make", "install"
|
|
end
|
|
|
|
ENV.append_path "PKG_CONFIG_PATH", "#{libexec}/gensio/lib/pkgconfig"
|
|
ENV.append_path "CFLAGS", "-I#{libexec}/gensio/include"
|
|
ENV.append_path "LDFLAGS", "-L#{libexec}/gensio/lib"
|
|
|
|
if OS.mac?
|
|
# Patch to fix compilation error
|
|
# https://sourceforge.net/p/ser2net/discussion/90083/thread/f3ae30894e/
|
|
# Remove with next release
|
|
inreplace "addsysattrs.c", "#else", "#else\n#include <gensio/gensio.h>"
|
|
end
|
|
|
|
system "./configure", "--disable-dependency-tracking",
|
|
"--prefix=#{prefix}",
|
|
"--mandir=#{man}"
|
|
system "make", "install"
|
|
|
|
(etc/"ser2net").install "ser2net.yaml"
|
|
end
|
|
|
|
def caveats
|
|
<<~EOS
|
|
To configure ser2net, edit the example configuration in #{etc}/ser2net/ser2net.yaml
|
|
EOS
|
|
end
|
|
|
|
service do
|
|
run [opt_sbin/"ser2net", "-p", "12345"]
|
|
keep_alive true
|
|
working_dir HOMEBREW_PREFIX
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{sbin}/ser2net -v")
|
|
end
|
|
end
|