homebrew-core/Formula/trafficserver.rb

81 lines
2.4 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"
end
bottle do
rebuild 1
sha256 "5fb5f9e4d0e7bc111c22d094de568ec45373400fa0e4189a751f4602afc0e533" => :mojave
sha256 "cd1e05ee174b9fa8c4aed38819649a5013d9390d90d607cd56705577bd0a16b2" => :high_sierra
sha256 "c7a1bb274aea0e1129ab7fb29106b47142b5dd62fc1a840722468b0e0f615c3a" => :sierra
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
depends_on "openssl"
depends_on "pcre"
def install
ENV.cxx11 if build.stable?
# Per https://luajit.org/install.html: If MACOSX_DEPLOYMENT_TARGET
# is not set then it's forced to 10.4, which breaks compile on Mojave.
ENV["MACOSX_DEPLOYMENT_TARGET"] = MacOS.version
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
--enable-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