Dependency resolution

Specify dependencies in your formula's deps function. You can return an Array,
String or Hash, eg:

    def deps
      { :optional => 'libogg', :required => %w[flac sdl], :recommended => 'cmake' }
    end

Note currently the Hash is flattened and qualifications are ignored. If you
only return an Array or String, the qualification is assumed to be :required.

Other packaging systems have problems when it comes to packages requiring a
specific version of a package, or some patches that may not work well with
other software. With Homebrew we have some options:

1.  If the formula is vanilla but an older version we can cherry-pick the old
    version and install it in the Cellar in parallel, but just not symlink it
    into /usr/local while forcing the formula that depends on it to link to
    that one and not any other versions of it.
2.  If the dependency requires patches then we shouldn't install this for use
    by any other tools, (I guess this needs to be decided on a per-situation
    basis). It can be installed into the parent formula's prefix, and not
    symlinked into /usr/local. In this case the dependency's Formula
    derivation should be saved in the parent formula's file (check git or
    flac for an example of this).

Both the above can be done currently with hacks, so I'll flesh out a proper
way sometime this week.
This commit is contained in:
Max Howell 2009-09-07 01:06:08 +01:00
parent 4144ff5875
commit bf7a82e66d
21 changed files with 91 additions and 92 deletions

View file

@ -6,7 +6,7 @@ class Fish <Formula
@md5='4b2436843e63bebba467cc4add11428a'
def deps
LibraryDep.new 'readline'
'readline'
end
def install

32
Formula/ghostscript.rb Normal file
View file

@ -0,0 +1,32 @@
require 'brewkit'
class GhostscriptFonts <Formula
@url='http://downloads.sourceforge.net/project/gs-fonts/gs-fonts/8.11%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-8.11.tar.gz'
@homepage='http://sourceforge.net/projects/gs-fonts/'
@md5='6865682b095f8c4500c54b285ff05ef6'
end
class Ghostscript <Formula
@url='http://downloads.sourceforge.net/project/ghostscript/GPL%20Ghostscript/8.70/ghostscript-8.70.tar.bz2'
@homepage='http://www.ghostscript.com/'
@md5='526366f8cb4fda0d3d293597cc5b984b'
def install
# ghostscript configure ignores LDFLAGs apparently
ENV['LIBS']="-L/usr/X11/lib"
system "./configure", "--prefix=#{prefix}", "--disable-debug",
# the cups component adamantly installs to /usr so fuck it
"--disable-cups"
# versioned stuff in main tree is pointless for us
inreplace 'Makefile', '/$(GS_DOT_VERSION)', ''
system "make install"
(prefix+'share'+'ghostscript'+'doc').rmtree
GhostscriptFonts.new.brew do
Dir.chdir '..'
(prefix+'share'+'ghostscript').install 'fonts'
end
(man+'de').rmtree
end
end

View file

