homebrew-core/Formula/trafficserver.rb
2016-10-01 08:34:51 -04:00

94 lines
2.9 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.cgi?path=trafficserver/trafficserver-6.2.0.tar.bz2"
mirror "https://archive.apache.org/dist/trafficserver/trafficserver-6.2.0.tar.bz2"
sha256 "bd5e8c178d02957b89a81d1e428ee50bcca0831a6917f32408915c56f486fd85"
bottle do
sha256 "5247b13f8f6f91d4af88e92daca11db1a21e952c193ebc36c15bd51e0d2b85da" => :sierra
sha256 "401991b905cf77bac76c1ef305c51e9ed8fad52c9b96510dffb6a2a45f178852" => :el_capitan
sha256 "02b6debf85db785a781649d4533c3d1e8f05c076e21fb6000e3d9828fd0269d4" => :yosemite
sha256 "86015b548eb9c33df0d90033e187fd765f6da5a98d2123bff7282562ad08a996" => :mavericks
end
head do
url "https://github.com/apache/trafficserver.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
option "with-spdy", "Build with SPDY protocol support"
option "with-experimental-plugins", "Enable experimental plugins"
depends_on "openssl"
depends_on "pcre"
if build.with? "spdy"
depends_on "spdylay"
depends_on "pkg-config" => :build
end
needs :cxx11
def install
ENV.cxx11
# Needed for correct ./configure detections
ENV.enable_warnings
# 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-group=admin
--disable-silent-rules
]
args << "--enable-spdy" if build.with? "spdy"
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"
if build.with? "experimental-plugins"
# Disable mysql_remap plugin due to missing symbol compile error:
# https://issues.apache.org/jira/browse/TS-3490
inreplace "plugins/experimental/Makefile", " mysql_remap", ""
end
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