194 lines
6.4 KiB
Ruby
194 lines
6.4 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.7",
|
|
revision: "883d2cb662bed0316e157bd3beb9853e96c60d02"
|
|
license "MPL-1.1"
|
|
revision 3
|
|
head "https://github.com/signalwire/freeswitch.git", branch: "master"
|
|
|
|
livecheck do
|
|
url :stable
|
|
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 arm64_monterey: "8a9ff125ecaa773df591f966aa67802081c8b69c4b9e09eabe8594b79adf08b6"
|
|
sha256 arm64_big_sur: "40ebdc302afd918094c7bdd42c76ce4e63e18e56037a95801f7458576d504768"
|
|
sha256 monterey: "ed31b09230a436d612b6fb61e184877c2d3d78ac69da8d0f61bce35eedff7b80"
|
|
sha256 big_sur: "61ea9b3f18494c0f0db577c5ca02d9b27a7716a64841b2af741b77c652b98d91"
|
|
sha256 catalina: "9f1e49ab9e8a7a43ad21adc6d4baca1922f160045edc5ec3ccffb3b60338c909"
|
|
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"
|
|
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 "libedit"
|
|
uses_from_macos "zlib"
|
|
|
|
fails_with gcc: "5" # ffmpeg is compiled with GCC
|
|
|
|
# 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.52" # 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 "fbe51296ba5282864a8f0269a968de0783b88b2a75dad710ee076138382a5151"
|
|
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 "bf3ac7be99939f57ed4fab7b76d1e47ba78d1573cc72aa0cfe656c559eb097bd"
|
|
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 "9091553934f7ee453646058ff54837f55c5b38be11c987148c63a1cccc88b741"
|
|
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 "9df388d855996a04f6014999d59d4191e22b579f2e8df542834451a25ea3e1cf"
|
|
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: "284fe91dd068d0cf391139110fdc2811043972b9"
|
|
end
|
|
|
|
resource "libks" do
|
|
url "https://github.com/signalwire/libks.git",
|
|
tag: "v1.7.0",
|
|
revision: "db9bfa746b1fffcaf062bbe060c8cef70c227116"
|
|
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, "-DCMAKE_INSTALL_PREFIX=#{libexec}/libks"
|
|
system "make", "install"
|
|
|
|
ENV.append_path "PKG_CONFIG_PATH", "#{libexec}/libks/lib/pkgconfig"
|
|
ENV.append "CFLAGS", "-I#{libexec}/libks/include"
|
|
end
|
|
|
|
resource("signalwire-c").stage do
|
|
system "cmake", ".", *std_cmake_args, "-DCMAKE_INSTALL_PREFIX=#{libexec}/signalwire-c"
|
|
system "make", "install"
|
|
|
|
ENV.append_path "PKG_CONFIG_PATH", "#{libexec}/signalwire-c/lib/pkgconfig"
|
|
end
|
|
|
|
system "./bootstrap.sh", "-j"
|
|
|
|
args = std_configure_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?
|
|
|
|
system "./configure", *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
|