79 lines
2.5 KiB
Ruby
79 lines
2.5 KiB
Ruby
class Trafficserver < Formula
|
|
desc "HTTP/1.1 compliant caching proxy server"
|
|
homepage "https://trafficserver.apache.org/"
|
|
url "https://www.apache.org/dyn/closer.lua?path=trafficserver/trafficserver-8.0.8.tar.bz2"
|
|
mirror "https://archive.apache.org/dist/trafficserver/trafficserver-8.0.8.tar.bz2"
|
|
sha256 "dfe88d21897ea667d14e0813df47af78c19d5d299a5f5ab029a02e63f724ceb0"
|
|
|
|
bottle do
|
|
sha256 "e2c32121b821376d98605fec5672a8cf73fc32dbcf0943e2fa9a69927db522dd" => :catalina
|
|
sha256 "3b1b5d2b654752a6eb8026efb5fe31d69fe8be31b0def51e5a3840defc074b66" => :mojave
|
|
sha256 "77ec9fe39ba93643af26b0299d8486956c2e351c8fe2b3cad63a387decc8c93e" => :high_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@1.1"
|
|
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@1.1"].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
|