Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improved MediaTomb Formula

This is a squash of several commits. It includes #9416a3f & #ef97e18
from fiorix (https://github.com/fiorix/homebrew/tree/patch-1) and my
own commits to improve the MediaTomb installation, commit message:

Updated the MediaTomb formula to, by default, compile with all the
options and dependencies that make it useful as a media server. This
includes a private dependency on an older version of SpiderMonkey (as
versions cannot be specified for dependencies in the current version
of Homebrew).
  • Loading branch information...
commit df6bc14f5f4508992df08c8c393724523396aad7 1 parent ece73d2
@digitalpardoe authored
Showing with 85 additions and 1 deletion.
  1. +85 −1 Library/Formula/mediatomb.rb
View
86 Library/Formula/mediatomb.rb
@@ -1,9 +1,80 @@
require 'formula'
+# Internal version of SpiderMonkey (1.7.0) with patches for compile & install on OS X,
+# can be replaced by Homebrew version when it is possible to specify version dependencies
+# in Homebrew formula.
+class Spidermonkey < Formula
+ url 'http://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz'
+ homepage 'https://developer.mozilla.org/en/SpiderMonkey'
+ md5 '5571134c3863686b623ebe4e6b1f6fe6'
+
+ depends_on 'readline'
+ depends_on 'nspr'
+
+ # Install as keg_only as we only need it for MediaTomb (AFAIK).
+ keg_only "This is an older version of SpiderMonkey that is still required for MediaTomb."
+
+ def patches
+ { :p0 => "https://raw.github.com/gist/1530302/17d40f01933859cd985bf180de2fa1f1d24f8e9d/spidermonkey-1.7.0-osx.diff" }
+ end
+
+ def install
+ ENV.deparallelize
+ ENV.no_optimization
+
+ make_opts = "-f Makefile.ref"
+
+ # Install directly into the MediaTomb prefix, this way it's self contained as will
+ # be cleaned up when MediaTomb is uninstalled.
+ prefix = ::Mediatomb.new.prefix.join('spidermonkey')
+
+ Dir.chdir "src" do
+ inreplace 'Makefile.ref' do |s|
+ s.gsub!("__PREFIX__", prefix)
+ s.gsub!("__USER__", `id -un`)
+ s.gsub!("__GROUP__", `id -gn`)
+ end
+
+ # Has no 'configure' script so run a parameterized 'make' command instead.
+ system "make BUILD_OPT=1 LIBDIR=\"#{prefix}/lib\" SO_SUFFIX=dylib JS_THREADSAFE=1 \
+ JS_READLINE=1 JS_DIST=#{HOMEBREW_PREFIX} DIST=#{HOMEBREW_PREFIX} #{make_opts}"
+ system "make install #{make_opts}"
+ end
+ end
+end
+
class Mediatomb < Formula
homepage 'http://mediatomb.cc'
url 'http://downloads.sourceforge.net/mediatomb/mediatomb-0.12.1.tar.gz'
md5 'e927dd5dc52d3cfcebd8ca1af6f0d3c2'
+
+ def options
+ [
+ ['--video-thumbnail', "Enable support for video thumbnails (useful for PS3 etc.)"],
+ ['--lastfm', "Enable Last.fm support"]
+ ]
+ end
+
+ # All these are necessary to make MediaTomb useful, enables transcoding
+ # and metadata parsing to be used.
+ depends_on 'ffmpeg'
+ depends_on 'mp4v2'
+ depends_on 'taglib'
+ depends_on 'libexif'
+ depends_on 'libmagic'
+
+ if ARGV.include? '--video-thumbnail'
+ depends_on 'ffmpegthumbnailer'
+ end
+
+ if ARGV.include? '--lastfm'
+ depends_on 'lastfmlib'
+ end
+
+ # Hack (probably a better way) so SpiderMonkey gets the correct prefix.
+ def initialize name='__UNKNOWN__', path=nil
+ super 'mediatomb', path
+ end
# This is for libav 0.7 support. See:
# https://bugs.launchpad.net/ubuntu/+source/mediatomb/+bug/784431
@@ -25,8 +96,21 @@ def patches
end
def install
+ # SpiderMonkey is required by MediaTomb for playlist & custom import script support.
+ ::Spidermonkey.new.brew do |f|
+ f.install
+ end
+ spidermonkey_prefix = prefix.join('spidermonkey')
+
+ # Disable MySQL as SQLite comes as default (this is an explicit disable, previously
+ # it would compiled with MySQL as 'unavailable' as it was not a dependancy). We are
+ # also disabling inotify as it is Linux specific.
system "./configure", "--disable-dependency-tracking",
- "--prefix=#{prefix}"
+ "--prefix=#{prefix}",
+ "--enable-mysql=disabled",
+ "--enable-inotify=disabled",
+ "--with-js-h=#{spidermonkey_prefix}/include/js",
+ "--with-js-libs=#{spidermonkey_prefix}/lib"
system "make install"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.