homebrew-core/Formula/ortp.rb

67 lines
2.2 KiB
Ruby

class Ortp < Formula
desc "Real-time transport protocol (RTP, RFC3550) library"
homepage "https://www.linphone.org/technical-corner/ortp"
url "https://gitlab.linphone.org/BC/public/ortp/-/archive/4.4.32/ortp-4.4.32.tar.bz2"
sha256 "ce33d566fee48f6441a27feea5947aae3e09795a19af28588d856bb06ec7a7f6"
license "GPL-3.0-or-later"
head "https://gitlab.linphone.org/BC/public/ortp.git"
bottle do
sha256 arm64_big_sur: "7e51ec1f081f3d37274ff3ace01f43bc5bf0e8105eae4759610ac5e48ff56bc1"
sha256 big_sur: "5d3d37388c5ec9afdb5b957e30a98504eac553ea841f00b465d4650419b5a857"
sha256 catalina: "aec6918b47e90a3661b742fa3e6b03ed315992f051b6f04d0f70d6c1ea73e108"
sha256 mojave: "ce8604af64d1f5562847ee1f427e4afe10b40c0a498d0d248b62814273560bde"
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "mbedtls"
# bctoolbox appears to follow ortp's version. This can be verified at the GitHub mirror:
# https://github.com/BelledonneCommunications/bctoolbox
resource "bctoolbox" do
url "https://gitlab.linphone.org/BC/public/bctoolbox/-/archive/4.4.32/bctoolbox-4.4.32.tar.bz2"
sha256 "8b86a1cd189ba272c9d92a051e19100d9ea60d7baa0dc16d8c2762e22056ee6d"
end
def install
resource("bctoolbox").stage do
args = std_cmake_args.reject { |s| s["CMAKE_INSTALL_PREFIX"] } + %W[
-DCMAKE_INSTALL_PREFIX=#{libexec}
-DENABLE_TESTS_COMPONENT=OFF
]
system "cmake", ".", *args
system "make", "install"
end
ENV.prepend_path "PKG_CONFIG_PATH", libexec/"lib/pkgconfig"
args = std_cmake_args + %W[
-DCMAKE_PREFIX_PATH=#{libexec}
-DCMAKE_C_FLAGS=-I#{libexec}/include
-DCMAKE_CXX_FLAGS=-I#{libexec}/include
-DENABLE_DOC=NO
]
mkdir "build" do
system "cmake", "..", *args
system "make", "install"
end
end
test do
(testpath/"test.c").write <<~EOS
#include "ortp/logging.h"
#include "ortp/rtpsession.h"
#include "ortp/sessionset.h"
int main()
{
ORTP_PUBLIC void ortp_init(void);
return 0;
}
EOS
system ENV.cc, "-I#{include}", "-I#{libexec}/include", "-L#{lib}", "-lortp",
testpath/"test.c", "-o", "test"
system "./test"
end
end