@ -2,43 +2,13 @@ require 'brewkit'
# some credit to http://github.com/maddox/magick-installer
class LibTIFF <Formula
@url='ftp://ftp.remotesensing.org/libtiff/tiff-3.8.2.tar.gz'
@homepage='http://www.libtiff.org/'
@md5='fbb6f446ea4ed18955e2714934e5b698'
end
class Libwmf <Formula
@url='http://downloads.sourceforge.net/project/wvware/libwmf/0.2.8.4/libwmf-0.2.8.4.tar.gz'
@homepage='http://wvware.sourceforge.net/libwmf.html'
@md5='d1177739bf1ceb07f57421f0cee191e0'
end
class LittleCMS <Formula
@url='http://www.littlecms.com/lcms-1.17.tar.gz'
@homepage='http://www.littlecms.com/'
@md5='07bdbb4cfb05d21caa58fe3d1c84ddc1'
end
class Ghostscript <Formula
@url='http://downloads.sourceforge.net/project/ghostscript/GPL%20Ghostscript/8.70/ghostscript-8.70.tar.bz2'
@homepage='http://www.ghostscript.com/'
@md5='526366f8cb4fda0d3d293597cc5b984b'
end
class GhostscriptFonts <Formula
@url='http://downloads.sourceforge.net/project/gs-fonts/gs-fonts/8.11%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-8.11.tar.gz'
@homepage='http://sourceforge.net/projects/gs-fonts/'
@md5='6865682b095f8c4500c54b285ff05ef6'
end
class Imagemagick <Formula
@url='ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.5.5-4.tar.bz2'
@md5='8cb7471a50428e4892ee46aa404e54c2'
@homepage='http://www.imagemagick.org'
def deps
LibraryDep.new 'jpeg'
{ :required => 'jpeg', :optional => %w[libwmf libtiff little-cms ghostscript] }
end
def install
@ -47,33 +17,6 @@ class Imagemagick <Formula
# TODO eventually these will be external optional dependencies
# but for now I am lazy
LibTIFF.new.brew do
system "./configure", "--prefix=#{prefix}", "--disable-debug"
system "make install"
end
Libwmf.new.brew do
system "./configure", "--prefix=#{prefix}", "--disable-debug"
system "make install"
end
LittleCMS.new.brew do
system "./configure", "--prefix=#{prefix}", "--disable-debug"
system "make install"
end
Ghostscript.new.brew do
# ghostscript configure ignores LDFLAGs apparently
ENV['LIBS']="-L/usr/X11/lib"
system "./configure", "--prefix=#{prefix}", "--disable-debug",
# the cups component adamantly installs to /usr so fuck it
"--disable-cups"
# versioned stuff in main tree is pointless for us
inreplace 'Makefile', '/$(GS_DOT_VERSION)', ''
system "make install"
(prefix+'share'+'ghostscript'+'doc').rmtree
end
GhostscriptFonts.new.brew do
Dir.chdir '..'
(prefix+'share'+'ghostscript').install 'fonts'
end
# versioned stuff in main tree is pointless for us
inreplace 'configure', '${PACKAGE_NAME}-${PACKAGE_VERSION}', '${PACKAGE_NAME}'
@ -91,8 +34,6 @@ class Imagemagick <Formula
(d+'NEWS.txt').unlink
(d+'LICENSE').unlink
(d+'ChangeLog').unlink
(man+'de').rmtree
end
def caveats

View file

@ -6,9 +6,7 @@ class Liblastfm <Formula
@md5='3f73222ebc31635941832b01e7a494b6'
def deps
BinaryDep.new 'qmake', 'qt'
LibraryDep.new 'fftw3f', 'fftw'
LibraryDep.new 'samplerate'
%w[qt fftw samplerate]
end
def install

View file

@ -6,8 +6,7 @@ class Libmusicbrainz <Formula
@md5='648ecd43f7b80852419aaf73702bc23f'
def deps
LibraryDep.new 'neon'
OptionalLibraryDep.new 'libdiscid'
{ :required => 'neon', :optional => 'libdiscid' }
end
def install

12
Formula/libtiff.rb Normal file
View file

@ -0,0 +1,12 @@
require 'brewkit'
class Libtiff <Formula
@url='ftp://ftp.remotesensing.org/libtiff/tiff-3.8.2.tar.gz'
@homepage='http://www.libtiff.org/'
@md5='fbb6f446ea4ed18955e2714934e5b698'
def install
system "./configure", "--prefix=#{prefix}", "--disable-debug"
system "make install"
end
end

View file

@ -6,7 +6,7 @@ class Libvorbis <Formula
@homepage='http://vorbis.com'
def deps
LibraryDep.new 'libogg'
'libogg'
end
def install

16
Formula/libwmf.rb Normal file
View file

@ -0,0 +1,16 @@
require 'brewkit'
class Libwmf <Formula
@url='http://downloads.sourceforge.net/project/wvware/libwmf/0.2.8.4/libwmf-0.2.8.4.tar.gz'
@homepage='http://wvware.sourceforge.net/libwmf.html'
@md5='d1177739bf1ceb07f57421f0cee191e0'
def install
ENV.libpng
system "./configure", "--prefix=#{prefix}", "--disable-debug"
system "make"
ENV.j1 # yet another rubbish Makefile
system "make install"
end
end

