class Mpd < Formula desc "Music Player Daemon" homepage "https://www.musicpd.org/" url "https://www.musicpd.org/download/mpd/0.21/mpd-0.21.3.tar.xz" sha256 "6cf60e644870c6063a008d833a6c876272b7679a400b83012ed209c15ce06e2a" revision 1 head "https://github.com/MusicPlayerDaemon/MPD.git" bottle do sha256 "0e8b637524e77052e1b8b35ded89033cfa5ea351509474804296506c32d2cbd3" => :mojave sha256 "ec55a408fc1f1c8a90df41488c782eb77e53db92b4766632e008905f12e3decc" => :high_sierra sha256 "9fe5ee4e9126630e02600df8e1a4eb6cebef72bda40ba5cacf0cb452b19bc434" => :sierra end depends_on "boost" => :build depends_on "meson" => :build depends_on "ninja" => :build depends_on "pkg-config" => :build depends_on "expat" depends_on "faad2" depends_on "ffmpeg" depends_on "flac" depends_on "fluid-synth" depends_on "glib" depends_on "icu4c" depends_on "lame" depends_on "libao" depends_on "libid3tag" depends_on "libmpdclient" depends_on "libsamplerate" depends_on "libupnp" depends_on "libvorbis" depends_on "opus" depends_on "sqlite" needs :cxx11 def install # mpd specifies -std=gnu++0x, but clang appears to try to build # that against libstdc++ anyway, which won't work. # The build is fine with G++. ENV.libcxx args = %W[ --prefix=#{prefix} --sysconfdir=#{etc} -Dlibwrap=disabled -Dmad=disabled -Dmpcdec=disabled -Dsoundcloud=disabled -Dao=enabled -Dbzip2=enabled -Dexpat=enabled -Dffmpeg=enabled -Dfluidsynth=enabled -Dupnp=enabled -Dvorbisenc=enabled ] system "meson", *args, "output/release", "." system "ninja", "-C", "output/release" ENV.deparallelize # Directories are created in parallel, so let's not do that system "ninja", "-C", "output/release", "install" (etc/"mpd").install "doc/mpdconf.example" => "mpd.conf" end def caveats; <<~EOS MPD requires a config file to start. Please copy it from #{etc}/mpd/mpd.conf into one of these paths: - ~/.mpd/mpd.conf - ~/.mpdconf and tailor it to your needs. EOS end plist_options :manual => "mpd" def plist; <<~EOS Label #{plist_name} WorkingDirectory #{HOMEBREW_PREFIX} ProgramArguments #{opt_bin}/mpd --no-daemon RunAtLoad KeepAlive ProcessType Interactive EOS end test do pid = fork do exec "#{bin}/mpd --stdout --no-daemon --no-config" end sleep 2 begin assert_match "OK MPD", shell_output("curl localhost:6600") assert_match "ACK", shell_output("(sleep 2; echo playid foo) | nc localhost 6600") ensure Process.kill "SIGINT", pid Process.wait pid end end end