homebrew-core/Formula/gearman.rb
2019-08-06 07:40:38 +08:00

84 lines
2.5 KiB
Ruby

class Gearman < Formula
desc "Application framework to farm out work to other machines or processes"
homepage "http://gearman.org/"
url "https://github.com/gearman/gearmand/releases/download/1.1.18/gearmand-1.1.18.tar.gz"
sha256 "d789fa24996075a64c5af5fd2adef10b13f77d71f7d44edd68db482b349c962c"
revision 2
bottle do
cellar :any
sha256 "d0226cfe46fee9b0535bf3dfea5863b6e5ec1c0cf66eddccbbd454fd73528b88" => :mojave
sha256 "2d4db5d0d036abffa27ad4784070085930931c7d99a21e9fb0540df1b8925138" => :high_sierra
sha256 "526eabfea887f09b568c7b791fa0e73b272802b166f6ed2fc928f0fd0c4a8fc5" => :sierra
end
depends_on "pkg-config" => :build
depends_on "sphinx-doc" => :build
depends_on "boost"
depends_on "libevent"
depends_on "libmemcached"
def install
# Work around "error: no member named 'signbit' in the global namespace"
# encountered when trying to detect boost regex in configure
if MacOS.version == :high_sierra
ENV.delete("HOMEBREW_SDKROOT")
ENV.delete("SDKROOT")
end
# https://bugs.launchpad.net/gearmand/+bug/1368926
Dir["tests/**/*.cc", "libtest/main.cc"].each do |test_file|
next unless /std::unique_ptr/ =~ File.read(test_file)
inreplace test_file, "std::unique_ptr", "std::auto_ptr"
end
args = %W[
--prefix=#{prefix}
--localstatedir=#{var}
--disable-silent-rules
--disable-dependency-tracking
--disable-cyassl
--disable-hiredis
--disable-libdrizzle
--disable-libpq
--disable-libtokyocabinet
--disable-ssl
--enable-libmemcached
--with-boost=#{Formula["boost"].opt_prefix}
--with-memcached=#{Formula["memcached"].opt_bin}/memcached
--with-sqlite3
--without-mysql
--without-postgresql
]
ENV.append_to_cflags "-DHAVE_HTONLL"
(var/"log").mkpath
system "./configure", *args
system "make", "install"
end
plist_options :manual => "gearmand -d"
def plist; <<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>Program</key>
<string>#{opt_sbin}/gearmand</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOS
end
test do
assert_match /gearman\s*Error in usage/, shell_output("#{bin}/gearman --version 2>&1", 1)
end
end