95 lines
3.2 KiB
Ruby
95 lines
3.2 KiB
Ruby
class Minidlna < Formula
|
|
desc "Media server software, compliant with DLNA/UPnP-AV clients"
|
|
homepage "https://sourceforge.net/projects/minidlna/"
|
|
url "https://downloads.sourceforge.net/project/minidlna/minidlna/1.3.0/minidlna-1.3.0.tar.gz"
|
|
sha256 "47d9b06b4c48801a4c1112ec23d24782728b5495e95ec2195bbe5c81bc2d3c63"
|
|
license "GPL-2.0-only"
|
|
revision 3
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "7ee773a739aebde5be347cf63491224cbaeee916f7bceabeaadba57ed6d4d9b4"
|
|
sha256 cellar: :any, arm64_big_sur: "74d90b8e2714475e7dde307fb815e2bc39a48a8eabaff5ce1e2e27760c851a94"
|
|
sha256 cellar: :any, monterey: "fe267dcce7cf6891b4e9d73419be63804b68b9eb4e19fbb95ad5e9c15adda154"
|
|
sha256 cellar: :any, big_sur: "103fb515a66d6ad3a723659b112abea09ba90019361b969d64a05790fece99f1"
|
|
sha256 cellar: :any, catalina: "b676081e78ddaeb0a7cb8304f364421729f01a83dd56b30ee68cde46d0ca4f67"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "22488c11093201c8353d88467bc1211a04c88365d4c14542f336945d3ec0590e"
|
|
end
|
|
|
|
head do
|
|
url "https://git.code.sf.net/p/minidlna/git.git", branch: "master"
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "gettext" => :build
|
|
depends_on "libtool" => :build
|
|
end
|
|
|
|
depends_on "ffmpeg"
|
|
depends_on "flac"
|
|
depends_on "jpeg"
|
|
depends_on "libexif"
|
|
depends_on "libid3tag"
|
|
depends_on "libogg"
|
|
depends_on "libvorbis"
|
|
depends_on "sqlite"
|
|
|
|
fails_with gcc: "5" # ffmpeg is compiled with GCC
|
|
|
|
def install
|
|
system "./autogen.sh" if build.head?
|
|
system "./configure", "--prefix=#{prefix}"
|
|
system "make", "install"
|
|
end
|
|
|
|
def post_install
|
|
conf = <<~EOS
|
|
friendly_name=Mac DLNA Server
|
|
media_dir=#{Dir.home}/.config/minidlna/media
|
|
db_dir=#{Dir.home}/.config/minidlna/cache
|
|
log_dir=#{Dir.home}/.config/minidlna
|
|
EOS
|
|
|
|
(pkgshare/"minidlna.conf").write conf unless File.exist? pkgshare/"minidlna.conf"
|
|
end
|
|
|
|
def caveats
|
|
<<~EOS
|
|
Simple single-user configuration:
|
|
|
|
mkdir -p ~/.config/minidlna
|
|
cp #{opt_pkgshare}/minidlna.conf ~/.config/minidlna/minidlna.conf
|
|
ln -s YOUR_MEDIA_DIR ~/.config/minidlna/media
|
|
minidlnad -f ~/.config/minidlna/minidlna.conf -P ~/.config/minidlna/minidlna.pid
|
|
EOS
|
|
end
|
|
|
|
service do
|
|
run [opt_sbin/"minidlnad", "-d", "-f", "#{Dir.home}/.config/minidlna/minidlna.conf",
|
|
"-P", "#{Dir.home}/.config/minidlna/minidlna.pid"]
|
|
keep_alive true
|
|
log_path var/"log/minidlnad.log"
|
|
error_log_path var/"log/minidlnad.log"
|
|
end
|
|
|
|
test do
|
|
require "expect"
|
|
|
|
(testpath/".config/minidlna/media").mkpath
|
|
(testpath/".config/minidlna/cache").mkpath
|
|
(testpath/"minidlna.conf").write <<~EOS
|
|
friendly_name=Mac DLNA Server
|
|
media_dir=#{testpath}/.config/minidlna/media
|
|
db_dir=#{testpath}/.config/minidlna/cache
|
|
log_dir=#{testpath}/.config/minidlna
|
|
EOS
|
|
|
|
port = free_port
|
|
|
|
io = IO.popen("#{sbin}/minidlnad -d -f minidlna.conf -p #{port} -P #{testpath}/minidlna.pid", "r")
|
|
io.expect("debug: Initial file scan completed", 30)
|
|
assert_predicate testpath/"minidlna.pid", :exist?
|
|
|
|
assert_match "MiniDLNA #{version}", shell_output("curl localhost:#{port}")
|
|
end
|
|
end
|