homebrew-core/Formula/mpd.rb
2018-09-18 15:34:33 +02:00

128 lines
3.3 KiB
Ruby

class Mpd < Formula
desc "Music Player Daemon"
homepage "https://www.musicpd.org/"
url "https://www.musicpd.org/download/mpd/0.20/mpd-0.20.21.tar.xz"
sha256 "8322764dc265c20f05c8c8fdfdd578b0722e74626bef56fcd8eebfb01acc58dc"
revision 1
bottle do
rebuild 1
sha256 "6d4ef128843ca263b4b15ea3b70839d1f7385cc9cac8187056012a64a53c63b2" => :mojave
sha256 "cfeba0309eabc75bdf6c5a6f8273d4c65f6128b248c33b8a57985bddf3a66d25" => :high_sierra
sha256 "972db47dcce26f700802661dd6aae2a16cfefbe5a2e5bfd23ad395db97f8b23f" => :sierra
sha256 "619fe3fae8f6b7ea37cd2e2388c8990387db2b0025a825bf8d1e136c11d6ce2f" => :el_capitan
end
head do
url "https://github.com/MusicPlayerDaemon/MPD.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
end
depends_on "boost" => :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
system "./autogen.sh" if build.head?
args = %W[
--disable-debug
--disable-dependency-tracking
--prefix=#{prefix}
--sysconfdir=#{etc}
--disable-libwrap
--disable-mad
--disable-mpc
--disable-soundcloud
--enable-ao
--enable-bzip2
--enable-expat
--enable-ffmpeg
--enable-fluidsynth
--enable-osx
--enable-upnp
--enable-vorbis-encoder
]
system "./configure", *args
system "make"
ENV.deparallelize # Directories are created in parallel, so let's not do that
system "make", "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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//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>WorkingDirectory</key>
<string>#{HOMEBREW_PREFIX}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/mpd</string>
<string>--no-daemon</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>ProcessType</key>
<string>Interactive</string>
</dict>
</plist>
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