homebrew-core/Formula/trafficserver.rb
2019-05-29 19:16:58 +02:00

80 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.6.tar.bz2"
sha256 "82d49c40369e18a462a31e8a72c313b6b587a499e60fbf65d3e31165d59c28c5"
end
bottle do
sha256 "bfda74b82efb9a8ce40f25ee273d7ee5bd73aca8094b4f7675b6acd6210ed3ae" => :mojave
sha256 "14a4af89777094bd327c00e7012dca641f007465972001480e18c20cc2ca21f9" => :high_sierra
sha256 "e59d06b71f0f8b75f21a7edd9136723f908ea4735e8df87d0303687ccd07d72c" => :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