homebrew-core/Formula/libexosip.rb

70 lines
2.2 KiB
Ruby

class Libexosip < Formula
desc "Toolkit for eXosip2"
homepage "https://savannah.nongnu.org/projects/exosip"
url "https://download.savannah.gnu.org/releases/exosip/libexosip2-5.1.3.tar.gz"
mirror "https://download-mirror.savannah.gnu.org/releases/exosip/libexosip2-5.1.3.tar.gz"
sha256 "abdee47383ee0763a198b97441d5be189a72083435b5d73627e22d8fff5beaba"
license "GPL-2.0"
revision 1
livecheck do
url "https://download.savannah.gnu.org/releases/exosip/"
regex(/href=.*?libexosip2[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
cellar :any
sha256 "75f5593831cb7059245b17f778e2a884e9ef08c41589b17e39d49d230fba45d4" => :catalina
sha256 "dbfa4e8499e92567ca2915fdccf4447249e7bd209aa3736b93b19a95c3d9242a" => :mojave
sha256 "3fcdb640cd6b2bc77df35dde0f9f1eb34a61f52102c2e184c2eb14164cec9956" => :high_sierra
end
depends_on "pkg-config" => :build
depends_on "c-ares"
depends_on "libosip"
depends_on "openssl@1.1"
def install
# Extra linker flags are needed to build this on macOS. See:
# https://growingshoot.blogspot.com/2013/02/manually-install-osip-and-exosip-as.html
# Upstream bug ticket: https://savannah.nongnu.org/bugs/index.php?45079
ENV.append "LDFLAGS", "-framework CoreFoundation -framework CoreServices "\
"-framework Security"
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <netinet/in.h>
#include <eXosip2/eXosip.h>
int main() {
struct eXosip_t *ctx;
int i;
int port = 35060;
ctx = eXosip_malloc();
if (ctx == NULL)
return -1;
i = eXosip_init(ctx);
if (i != 0)
return -1;
i = eXosip_listen_addr(ctx, IPPROTO_UDP, NULL, port, AF_INET, 0);
if (i != 0) {
eXosip_quit(ctx);
fprintf(stderr, "could not initialize transport layer\\n");
return -1;
}
return 0;
}
EOS
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-leXosip2", "-o", "test"
system "./test"
end
end