80 lines
2.4 KiB
Ruby
80 lines
2.4 KiB
Ruby
class Minidlna < Formula
|
|
desc "Media server software, compliant with DLNA/UPnP-AV clients"
|
|
homepage "http://sourceforge.net/projects/minidlna/"
|
|
url "https://downloads.sourceforge.net/project/minidlna/minidlna/1.1.5/minidlna-1.1.5.tar.gz"
|
|
sha256 "8477ad0416bb2af5cd8da6dde6c07ffe1a413492b7fe40a362bc8587be15ab9b"
|
|
|
|
bottle do
|
|
cellar :any
|
|
revision 1
|
|
sha256 "a1720c0519c4c628f1741e340b4462f92a2b20a00f8ed319d7a98602d4ad27a5" => :el_capitan
|
|
sha256 "f59f5cc914bbd49af01f7421e5d0b368b05eca5a3f63b32be446c61b6ab151cc" => :yosemite
|
|
sha256 "00a50390c52a5fd7fed585776d586ef285c27ff98e7239ca219325577cf2c10d" => :mavericks
|
|
end
|
|
|
|
head do
|
|
url "git://git.code.sf.net/p/minidlna/git"
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
depends_on "gettext" => :build
|
|
end
|
|
|
|
depends_on "libexif"
|
|
depends_on "jpeg"
|
|
depends_on "libid3tag"
|
|
depends_on "flac"
|
|
depends_on "libogg"
|
|
depends_on "libvorbis"
|
|
depends_on "sqlite"
|
|
depends_on "ffmpeg"
|
|
|
|
def install
|
|
ENV.append_to_cflags "-std=gnu89"
|
|
system "./autogen.sh" if build.head?
|
|
system "./configure", "--exec-prefix=#{prefix}"
|
|
system "make", "install"
|
|
end
|
|
|
|
def post_install
|
|
(pkgshare/"minidlna.conf").write <<-EOS.undent
|
|
friendly_name=Mac DLNA Server
|
|
media_dir=#{ENV["HOME"]}/.config/minidlna/media
|
|
db_dir=#{ENV["HOME"]}/.config/minidlna/cache
|
|
log_dir=#{ENV["HOME"]}/.config/minidlna
|
|
EOS
|
|
end
|
|
|
|
def caveats; <<-EOS.undent
|
|
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
|
|
|
|
test do
|
|
(testpath/".config/minidlna/media").mkpath
|
|
(testpath/".config/minidlna/cache").mkpath
|
|
(testpath/"minidlna.conf").write <<-EOS.undent
|
|
friendly_name=Mac DLNA Server
|
|
media_dir=#{testpath}/.config/minidlna/media
|
|
db_dir=#{testpath}/.config/minidlna/cache
|
|
log_dir=#{testpath}/.config/minidlna
|
|
EOS
|
|
|
|
pid = fork do
|
|
exec "#{sbin}/minidlnad -f minidlna.conf -p 8081 -P #{testpath}/minidlna.pid"
|
|
end
|
|
sleep 2
|
|
|
|
begin
|
|
assert_match /MiniDLNA #{version}/, shell_output("curl localhost:8081")
|
|
ensure
|
|
Process.kill("SIGINT", pid)
|
|
Process.wait(pid)
|
|
end
|
|
end
|
|
end
|