12
Formula/little-cms.rb Normal file
View file

@ -0,0 +1,12 @@
require 'brewkit'
class LittleCms <Formula
@url='http://www.littlecms.com/lcms-1.17.tar.gz'
@homepage='http://www.littlecms.com/'
@md5='07bdbb4cfb05d21caa58fe3d1c84ddc1'
def install
system "./configure", "--prefix=#{prefix}", "--disable-debug"
system "make install"
end
end

View file

@ -6,7 +6,7 @@ class Memcached <Formula
@md5='d7651ecb8bf345144cb17900d9a46c85'
def deps
LibraryDep.new 'libevent'
'libevent'
end
def install

View file

@ -6,7 +6,7 @@ class MysqlConnectorC <Formula
@md5='348a869fa72957062ea4e7ad3865623c'
def deps
BinaryDep.new 'cmake'
'cmake'
end
def install

View file

@ -6,8 +6,7 @@ class Mysql <Formula
@md5='7564d7759a8077b3a0e6190955422287'
def deps
# --without-readline means use system's readline
LibraryDep.new 'readline'
'readline'
end
def options

View file

@ -6,7 +6,7 @@ class Nginx <Formula
@md5='6ebf89b9b00a3b82734e93c32da7df07'
def deps
LibraryDep.new 'pcre'
'pcre'
end
def install

View file

@ -5,9 +5,7 @@ class Playdar <Formula
@head='git://github.com/mxcl/playdar.git'
def deps
LibraryDep.new 'taglib'
LibraryDep.new 'boost'
BinaryDep.new 'cmake'
%w[taglib boost cmake]
end
def skip_clean? path

View file

@ -7,7 +7,7 @@ class Python <Formula
def deps
# You can build Python without readline, but you really don't want to.
LibraryDep.new 'readline'
'readline'
end
def skip_clean? path

View file

@ -14,11 +14,7 @@ prefer to use theirs. If so type `brew home scummvm' to visit their site.
end
def deps
LibraryDep.new 'sdl'
# Optional, but you want them anyway.
OptionalLibraryDep.new 'flac'
OptionalLibraryDep.new 'libogg'
OptionalLibraryDep.new 'libvorbis'
{ :required => 'sdl', :recommended => %w[flac libogg libvorbis] }
end
def install

View file

@ -14,9 +14,7 @@ class Sshfs <Formula
end
def deps
BinaryDep.new 'pkg-config'
LibraryDep.new 'glib'
LibraryDep.new 'macfuse'
%w[pkg-config glib macfuse]
end
def install

View file

@ -11,13 +11,13 @@ class Taglib <Formula
@homepage='http://developer.kde.org/~wheeler/taglib.html'
def deps
BinaryDep.new 'cmake'
'cmake'
end
def install
system "./configure --disable-debug --prefix='#{prefix}'"
system "make install"
TaglibExtras.new.brew do
system "cmake . #{std_cmake_parameters}"
system "make install"

View file

@ -6,7 +6,7 @@ class Unp <Formula
@md5='ecea662bd7e7efe7f7e2213bf21d9646'
def deps
BinaryDep.new 'p7zip'
'p7zip'
end
def install

View file

@ -6,9 +6,7 @@ class VorbisTools <Formula
@homepage='http://vorbis.com'
def deps
LibraryDep.new 'ogg'
LibraryDep.new 'vorbis'
OptionalLibraryDep.new 'ao', 'ogg123'
{ :required => %w[ogg vorbis], :optional => %w[ao ogg123] }
end
def install

View file

@ -6,7 +6,7 @@ class Yajl <Formula
@md5='f4a3cbc764c43231ed1aedc54438b69b'
def deps
BinaryDep.new 'cmake'
'cmake'
end
def install
@ -18,4 +18,4 @@ class Yajl <Formula
system "./configure --prefix '#{prefix}'"
system "make install"
end
end
end