86 lines
2.5 KiB
Ruby
86 lines
2.5 KiB
Ruby
class Trafficserver < Formula
|
|
desc "HTTP/1.1 compliant caching proxy server"
|
|
homepage "https://trafficserver.apache.org/"
|
|
|
|
stable do
|
|
url "https://www.apache.org/dyn/closer.cgi?path=trafficserver/trafficserver-7.1.4.tar.bz2"
|
|
sha256 "1c5213f8565574ec8a66e08529fd20060c1b9a6cd9b803ba9bbb3b9847651b53"
|
|
|
|
needs :cxx11
|
|
end
|
|
|
|
bottle do
|
|
sha256 "f1bd3bb41a25bb87bd2c31e94e0af357b70b70fab8ddd8608dfcd37888adac09" => :high_sierra
|
|
sha256 "0ae4c3cf440998d5968c647d8f221ab0c230167c2628bd3423ae98d9447c47d5" => :sierra
|
|
sha256 "dfb21b0363951092fc7e63af4112aa365d576e34c6adb592eaf8baf4130402b9" => :el_capitan
|
|
end
|
|
|
|
head do
|
|
url "https://github.com/apache/trafficserver.git"
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
|
|
fails_with :clang do
|
|
build 800
|
|
cause "needs C++17"
|
|
end
|
|
end
|
|
|
|
option "with-experimental-plugins", "Enable experimental plugins"
|
|
|
|
depends_on "openssl"
|
|
depends_on "pcre"
|
|
|
|
def install
|
|
ENV.cxx11 if build.stable?
|
|
|
|
# Needed for OpenSSL headers
|
|
if MacOS.version <= :lion
|
|
ENV.append_to_cflags "-Wno-deprecated-declarations"
|
|
end
|
|
|
|
args = %W[
|
|
--prefix=#{prefix}
|
|
--mandir=#{man}
|
|
--localstatedir=#{var}
|
|
--sysconfdir=#{etc}/trafficserver
|
|
--with-openssl=#{Formula["openssl"].opt_prefix}
|
|
--with-tcl=#{MacOS.sdk_path}/System/Library/Frameworks/Tcl.framework
|
|
--with-group=admin
|
|
--disable-silent-rules
|
|
]
|
|
|
|
args << "--enable-experimental-plugins" if build.with? "experimental-plugins"
|
|
|
|
system "autoreconf", "-fvi" if build.head?
|
|
system "./configure", *args
|
|
|
|
# Fix wrong username in the generated startup script for bottles.
|
|
inreplace "rc/trafficserver.in", "@pkgsysuser@", "$USER"
|
|
|
|
inreplace "lib/perl/Makefile",
|
|
"Makefile.PL INSTALLDIRS=$(INSTALLDIRS)",
|
|
"Makefile.PL INSTALLDIRS=$(INSTALLDIRS) INSTALLSITEMAN3DIR=#{man3}"
|
|
|
|
system "make" if build.head?
|
|
system "make", "install"
|
|
end
|
|
|
|
def post_install
|
|
(var/"log/trafficserver").mkpath
|
|
(var/"trafficserver").mkpath
|
|
|
|
config = etc/"trafficserver/records.config"
|
|
return unless File.exist?(config)
|
|
return if File.read(config).include?("proxy.config.admin.user_id STRING #{ENV["USER"]}")
|
|
|
|
config.append_lines "CONFIG proxy.config.admin.user_id STRING #{ENV["USER"]}"
|
|
end
|
|
|
|
test do
|
|
output = shell_output("#{bin}/trafficserver status")
|
|
assert_match "Apache Traffic Server is not running", output
|
|
end
|
|
end
|