aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Formula/erlang.rb8
-rw-r--r--Library/Formula/fish.rb4
-rw-r--r--Library/Formula/ghostscript.rb32
-rw-r--r--Library/Formula/glib.rb6
-rw-r--r--Library/Formula/imagemagick.rb80
-rw-r--r--Library/Formula/liblastfm.rb8
-rw-r--r--Library/Formula/libmusicbrainz.rb6
-rw-r--r--Library/Formula/libtiff.rb12
-rw-r--r--Library/Formula/libvorbis.rb4
-rw-r--r--Library/Formula/libwmf.rb16
-rw-r--r--Library/Formula/little-cms.rb12
-rw-r--r--Library/Formula/memcached.rb4
-rw-r--r--Library/Formula/mysql-connector-c.rb4
-rw-r--r--Library/Formula/mysql.rb5
-rw-r--r--Library/Formula/nginx.rb4
-rw-r--r--Library/Formula/playdar.rb8
-rw-r--r--Library/Formula/python.rb29
-rw-r--r--Library/Formula/scummvm.rb11
-rw-r--r--Library/Formula/sshfs.rb8
-rw-r--r--Library/Formula/subversion.rb13
-rw-r--r--Library/Formula/taglib.rb2
-rw-r--r--Library/Formula/unp.rb4
-rw-r--r--Library/Formula/vorbis-tools.rb9
-rw-r--r--Library/Formula/yajl.rb6
-rw-r--r--Library/Homebrew/ARGV+yeast.rb3
-rw-r--r--Library/Homebrew/brew.h.rb9
-rw-r--r--Library/Homebrew/formula.rb37
-rwxr-xr-xLibrary/Homebrew/unittest.rb23
-rwxr-xr-xbin/brew46
29 files changed, 236 insertions, 177 deletions
diff --git a/Library/Formula/erlang.rb b/Library/Formula/erlang.rb
index 06eb492df..91671d3bc 100644
--- a/Library/Formula/erlang.rb
+++ b/Library/Formula/erlang.rb
@@ -17,11 +17,6 @@ class Erlang <Formula
@url='http://erlang.org/download/otp_src_R13B02.tar.gz'
@md5='80048e589272db810f5d536f47050ab8'
- def deps
- LibraryDep.new 'icu4c'
- LibraryDep.new 'openssl'
- end
-
# def patches
# [
# "http://pastie.org/603456.txt",
@@ -37,6 +32,9 @@ class Erlang <Formula
# ]
# end
+ depends_on 'icu4c'
+ depends_on 'openssl'
+
def install
ENV.deparallelize
config_flags = ["--disable-debug",
diff --git a/Library/Formula/fish.rb b/Library/Formula/fish.rb
index ab489a0b8..1d307823c 100644
--- a/Library/Formula/fish.rb
+++ b/Library/Formula/fish.rb
@@ -5,9 +5,7 @@ class Fish <Formula
@homepage='http:://fishshell.org/'
@md5='4b2436843e63bebba467cc4add11428a'
- def deps
- LibraryDep.new 'readline'
- end
+ depends_on 'readline'
def install
system "./configure", "--prefix=#{prefix}", "--without-xsel"
diff --git a/Library/Formula/ghostscript.rb b/Library/Formula/ghostscript.rb
new file mode 100644
index 000000000..9f7ef7785
--- /dev/null
+++ b/Library/Formula/ghostscript.rb
@@ -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
diff --git a/Library/Formula/glib.rb b/Library/Formula/glib.rb
index bc5b841f2..155240fc7 100644
--- a/Library/Formula/glib.rb
+++ b/Library/Formula/glib.rb
@@ -12,10 +12,8 @@ class Glib <Formula
@md5='4c178b91d82ef80a2da3c26b772569c0'
@homepage='http://www.gtk.org'
- def deps
- BinaryDep.new 'pkg-config'
- LibraryDep.new 'gettext'
- end
+ depends_on 'pkg-config'
+ depends_on 'gettext'
def install
ENV.gnu_gettext
diff --git a/Library/Formula/imagemagick.rb b/Library/Formula/imagemagick.rb
index 96a0503d9..f745ef12c 100644
--- a/Library/Formula/imagemagick.rb
+++ b/Library/Formula/imagemagick.rb
@@ -2,44 +2,16 @@ 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-10.tar.bz2'
@md5='36bcef67cae5d5fce2899acb9200213a'
@homepage='http://www.imagemagick.org'
- def deps
- LibraryDep.new 'jpeg'
- end
+ depends_on 'jpeg'
+ depends_on 'libwmf' => :optional
+ depends_on 'libtiff' => :optional
+ depends_on 'little-cms' => :optional
+ depends_on 'ghostscript' => :recommended
def install
ENV.libpng
@@ -47,33 +19,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}'
@@ -86,20 +31,17 @@ class Imagemagick <Formula
"--without-maximum-compile-warnings",
"--prefix=#{prefix}",
"--disable-osx-universal-binary",
- "--with-gs-font-dir=#{prefix}/share/ghostscript/fonts",
+ "--with-gs-font-dir=#{HOMEBREW_PREFIX}/share/ghostscript/fonts",
"--without-perl" # I couldn't make this compile
system "make install"
- # We already copy these in
- d=prefix+'share'
- (d+'NEWS.txt').unlink
- (d+'LICENSE').unlink
- (d+'ChangeLog').unlink
-
- (man+'de').rmtree
+ # We already copy these into the keg root
+ (share+'NEWS.txt').unlink
+ (share+'LICENSE').unlink
+ (share+'ChangeLog').unlink
end
def caveats
- "I'm not a heavy user of ImageMagick, so please check everything is installed."
+ "If there is something missing that you need with this formula, please create an issue at #{HOMEBREW_WWW}"
end
end \ No newline at end of file
diff --git a/Library/Formula/liblastfm.rb b/Library/Formula/liblastfm.rb
index 52444bdfa..fabdf637b 100644
--- a/Library/Formula/liblastfm.rb
+++ b/Library/Formula/liblastfm.rb
@@ -5,11 +5,9 @@ class Liblastfm <Formula
@url='http://static.last.fm/src/liblastfm-0.3.0.tar.bz2'
@md5='3f73222ebc31635941832b01e7a494b6'
- def deps
- BinaryDep.new 'qmake', 'qt'
- LibraryDep.new 'fftw3f', 'fftw'
- LibraryDep.new 'samplerate'
- end
+ depends_on 'qt'
+ depends_on 'fftw'
+ depends_on 'samplerate'
def install
system "./configure --release --prefix '#{prefix}'"
diff --git a/Library/Formula/libmusicbrainz.rb b/Library/Formula/libmusicbrainz.rb
index d562ab12a..b7869abca 100644
--- a/Library/Formula/libmusicbrainz.rb
+++ b/Library/Formula/libmusicbrainz.rb
@@ -5,10 +5,8 @@ class Libmusicbrainz <Formula
@homepage='http://musicbrainz.org'
@md5='648ecd43f7b80852419aaf73702bc23f'
- def deps
- LibraryDep.new 'neon'
- OptionalLibraryDep.new 'libdiscid'
- end
+ depends_on 'neon'
+ depends_on 'libdiscid' => :optional
def install
system "cmake . #{std_cmake_parameters}"
diff --git a/Library/Formula/libtiff.rb b/Library/Formula/libtiff.rb
new file mode 100644
index 000000000..831491321
--- /dev/null
+++ b/Library/Formula/libtiff.rb
@@ -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
diff --git a/Library/Formula/libvorbis.rb b/Library/Formula/libvorbis.rb
index d597b1feb..d4ca863e8 100644
--- a/Library/Formula/libvorbis.rb
+++ b/Library/Formula/libvorbis.rb
@@ -5,9 +5,7 @@ class Libvorbis <Formula
@md5='6a7086ee666b8c62e122d29d107f7bec'
@homepage='http://vorbis.com'
- def deps
- LibraryDep.new 'libogg'
- end
+ depends_on 'libogg'
def install
system "./configure --enable-docs --disable-debug --disable-dependency-tracking --prefix='#{prefix}'"
diff --git a/Library/Formula/libwmf.rb b/Library/Formula/libwmf.rb
new file mode 100644
index 000000000..f1a3ba1a1
--- /dev/null
+++ b/Library/Formula/libwmf.rb
@@ -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
diff --git a/Library/Formula/little-cms.rb b/Library/Formula/little-cms.rb
new file mode 100644
index 000000000..a3efd783b
--- /dev/null
+++ b/Library/Formula/little-cms.rb
@@ -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
diff --git a/Library/Formula/memcached.rb b/Library/Formula/memcached.rb
index fda521f1d..3b942615f 100644
--- a/Library/Formula/memcached.rb
+++ b/Library/Formula/memcached.rb
@@ -5,9 +5,7 @@ class Memcached <Formula
@homepage='http://www.danga.com/memcached/'
@md5='d7651ecb8bf345144cb17900d9a46c85'
- def deps
- LibraryDep.new 'libevent'
- end
+ depends_on 'libevent'
def install
system "./configure --prefix='#{prefix}'"
diff --git a/Library/Formula/mysql-connector-c.rb b/Library/Formula/mysql-connector-c.rb
index f97945135..580b6f5a6 100644
--- a/Library/Formula/mysql-connector-c.rb
+++ b/Library/Formula/mysql-connector-c.rb
@@ -5,9 +5,7 @@ class MysqlConnectorC <Formula
@url='http://mysql.llarian.net/Downloads/Connector-C/mysql-connector-c-6.0.1.tar.gz'
@md5='348a869fa72957062ea4e7ad3865623c'
- def deps
- BinaryDep.new 'cmake'
- end
+ depends_on 'cmake'
def install
system "cmake . #{std_cmake_parameters}"
diff --git a/Library/Formula/mysql.rb b/Library/Formula/mysql.rb
index 1d5aa8c27..f87121cfb 100644
--- a/Library/Formula/mysql.rb
+++ b/Library/Formula/mysql.rb
@@ -5,10 +5,7 @@ class Mysql <Formula
@homepage='http://dev.mysql.com/doc/refman/5.1/en/'
@md5='7564d7759a8077b3a0e6190955422287'
- def deps
- # --without-readline means use system's readline
- LibraryDep.new 'readline'
- end
+ depends_on 'readline'
def options
[
diff --git a/Library/Formula/nginx.rb b/Library/Formula/nginx.rb
index b2fe3e2fa..d0f03666b 100644
--- a/Library/Formula/nginx.rb
+++ b/Library/Formula/nginx.rb
@@ -5,9 +5,7 @@ class Nginx <Formula
@homepage='http://nginx.net/'
@md5='6ebf89b9b00a3b82734e93c32da7df07'
- def deps
- LibraryDep.new 'pcre'
- end
+ depends_on 'pcre'
def install
system "./configure", "--prefix=#{prefix}", "--with-http_ssl_module"
diff --git a/Library/Formula/playdar.rb b/Library/Formula/playdar.rb
index 0d2669ea8..5ec5c0639 100644
--- a/Library/Formula/playdar.rb
+++ b/Library/Formula/playdar.rb
@@ -4,11 +4,9 @@ class Playdar <Formula
@homepage='http://www.playdar.org'
@head='git://github.com/mxcl/playdar.git'
- def deps
- LibraryDep.new 'taglib'
- LibraryDep.new 'boost'
- BinaryDep.new 'cmake'
- end
+ depends_on 'taglib'
+ depends_on 'boost'
+ depends_on 'cmake'
def skip_clean? path
# for some reason stripping breaks it
diff --git a/Library/Formula/python.rb b/Library/Formula/python.rb
index d1d058644..c1d15a887 100644
--- a/Library/Formula/python.rb
+++ b/Library/Formula/python.rb
@@ -1,15 +1,34 @@
require 'brewkit'
+class Readline <Formula
+ @url='ftp://ftp.gnu.org/gnu/readline/readline-5.2.tar.gz'
+ @homepage='http://tiswww.case.edu/php/chet/readline/rltop.html'
+ @md5='e39331f32ad14009b9ff49cc10c5e751'
+
+ def patches
+ (1..14).collect {|n| "ftp://ftp.gnu.org/gnu/readline/readline-5.2-patches/readline52-%03d"%n}
+ end
+
+ def keg_only?
+ true
+ end
+
+ def install
+ system "./configure", "--prefix=#{prefix}",
+ "--mandir=#{man}",
+ "--infodir=#{info}"
+ system "make install"
+ end
+end
+
class Python <Formula
@url='http://www.python.org/ftp/python/2.6.2/Python-2.6.2.tar.bz2'
@homepage='http://www.python.org/'
@md5='245db9f1e0f09ab7e0faaa0cf7301011'
- def deps
- # You can build Python without readline, but you really don't want to.
- LibraryDep.new 'readline'
- end
-
+ # You can build Python without readline, but you really don't want to.
+ depends_on Readline.new
+
def skip_clean? path
path == bin+'python' or path == bin+'python2.6' or # if you strip these, it can't load modules
path == lib+'python2.6' # save a lot of time
diff --git a/Library/Formula/scummvm.rb b/Library/Formula/scummvm.rb
index de0bd7bf1..912c4207e 100644
--- a/Library/Formula/scummvm.rb
+++ b/Library/Formula/scummvm.rb
@@ -13,13 +13,10 @@ prefer to use theirs. If so type `brew home scummvm' to visit their site.
EOS
end
- def deps
- LibraryDep.new 'sdl'
- # Optional, but you want them anyway.
- OptionalLibraryDep.new 'flac'
- OptionalLibraryDep.new 'libogg'
- OptionalLibraryDep.new 'libvorbis'
- end
+ depends_on 'sdl'
+ depends_on 'flac' => :recommended
+ depends_on 'libvorbis' => :recommended
+ depends_on 'libogg' => :recommended
def install
system "./configure --prefix='#{prefix}' --disable-debug"
diff --git a/Library/Formula/sshfs.rb b/Library/Formula/sshfs.rb
index adcde3167..b0ebb757e 100644
--- a/Library/Formula/sshfs.rb
+++ b/Library/Formula/sshfs.rb
@@ -11,11 +11,9 @@ class Sshfs <Formula
"http://macfuse.googlecode.com/svn/tags/macfuse-2.0.3|2/filesystems/sshfs/sshfs-fuse-2.2-macosx.patch"
end
- def deps
- BinaryDep.new 'pkg-config'
- LibraryDep.new 'glib'
- LibraryDep.new 'macfuse'
- end
+ depends_on 'pkg-config'
+ depends_on 'glib'
+ depends_on 'macfuse'
def install
# Steal compile flags from macfuse_buildtool.sh
diff --git a/Library/Formula/subversion.rb b/Library/Formula/subversion.rb
index 63254e746..e4584062e 100644
--- a/Library/Formula/subversion.rb
+++ b/Library/Formula/subversion.rb
@@ -1,22 +1,13 @@
require 'brewkit'
-class SubversionDeps <Formula
- @url='http://subversion.tigris.org/downloads/subversion-deps-1.6.5.tar.bz2'
- @md5='8272316e1670d4d2bea451411e438bde'
-end
-
class Subversion <Formula
@url='http://subversion.tigris.org/downloads/subversion-1.6.5.tar.bz2'
@homepage='http://subversion.tigris.org/'
@md5='1a53a0e72bee0bf814f4da83a9b6a636'
- def install
- # Slot dependencies into place
- d=Pathname.getwd
- SubversionDeps.new.brew do
- d.install Dir['*']
- end
+ depends_on 'neon'
+ def install
# Use existing system zlib, dep-provided other libraries
# Don't mess with Apache modules (since we're not sudo)
system "./configure", "--disable-debug",
diff --git a/Library/Formula/taglib.rb b/Library/Formula/taglib.rb
index e6923b808..7da720b2c 100644
--- a/Library/Formula/taglib.rb
+++ b/Library/Formula/taglib.rb
@@ -5,6 +5,8 @@ class Taglib <Formula
@md5='5ecad0816e586a954bd676a86237d054'
@homepage='http://developer.kde.org/~wheeler/taglib.html'
+ depends_on 'cmake'
+
def install
system "./configure", "--enable-mp4", "--enable-asf",
"--disable-debug", "--prefix=#{prefix}"
diff --git a/Library/Formula/unp.rb b/Library/Formula/unp.rb
index 50ab9ea8c..d01b7a36e 100644
--- a/Library/Formula/unp.rb
+++ b/Library/Formula/unp.rb
@@ -5,9 +5,7 @@ class Unp <Formula
@homepage='http://packages.debian.org/de/etch/unp'
@md5='ecea662bd7e7efe7f7e2213bf21d9646'
- def deps
- BinaryDep.new 'p7zip'
- end
+ depends_on 'p7zip'
def install
bin.install %w[unp ucat]
diff --git a/Library/Formula/vorbis-tools.rb b/Library/Formula/vorbis-tools.rb
index 4cd6613ac..deaa2d403 100644
--- a/Library/Formula/vorbis-tools.rb
+++ b/Library/Formula/vorbis-tools.rb
@@ -5,11 +5,10 @@ class VorbisTools <Formula
@md5='df976d24e51ef3d87cd462edf747bf9a'
@homepage='http://vorbis.com'
- def deps
- LibraryDep.new 'ogg'
- LibraryDep.new 'vorbis'
- OptionalLibraryDep.new 'ao', 'ogg123'
- end
+ depends_on 'ogg'
+ depends_on 'vorbis'
+ depends_on 'ao' => :optional
+ depends_on 'ogg123' => :optional
def install
system "./configure --disable-debug --disable-nls --disable-dependency-tracking --prefix='#{prefix}'"
diff --git a/Library/Formula/yajl.rb b/Library/Formula/yajl.rb
index 288e2fd39..f47a454e4 100644
--- a/Library/Formula/yajl.rb
+++ b/Library/Formula/yajl.rb
@@ -5,9 +5,7 @@ class Yajl <Formula
@url='http://github.com/lloyd/yajl/tarball/1.0.5'
@md5='f4a3cbc764c43231ed1aedc54438b69b'
- def deps
- BinaryDep.new 'cmake'
- end
+ depends_on 'cmake'
def install
ENV.deparallelize
@@ -18,4 +16,4 @@ class Yajl <Formula
system "./configure --prefix '#{prefix}'"
system "make install"
end
-end \ No newline at end of file
+end
diff --git a/Library/Homebrew/ARGV+yeast.rb b/Library/Homebrew/ARGV+yeast.rb
index f9f50c01a..8825718d4 100644
--- a/Library/Homebrew/ARGV+yeast.rb
+++ b/Library/Homebrew/ARGV+yeast.rb
@@ -66,6 +66,9 @@ module HomebrewArgvExtension
def quieter?
flag? '--quieter'
end
+ def interactive?
+ flag? '--interactive'
+ end
def flag? flag
options.each do |arg|
diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb
index f482559f6..d02d44dc1 100644
--- a/Library/Homebrew/brew.h.rb
+++ b/Library/Homebrew/brew.h.rb
@@ -144,6 +144,15 @@ def clean f
end
+def expand_deps ff
+ deps = []
+ ff.deps.collect do |f|
+ deps += expand_deps(Formula.factory(f))
+ end
+ deps << ff
+end
+
+
def prune
$n=0
$d=0
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index ee9bd36f6..ffb71bb44 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -116,9 +116,7 @@ class Formula
# }
# The final option is to return DATA, then put a diff after __END__. You
# can still return a Hash with DATA as the value for a patch level key.
- def patches; end
- # reimplement and specify dependencies
- def deps; end
+ def patches; [] end
# sometimes the clean process breaks things, return true to skip anything
def skip_clean? path; false end
# rarely, you don't want your library symlinked into the main prefix
@@ -129,7 +127,7 @@ class Formula
def brew
validate_variable :name
validate_variable :version
-
+
stage do
begin
patch
@@ -165,6 +163,7 @@ class Formula
end
def self.factory name
+ return name if name.kind_of? Formula
path = Pathname.new(name)
if path.absolute?
require name
@@ -181,6 +180,10 @@ class Formula
HOMEBREW_PREFIX+'Library'+'Formula'+"#{name.downcase}.rb"
end
+ def deps
+ self.class.deps or []
+ end
+
protected
# Pretty titles the command and buffers stdout/stderr
# Throws if there's an error
@@ -327,9 +330,31 @@ private
end
class <<self
- attr_reader :url, :version, :homepage, :head
+ attr_reader :url, :version, :homepage, :head, :deps
attr_reader *CHECKSUM_TYPES
- end
+
+ def depends_on name, *args
+ @deps ||= []
+
+ case name
+ when String
+ # noop
+ when Hash
+ name = name.keys.first # indeed, we only support one mapping
+ when Symbol
+ name = name.to_s
+ when Formula
+ @deps << name
+ return # we trust formula dev to not dupe their own instantiations
+ else
+ raise "Unsupported type #{name.class}"
+ end
+
+ # we get duplicates because every new fork of this process repeats this
+ # step for some reason I am not sure about
+ @deps << name unless @deps.include? name
+ end
+ end
end
# see ack.rb for an example usage
diff --git a/Library/Homebrew/unittest.rb b/Library/Homebrew/unittest.rb
index 0b2d7df7f..15336ebde 100755
--- a/Library/Homebrew/unittest.rb
+++ b/Library/Homebrew/unittest.rb
@@ -42,7 +42,8 @@ class MostlyAbstractFormula <Formula
end
class TestBall <Formula
- def initialize
+ # name parameter required for some Formula::factory
+ def initialize name=nil
@url="file:///#{Pathname.new(ABS__FILE__).parent.realpath}/testball-0.1.tbz"
super "testball"
end
@@ -123,9 +124,13 @@ def nostdout
end
module ExtendArgvPlusYeast
- def stick_an_arg_in_thar
+ def reset
@named=nil
- unshift 'foo'
+ @formulae=nil
+ @kegs=nil
+ while ARGV.count > 0
+ ARGV.shift
+ end
end
end
ARGV.extend ExtendArgvPlusYeast
@@ -372,8 +377,9 @@ class BeerTasting <Test::Unit::TestCase
end
def test_no_ARGV_dupes
- ARGV.unshift'foo'
- ARGV.unshift'foo'
+ ARGV.reset
+ ARGV.unshift 'foo'
+ ARGV.unshift 'foo'
n=0
ARGV.named.each{|arg| n+=1 if arg == 'foo'}
assert_equal 1, n
@@ -385,9 +391,10 @@ class BeerTasting <Test::Unit::TestCase
assert_raises(UsageError) { ARGV.kegs }
assert ARGV.named_empty?
- (HOMEBREW_CELLAR+'foo'+'0.1').mkpath
+ (HOMEBREW_CELLAR+'mxcl'+'10.0').mkpath
- ARGV.stick_an_arg_in_thar
+ ARGV.reset
+ ARGV.unshift 'mxcl'
assert_equal 1, ARGV.named.length
assert_equal 1, ARGV.kegs.length
assert_raises(FormulaUnavailableError) { ARGV.formulae }
@@ -425,7 +432,7 @@ class BeerTasting <Test::Unit::TestCase
nostdout do
assert_nothing_raised do
f=TestBall.new
- make 'http://example.com/testball-0.1.tbz'
+ make f.url
info f.name
clean f
prune
diff --git a/bin/brew b/bin/brew
index 556797374..eae57d15f 100755
--- a/bin/brew
+++ b/bin/brew
@@ -22,6 +22,7 @@ unless system "which -s gcc-4.2" and $?.success?
abort "Sorry, Homebrew requires gcc 4.2, which is provided by Xcode 3.1"
end
+
begin
case ARGV.shift
when '--prefix' then puts HOMEBREW_PREFIX
@@ -76,24 +77,48 @@ begin
puts "#{f}: #{ENV[f]}" unless ENV[f].to_s.empty?
end
end
-
- unless system "which #{ENV['CC'] or 'cc'} &> /dev/null" and $?.success?
- raise "We cannot find a c compiler, have you installed the latest Xcode?"
+
+ if ARGV.interactive? and ARGV.formulae.count > 1
+ # the reason for this is interactive mode is a little tricky to do
+ # with more than one formula, AND I can't think of a time where you'd
+ # want to do it anyway. If someone comes up with a legitimate use for
+ # this we will adapt the code. "But I might want it!" is not a
+ # legitimate use!
+ raise "Interactive mode can only be used with one formula argument"
end
- require 'beer_events'
-
- watch_out_for_spill do
- ARGV.formulae.each do |f|
- if f.installed? and not ARGV.force?
+ unless ARGV.force?
+ unless system "which #{ENV['CC'] or 'cc'} &> /dev/null" and $?.success?
+ raise "We cannot find a c compiler, have you installed the latest Xcode?"
+ end
+ formulae = ARGV.formulae.reject do |f|
+ if f.installed?
message = "Formula already installed: #{f.prefix}"
if ARGV.formulae.count > 1
opoo message
else
puts message # if only one is being installed a warning looks severe
end
- next
+ true
end
+ end
+ exit 0 if formulae.empty?
+ else
+ formulae = ARGV.formulae
+ end
+
+ deps = []
+ formulae.each { |f| deps += expand_deps f }
+ formulae = deps.reject { |f| f.installed? }
+
+ require 'set'
+ done = Set.new
+
+ require 'beer_events'
+ watch_out_for_spill do
+ formulae.each do |f|
+ next if done.include? f.class
+ done << f.class
# 1. formulae can modify ENV, so we must ensure that each
# installation has a pristine ENV when it starts, forking now is
@@ -133,9 +158,6 @@ begin
when 'unlink'
ARGV.kegs.each {|keg| puts "#{keg.unlink} links removed for #{keg}"}
- when 'unlink'
- ARGV.kegs.each {|keg| puts "#{keg.unlink} links removed for #{keg}"}
-
when 'rm', 'uninstall', 'remove'
ARGV.kegs.each do |keg|
puts "Uninstalling #{keg}..."