homebrew-core/Formula/trafficserver.rb

84 lines
2.6 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-7.0.0.tar.bz2"
mirror "https://archive.apache.org/dist/trafficserver/trafficserver-7.0.0.tar.bz2"
sha256 "5a7216d3c3862cd254e577bcfbd0d6820ad7a2eab588d5a820f02e2c2f23afab"
bottle do
sha256 "3906717223fdf1e502c07f7af4d7f7a3ec2492569494744783ccc34033d44cde" => :sierra
sha256 "43fd2b84c6a39fcc3f063afbd16f1aea5e47a2311e37c5f9a294b19e3885d0a4" => :el_capitan
sha256 "0c76643bbcbffc39d6a1c0d4b30f10a87596be00ba7aefbfa57c05e06afb5209" => :yosemite
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-experimental-plugins", "Enable experimental plugins"
depends_on "openssl"
depends_on "pcre"
needs :cxx11
def install
ENV.cxx11
# 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-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