require 'formula' class Uwsgi < Formula homepage "http://projects.unbit.it/uwsgi/" url "http://projects.unbit.it/downloads/uwsgi-2.0.5.1.tar.gz" sha1 "67244683a76a7ce88f244ef8044ecf32bf3b8d41" bottle do sha1 "20ecd1cedd295a0230dc6a1ffd0f7ed683b9b220" => :mavericks sha1 "25b1cc77faa6add9ed7e9a58b179fc5091ad5485" => :mountain_lion sha1 "8ae9b2775e1d9fd0f4025e2ffc14e0c7c8b7b3dd" => :lion end depends_on "libyaml" depends_on "pcre" depends_on "yajl" if build.without? "jansson" depends_on "geoip" => :optional depends_on "gloox" => :optional depends_on "go" => [:build, :optional] depends_on "jansson" => :optional depends_on "libffi" => :optional depends_on "libxslt" => :optional depends_on "lua" => :optional depends_on "mongodb" => :optional depends_on "mongrel2" => :optional depends_on "mono" => :optional depends_on "nagios" => :optional depends_on "postgresql" => :optional depends_on "pypy" => :optional depends_on "rrdtool" => :optional depends_on "rsyslog" => :optional depends_on "tcc" => :optional depends_on "v8" => :optional depends_on "zeromq" => :optional option "with-java", "Compile with Java support" option "with-ruby", "Compile with Ruby support" def install %w{CFLAGS LDFLAGS}.each { |e| ENV.append e, "-arch #{MacOS.preferred_arch}" } system "python", "uwsgiconfig.py", "--build", "core" plugins = ["airbrake", "alarm_curl", "alarm_speech", "asyncio", "cache", "carbon", "cgi", "cheaper_backlog2", "cheaper_busyness", "corerouter", "curl_cron", "cplusplus", "dumbloop", "dummy", "echo", "emperor_amqp", "fastrouter", "forkptyrouter", "gevent", "http", "logcrypto", "logfile", "ldap", "logpipe", "logsocket", "msgpack", "notfound", "pam", "ping", "psgi", "pty", "python", "rawrouter", "router_basicauth", "router_cache", "router_expires", "router_hash", "router_http", "router_memcached", "router_metrics", "router_radius", "router_redirect", "router_redis", "router_rewrite", "router_static", "router_uwsgi", "router_xmldir", "rpc", "signal", "spooler", "sqlite3", "sslrouter", "stats_pusher_file", "stats_pusher_socket", "symcall", "syslog", "transformation_chunked", "transformation_gzip", "transformation_offload", "transformation_tofile", "transformation_toupper","ugreen", "webdav", "zergpool"] plugins << "alarm_xmpp" if build.with? "gloox" plugins << "emperor_mongodb" if build.with? "mongodb" plugins << "emperor_pg" if build.with? "postgresql" plugins << "ffi" if build.with? "libffi" plugins << "fiber" if build.with? "ruby" plugins << "gccgo" if build.with? "go" plugins << "geoip" if build.with? "geoip" plugins << "jvm" if build.with? "java" plugins << "jwsgi" if build.with? "java" plugins << "libtcc" if build.with? "tcc" plugins << "lua" if build.with? "lua" plugins << "mongodb" if build.with? "mongodb" plugins << "mongodblog" if build.with? "mongodb" plugins << "mongrel2" if build.with? "mongrel2" plugins << "mono" if build.with? "mono" plugins << "nagios" if build.with? "nagios" plugins << "pypy" if build.with? "pypy" plugins << "rack" if build.with? "ruby" plugins << "rbthreads" if build.with? "ruby" plugins << "ring" if build.with? "java" plugins << "rrdtool" if build.with? "rrdtool" plugins << "rsyslog" if build.with? "rsyslog" plugins << "servlet" if build.with? "java" plugins << "stats_pusher_mongodb" if build.with? "mongodb" plugins << "v8" if build.with? "v8" plugins << "xslt" if build.with? "libxslt" plugins.each do |plugin| system "python", "uwsgiconfig.py", "--plugin", "plugins/#{plugin}", "core" end bin.install "uwsgi" (libexec/"uwsgi").install Dir["*_plugin.so"] end plist_options :manual => 'uwsgi' def plist; <<-EOS.undent Label #{plist_name} RunAtLoad KeepAlive ProgramArguments #{bin}/uwsgi --uid _www --gid _www --logto #{HOMEBREW_PREFIX}/var/log/uwsgi.log --emperor #{HOMEBREW_PREFIX}/etc/uwsgi/apps-enabled WorkingDirectory #{HOMEBREW_PREFIX} EOS end end