145 lines
3.9 KiB
Ruby
145 lines
3.9 KiB
Ruby
class Mpd < Formula
|
|
desc "Music Player Daemon"
|
|
homepage "https://www.musicpd.org/"
|
|
url "https://www.musicpd.org/download/mpd/0.21/mpd-0.21.18.tar.xz"
|
|
sha256 "8782e66cd5afd6c92860725196b35b6df07d3d127ef70e900e144323089e9442"
|
|
head "https://github.com/MusicPlayerDaemon/MPD.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "97205bdca3c0ab031163f0b6721a4a07072de25d98c9ebab9228c97a7e0ee651" => :catalina
|
|
sha256 "d50ccd6d119e4d7a8b2d5fb6267e2b576f2f8d35eb27f0e2885fc2f4b7db7ef6" => :mojave
|
|
sha256 "97c3161fd3a06c8158c388a3c2a094b4698f73ef7218270ede11d7bcd7f06d94" => :high_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 "libgcrypt"
|
|
depends_on "libid3tag"
|
|
depends_on "libmpdclient"
|
|
depends_on "libnfs"
|
|
depends_on "libsamplerate"
|
|
depends_on "libupnp"
|
|
depends_on "libvorbis"
|
|
depends_on "opus"
|
|
depends_on "sqlite"
|
|
|
|
# Fix compilation with Clang
|
|
# This patch backports https://github.com/MusicPlayerDaemon/MPD/commit/dca0519336586be95b920004178114a097681768
|
|
# Remove in next release
|
|
patch :DATA
|
|
|
|
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
|
|
-Dnfs=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
|
|
<?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
|
|
ohai "Connect to MPD command (localhost:6600)"
|
|
TCPSocket.open("localhost", 6600) do |sock|
|
|
assert_match "OK MPD", sock.gets
|
|
ohai "Ping server"
|
|
sock.puts("ping")
|
|
assert_match "OK", sock.gets
|
|
sock.close
|
|
end
|
|
ensure
|
|
Process.kill "SIGINT", pid
|
|
Process.wait pid
|
|
end
|
|
end
|
|
end
|
|
|
|
__END__
|
|
diff --git a/src/util/Compiler.h b/src/util/Compiler.h
|
|
index 96f63fae4..04e49bb61 100644
|
|
--- a/src/util/Compiler.h
|
|
+++ b/src/util/Compiler.h
|
|
@@ -145,7 +145,7 @@
|
|
|
|
#if GCC_CHECK_VERSION(7,0)
|
|
#define gcc_fallthrough __attribute__((fallthrough))
|
|
-#elif CLANG_CHECK_VERSION(10,0)
|
|
+#elif CLANG_CHECK_VERSION(10,0) && defined(__cplusplus)
|
|
#define gcc_fallthrough [[fallthrough]]
|
|
#else
|
|
#define gcc_fallthrough
|