209 lines
7.2 KiB
Ruby
209 lines
7.2 KiB
Ruby
class Freeswitch < Formula
|
|
desc "Telephony platform to route various communication protocols"
|
|
homepage "https://freeswitch.org"
|
|
url "https://github.com/signalwire/freeswitch.git",
|
|
tag: "v1.10.8",
|
|
revision: "35108661409083be680d0e74e6abd563e0a4c384"
|
|
license "MPL-1.1"
|
|
head "https://github.com/signalwire/freeswitch.git", branch: "master"
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 arm64_ventura: "2bb979f0e691bf40412830016e85dd661f56fbaf2b5720bb31da32531f7c1e33"
|
|
sha256 arm64_monterey: "7b5f2f425115a319cbd21ef279e525dae40a8ac4d74ee68819e907e0b012ab2e"
|
|
sha256 arm64_big_sur: "5198917bd65265839cc4bfd7afb7f8e60ba7eb74213b254f3ffa31b7168bf1f2"
|
|
sha256 ventura: "fabe1f906acfdbb3b2844b7afd44b4dbbdbd81ee18a409e934b5d9676d27954a"
|
|
sha256 monterey: "967fcad01bfa72c563b2b680d4c631c398568b9338f8e241c35cc4a28048b044"
|
|
sha256 big_sur: "c85f6a73aab968eb2ed630f0c273153ce7ae16a94c2a27b4f740e34be1d6a426"
|
|
sha256 x86_64_linux: "c9d3b99cac170fa6eb067c9fe78988dc215c70c89208c6cdbeb6c278484f279b"
|
|
end
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "cmake" => :build
|
|
depends_on "libtool" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "yasm" => :build
|
|
depends_on "ffmpeg@4"
|
|
depends_on "jpeg-turbo"
|
|
depends_on "ldns"
|
|
depends_on "libpq"
|
|
depends_on "libsndfile"
|
|
depends_on "libtiff"
|
|
depends_on "lua"
|
|
depends_on "openssl@1.1"
|
|
depends_on "opus"
|
|
depends_on "pcre"
|
|
depends_on "sofia-sip"
|
|
depends_on "speex"
|
|
depends_on "speexdsp"
|
|
depends_on "sqlite"
|
|
depends_on "util-linux"
|
|
|
|
uses_from_macos "curl"
|
|
uses_from_macos "libedit"
|
|
uses_from_macos "libxcrypt"
|
|
uses_from_macos "zlib"
|
|
|
|
# https://github.com/Homebrew/homebrew/issues/42865
|
|
|
|
#----------------------- Begin sound file resources -------------------------
|
|
sounds_url_base = "https://files.freeswitch.org/releases/sounds"
|
|
|
|
#---------------
|
|
# music on hold
|
|
#---------------
|
|
moh_version = "1.0.52" # from build/moh_version.txt
|
|
resource "sounds-music-8000" do
|
|
url "#{sounds_url_base}/freeswitch-sounds-music-8000-#{moh_version}.tar.gz"
|
|
version moh_version
|
|
sha256 "2491dcb92a69c629b03ea070d2483908a52e2c530dd77791f49a45a4d70aaa07"
|
|
end
|
|
resource "sounds-music-16000" do
|
|
url "#{sounds_url_base}/freeswitch-sounds-music-16000-#{moh_version}.tar.gz"
|
|
version moh_version
|
|
sha256 "93e0bf31797f4847dc19a94605c039ad4f0763616b6d819f5bddbfb6dd09718a"
|
|
end
|
|
resource "sounds-music-32000" do
|
|
url "#{sounds_url_base}/freeswitch-sounds-music-32000-#{moh_version}.tar.gz"
|
|
version moh_version
|
|
sha256 "4129788a638b77c5f85ff35abfcd69793d8aeb9d7833a75c74ec77355b2657a9"
|
|
end
|
|
resource "sounds-music-48000" do
|
|
url "#{sounds_url_base}/freeswitch-sounds-music-48000-#{moh_version}.tar.gz"
|
|
version moh_version
|
|
sha256 "cc31cdb5b1bd653850bf6e054d963314bcf7c1706a9bf05f5a69bcbd00858d2a"
|
|
end
|
|
|
|
#-----------
|
|
# sounds-en
|
|
#-----------
|
|
sounds_en_version = "1.0.53" # from build/sounds_version.txt
|
|
resource "sounds-en-us-callie-8000" do
|
|
url "#{sounds_url_base}/freeswitch-sounds-en-us-callie-8000-#{sounds_en_version}.tar.gz"
|
|
version sounds_en_version
|
|
sha256 "24a2baad88696169950c84cafc236124b2bfa63114c7c8ac7d330fd980c8db05"
|
|
end
|
|
resource "sounds-en-us-callie-16000" do
|
|
url "#{sounds_url_base}/freeswitch-sounds-en-us-callie-16000-#{sounds_en_version}.tar.gz"
|
|
version sounds_en_version
|
|
sha256 "3540235ed8ed86a3ec97d98225940f4c6bc665f917da4b3f2e1ddf99fc41cdea"
|
|
end
|
|
resource "sounds-en-us-callie-32000" do
|
|
url "#{sounds_url_base}/freeswitch-sounds-en-us-callie-32000-#{sounds_en_version}.tar.gz"
|
|
version sounds_en_version
|
|
sha256 "6f5a572f9c3ee1a035b9b72673ffd9db57a345ce0d4fb9f85167f63ac7ec386a"
|
|
end
|
|
resource "sounds-en-us-callie-48000" do
|
|
url "#{sounds_url_base}/freeswitch-sounds-en-us-callie-48000-#{sounds_en_version}.tar.gz"
|
|
version sounds_en_version
|
|
sha256 "980591a853fbf763818eb77132ea7e3ed876f8c4701e85070d612e1ebba09ae9"
|
|
end
|
|
|
|
#------------------------ End sound file resources --------------------------
|
|
|
|
# There's no tags for now https://github.com/freeswitch/spandsp/issues/13
|
|
resource "spandsp" do
|
|
url "https://github.com/freeswitch/spandsp.git",
|
|
revision: "e59ca8fb8b1591e626e6a12fdc60a2ebe83435ed"
|
|
end
|
|
|
|
resource "libks" do
|
|
url "https://github.com/signalwire/libks.git",
|
|
tag: "v1.8.0",
|
|
revision: "bccc2f394855500c8f6f488b441d6fb94343491b"
|
|
end
|
|
|
|
resource "signalwire-c" do
|
|
url "https://github.com/signalwire/signalwire-c.git",
|
|
tag: "1.3.0",
|
|
revision: "e2f3abf59c800c6d39234e9f0a85fb15d1486d8d"
|
|
end
|
|
|
|
def install
|
|
resource("spandsp").stage do
|
|
system "./bootstrap.sh"
|
|
system "./configure", "--disable-debug",
|
|
"--disable-dependency-tracking",
|
|
"--disable-silent-rules",
|
|
"--prefix=#{libexec}/spandsp"
|
|
system "make"
|
|
ENV.deparallelize { system "make", "install" }
|
|
|
|
ENV.append_path "PKG_CONFIG_PATH", libexec/"spandsp/lib/pkgconfig"
|
|
end
|
|
|
|
resource("libks").stage do
|
|
system "cmake", ".", *std_cmake_args(install_prefix: libexec/"libks")
|
|
system "cmake", "--build", "."
|
|
system "cmake", "--install", "."
|
|
|
|
ENV.append_path "PKG_CONFIG_PATH", libexec/"libks/lib/pkgconfig"
|
|
ENV.append "CFLAGS", "-I#{libexec}/libks/include"
|
|
|
|
# Add RPATH to libks.pc so libks.so can be found by freeswitch modules.
|
|
inreplace libexec/"libks/lib/pkgconfig/libks.pc",
|
|
"-L${libdir}",
|
|
"-Wl,-rpath,${libdir} -L${libdir}"
|
|
end
|
|
|
|
resource("signalwire-c").stage do
|
|
system "cmake", ".", *std_cmake_args(install_prefix: libexec/"signalwire-c")
|
|
system "cmake", "--build", "."
|
|
system "cmake", "--install", "."
|
|
|
|
ENV.append_path "PKG_CONFIG_PATH", libexec/"signalwire-c/lib/pkgconfig"
|
|
|
|
# Add RPATH to signalwire_client.pc so libsignalwire_client.so
|
|
# can be found by freeswitch modules.
|
|
inreplace libexec/"signalwire-c/lib/pkgconfig/signalwire_client.pc",
|
|
"-L${libdir}",
|
|
"-Wl,-rpath,${libdir} -L${libdir}"
|
|
end
|
|
|
|
system "./bootstrap.sh", "-j"
|
|
|
|
args = %W[
|
|
--enable-shared
|
|
--enable-static
|
|
--exec_prefix=#{prefix}
|
|
]
|
|
# Fails on ARM: https://github.com/signalwire/freeswitch/issues/1450
|
|
args << "--disable-libvpx" if Hardware::CPU.arm?
|
|
|
|
ENV.append_to_cflags "-D_ANSI_SOURCE" if OS.linux?
|
|
system "./configure", *std_configure_args, *args
|
|
system "make", "all"
|
|
system "make", "install"
|
|
|
|
# Should be equivalent to: system "make", "cd-moh-install"
|
|
mkdir_p pkgshare/"sounds/music"
|
|
[8, 16, 32, 48].each do |n|
|
|
resource("sounds-music-#{n}000").stage do
|
|
cp_r ".", pkgshare/"sounds/music"
|
|
end
|
|
end
|
|
|
|
# Should be equivalent to: system "make", "cd-sounds-install"
|
|
mkdir_p pkgshare/"sounds/en"
|
|
[8, 16, 32, 48].each do |n|
|
|
resource("sounds-en-us-callie-#{n}000").stage do
|
|
cp_r ".", pkgshare/"sounds/en"
|
|
end
|
|
end
|
|
end
|
|
|
|
service do
|
|
run [opt_bin/"freeswitch", "-nc", "-nonat"]
|
|
keep_alive true
|
|
end
|
|
|
|
test do
|
|
system "#{bin}/freeswitch", "-version"
|
|
end
|
|
end
|