Created /Library moved brew tool to /bin

Moved Forumla and Cellar/homebrew into Library.

This way the homebrew core files are more sensibly placed, Cellar is
more internally consistent and only generated. And Homebrew is ready for
use straight out of the tarball.
This commit is contained in:
Max Howell 2009-06-04 19:21:19 +01:00
parent 84ad47bc3c
commit cc50131728
26 changed files with 75 additions and 470 deletions

6
.gitignore vendored
View File

@ -1,6 +1,4 @@
.DS_Store
/*/
!/Cellar/
!/Formula/
/Cellar/*/
!/Cellar/homebrew/
!/Library/
!/bin/brew

View File

@ -1,10 +0,0 @@
require 'brewkit'
class Ack <UncompressedScriptFormula
def initialize
@version='1.88'
@url="http://ack.googlecode.com/svn/tags/#{@version}/ack"
@md5='8009a13ab0fc66047bea0ea2ad89419c'
@homepage='http://betterthangrep.com/'
end
end

View File

@ -1,12 +0,0 @@
require 'brewkit'
class Asciidoc <Formula
@url='http://www.methods.co.nz/asciidoc/asciidoc-8.4.4.tar.gz'
@md5='579bcd5762b177ee0ddccece8c34724b'
@homepage='http://www.methods.co.nz/asciidoc'
def install
system "./configure --disable-debug --prefix='#{prefix}'"
system "make install"
end
end

View File

@ -1,16 +0,0 @@
require 'brewkit'
class Boost <Formula
@homepage='http://www.boost.org'
@url='http://kent.dl.sourceforge.net/sourceforge/boost/boost_1_39_0.tar.bz2'
@md5='a17281fd88c48e0d866e1a12deecbcc0'
def install
#TODO we can save 6300 links if we just had the intelligence to symlink
#the include/boost dir and not more
# we specify libdir too because the script is apparently broken
system "./bootstrap.sh --prefix='#{prefix}' --libdir='#{lib}'"
system "./bjam --layout=system --prefix='#{prefix}' --libdir='#{lib}' install"
end
end

View File

@ -1,13 +0,0 @@
require 'brewkit'
class Cmake <Formula
@url='http://www.cmake.org/files/v2.6/cmake-2.6.3.tar.gz'
@md5='5ba47a94ce276f326abca1fd72a7e7c6'
def install
system "./bootstrap --prefix=#{prefix} --system-libs"
system "make install"
['man','doc'].each { |d| (prefix+d).mv prefix+'share' }
end
end

View File

@ -1,42 +0,0 @@
require 'brewkit'
class Dmd <Formula
@homepage='http://www.digitalmars.com/d/'
@url='http://ftp.digitalmars.com/dmd.1.043.zip'
@md5='6c83b7296cb84090a9ebc11ab0fb94a2'
def doc
#use d and not dmd, rationale: meh
prefix+'share'+'doc'+'d'
end
def install
ohai "install"
FileUtils.cp_r 'osx/bin', prefix
FileUtils.cp_r 'osx/lib', prefix
FileUtils.cp_r 'man/man1', man
FileUtils.cp_r 'src', prefix
#lol
man5=man+'man5'
man5.mkpath
(man+'man1'+'dmd.conf.5').mv man5
#lol ends
html=doc+'html'
samples=doc+'examples' #examples is the more typical directory name
html.mkpath
samples.mkpath
FileUtils.cp_r Dir['html/d/*'], html unless ARGV.include? '--no-html'
FileUtils.cp_r Dir['samples/d/*'], samples unless ARGV.include? '--no-samples'
# zip files suck TODO FileUtils.chmod
Dir.chdir(bin) { `chmod u+x dmd dumpobj obj2asm` }
(prefix+'bin'+'dmd.conf').open('w') do |f|
f.puts "[Environment]"
f.puts "DFLAGS=-I#{prefix}/src/phobos -L-L#{prefix}/lib"
end
end
end

View File

@ -1,21 +0,0 @@
require 'brewkit'
class Fftw <Formula
@homepage='http://www.fftw.org'
@url='http://www.fftw.org/fftw-3.2.1.tar.gz'
@md5='712d3f33625a0a76f5758648d4b925f7'
def install
configure=<<-EOS
./configure --enable-shared --disable-debug --prefix='#{prefix}'
--enable-threads --enable-single --enable-sse
--disable-dependency-tracking
--disable-fortran
EOS
system configure.gsub("\n", ' ').strip.squeeze(' ')
system "make install"
#wtf file?
(prefix+'share'+'info'+'dir').unlink
end
end

View File

@ -1,20 +0,0 @@
require 'brewkit'
class GitManuals <Formula
@url='http://kernel.org/pub/software/scm/git/git-manpages-1.6.3.1.tar.bz2'
@md5='971d573e8f261feb83290a59728c2b33'
end
class Git <Formula
@url='http://kernel.org/pub/software/scm/git/git-1.6.3.1.tar.bz2'
@md5='c1f4aab741359c29f0fbf28563ac7387'
@homepage='http://git-scm.com'
def install
system "./configure --prefix='#{prefix}' --disable-debug"
system "make install"
# the manuals come separately, well sort of, it's easier this way though
GitManuals.new.brew { FileUtils.mv Dir['*'], man }
end
end

View File

@ -1,70 +0,0 @@
require 'brewkit'
def profile_string
<<-sput
################################################################## >> Homebrew
GRC=`which grc`
if [ "$TERM" != dumb ] && [ -n GRC ]
then
alias colourify="$GRC -es --colour=auto"
alias configure='colourify ./configure'
alias diff='colourify diff'
alias make='colourify make'
alias gcc='colourify gcc'
alias g++='colourify g++'
alias as='colourify as'
alias gas='colourify gas'
alias ld='colourify ld'
alias netstat='colourify netstat'
alias ping='colourify ping'
alias traceroute='colourify /usr/sbin/traceroute'
fi
################################################################## << Homebrew
sput
end
######################################################################### ARGV
case ARGV[0]
when '--profile' then
puts profile_string
exit 0
end
######################################################################### cook
class Grc <Formula
@homepage='http://korpus.juls.savba.sk/~garabik/software/grc.html'
@url='http://korpus.juls.savba.sk/~garabik/software/grc/grc_1.1.tar.gz'
@md5='eeb612aba2fff14cbaf1f3bec7e1eb60'
def install
ohai "make"
#TODO we should deprefixify since it's python and thus possible
inreplace 'grc', '/etc', prefix+'etc'
inreplace 'grc.1', '/etc', prefix+'etc'
inreplace 'grcat', '/usr/local', prefix
inreplace 'grcat.1', '/usr/local', prefix
FileUtils.mkpath prefix
Dir.chdir prefix do
FileUtils.mkpath 'bin'
FileUtils.mkpath 'share/grc'
FileUtils.mkpath 'share/man/man1'
FileUtils.mkpath 'etc'
end
`cp -fv grc grcat #{prefix}/bin`
`cp -fv conf.* #{prefix}/share/grc`
`cp -fv grc.conf #{prefix}/etc`
`cp -fv grc.1 grcat.1 #{prefix}/share/man/man1`
end
def caveats
<<-EOS
grc won't work as is. One option is to add some aliases to your ~/.profile
file. Homebrew can do that for you, just execute this command:
ruby #{$0} --profile >> ~/.profile
EOS
end
end

View File

@ -1,12 +0,0 @@
require 'brewkit'
class Lame <Formula
@homepage='http://lame.sourceforge.net/'
@url='http://kent.dl.sourceforge.net/sourceforge/lame/lame-398-2.tar.gz'
@md5='719dae0ee675d0c16e0e89952930ed35'
def install
system "./configure --disable-debug --prefix='#{prefix}' --enable-nasm"
system "make install"
end
end

View File

@ -1,19 +0,0 @@
require 'brewkit'
class Liblastfm <Formula
@homepage='http://github.com/mxcl/liblastfm/'
@url='http://github.com/mxcl/liblastfm/tarball/0.3.0'
@md5='08e90275ccd06476426a5002d1dad762'
def deps
dep_test_bin 'qmake' or 'qt'
dep_test_lib 'fftw3f' or 'fftw'
dep_test_lib 'samplerate' or 'libsamplerate'
end
def install
system "./configure --release --prefix '#{prefix}'"
system "make"
system "make install"
end
end

View File

@ -1,12 +0,0 @@
require 'brewkit'
class Libogg <Formula
@homepage='http://www.xiph.org/ogg/'
@url='http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz'
@md5='eaf7dc6ebbff30975de7527a80831585'
def install
system "./configure --disable-debug --prefix='#{prefix}'"
system "make install"
end
end

View File

@ -1,12 +0,0 @@
require 'brewkit'
class Libsamplerate <Formula
@homepage='http://www.mega-nerd.com/SRC'
@url='http://www.mega-nerd.com/SRC/libsamplerate-0.1.7.tar.gz'
@md5='ad093e60ec44f0a60de8e29983ddbc0f'
def install
system "./configure --disable-debug --prefix='#{prefix}'"
system "make install"
end
end

View File

@ -1,12 +0,0 @@
require 'brewkit'
class Mad <Formula
@homepage='http://www.underbit.com/products/mad/'
@url='http://kent.dl.sourceforge.net/sourceforge/mad/libmad-0.15.1b.tar.gz'
@md5='1be543bc30c56fb6bea1d7bf6a64e66c'
def install
system "./configure --disable-debugging --enable-fpm=intel --prefix='#{prefix}'"
system "make install"
end
end

View File

@ -1,14 +0,0 @@
require 'brewkit'
class PkgConfig <Formula
@homepage='http://pkgconfig.freedesktop.org'
@url='http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz'
@md5='d922a88782b64441d06547632fd85744'
#TODO depend on our glib? --with-installed-glib
def install
system "./configure --with-pc-path=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:#{$root}/lib/pkgconfig --disable-debug --prefix='#{prefix}'"
system "make install"
end
end

View File

@ -1,12 +0,0 @@
require 'brewkit'
class Pngcrush <Formula
@homepage='http://pmt.sourceforge.net/pngcrush/'
@url='http://kent.dl.sourceforge.net/sourceforge/pmt/pngcrush-1.6.17.tar.bz2'
@md5='8ba31ae9b1b14e7648df320fd1ed27c7'
def install
system "make"
FileUtils.cp 'pngcrush', bin
end
end

View File

@ -1,43 +0,0 @@
require 'brewkit'
class Qt <Formula
@url='http://get.qtsoftware.com/qt/source/qt-mac-opensource-src-4.5.1.tar.gz'
@md5='9fc0e96197df6db48a0628ac4d63e0dd'
@homepage='http://www.qtsoftware.com'
def install
if version == '4.5.1'
# Reported 6 months ago (at 4.5.0-rc1), still not fixed in the this release! :(
makefiles=['plugins/sqldrivers/sqlite/sqlite.pro', '3rdparty/webkit/WebCore/WebCore.pro']
makefiles.each { |makefile| `echo 'LIBS += -lsqlite3' >> src/#{makefile}` }
end
configure=<<-EOS
./configure -prefix '#{prefix}'
-system-sqlite -system-libpng -system-zlib
-nomake demos -nomake examples -no-qt3support
-release -cocoa -arch x86
-confirm-license -opensource
-I /usr/X11R6/include -L /usr/X11R6/lib
-fast
EOS
system configure.gsub("\n", ' ').strip.squeeze(' ')
system "make install"
# fuck weird prl files
`find #{lib} -name \*.prl -delete`
# fuck crazy disk usage
`rm -r #{prefix+'doc'+'html'} #{prefix+'doc'+'src'}`
# wtf are these anyway?
`rm -r #{bin}/Assistant_adp.app #{bin}/pixeltool.app #{bin}/qhelpconverter.app`
# we specified no debug already! :P
`rm #{lib}/libQtUiTools_debug.a`
# meh
`rm #{prefix}/q3porting.xml`
end
def caveats
"We agreed to the Qt opensource license for you.\nIf this is unacceptable you should uninstall :P"
end
end

View File

@ -1,12 +0,0 @@
require 'brewkit'
class Taglib <Formula
@url='http://developer.kde.org/~wheeler/files/src/taglib-1.5.tar.gz'
@md5='7b557dde7425c6deb7bbedd65b4f2717'
@homepage='http://developer.kde.org/~wheeler/taglib.html'
def install
system "./configure --disable-debug --prefix='#{prefix}'"
system "make install"
end
end

View File

@ -1,10 +0,0 @@
require 'brewkit'
class Term <UncompressedScriptFormula
def initialize
@url='http://github.com/liyanage/macosx-shell-scripts/raw/e29f7eaa1eb13d78056dec85dc517626ab1d93e3/term'
@md5='1bbf4509a50224b27ac8c20d3fe8682e'
@version='2.1'
@homepage='http://gist.github.com/116587'
end
end

View File

@ -1,13 +0,0 @@
require 'brewkit'
class Wget <Formula
@homepage='http://www.gnu.org/software/wget/'
@url='http://ftp.gnu.org/gnu/wget/wget-1.11.4.tar.bz2'
@md5='f5076a8c2ec2b7f334cb6e3059820f9c'
def install
system "./configure --disable-debug --prefix='#{prefix}'"
system "make"
system "make install"
end
end

View File

@ -1,16 +0,0 @@
require 'brewkit'
class XmlrpcC <Formula
@url='http://kent.dl.sourceforge.net/sourceforge/xmlrpc-c/xmlrpc-c-1.06.33.tgz'
@md5='7dda4d8c5d26ae877d3809e428ce7962'
@homepage='http://xmlrpc-c.sourceforge.net/'
def install
ENV['MAKEFLAGS']='' #parallel build doesn't work
# choosing --enable-libxml2-backend to lose some weight and not statically
# link in expat
#NOTE seemingly it isn't possible to build dylibs with this thing
system "./configure --disable-debug --enable-libxml2-backend --prefix='#{prefix}'"
system "make install"
end
end

View File

@ -1,21 +0,0 @@
require 'brewkit'
class Yajl <Formula
@homepage='http://lloyd.github.com/yajl/'
@url='http://github.com/lloyd/yajl/tarball/1.0.5'
@md5='f4a3cbc764c43231ed1aedc54438b69b'
def deps
dep_test_bin 'cmake'
end
def install
ENV['MAKEFLAGS']='' # can't do parallel builds
# I have pushed this fix upstream
inreplace 'configure', 'cmake \.\.', "cmake -DCMAKE_INSTALL_PREFIX='#{prefix}' \.\." if @version == "1.0.5"
system "./configure --prefix '#{prefix}'"
system "make install"
end
end

View File

@ -1,7 +1,23 @@
# Copyright 2009 Max Howell <max@methylblue.com>
# Licensed as per the GPL version 3
# Copyright 2009 Max Howell <max@methylblue.com>
#
# This file is part of Homebrew.
#
# Homebrew is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Homebrew is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Homebrew. If not, see <http://www.gnu.org/licenses/>.
require 'pathname'
require 'osx/cocoa' # to get number of cores
require "#{File.dirname __FILE__}/env"
HOMEBREW_VERSION='0.1'
@ -181,36 +197,28 @@ public
FileUtils.rm_rf tmp if tmp
FileUtils.rm tgz if tgz and not self.cache?
end
ohai 'Finishing up'
begin
prefix
rescue RuntimeError
# you can have packages that aren't for installing, see git
# this is a HACK though, and dirty, and not right
return
end
prefix.find do |path|
if path==prefix #rubysucks
next
elsif path.file?
if path.extname == '.la'
path.unlink
else
fo=`file -h #{path}`
args=nil
args='-SxX' if fo =~ /Mach-O dynamically linked shared library/
args='' if fo =~ /Mach-O executable/ #defaults strip everything
if args
puts "Stripping: #{path}" if ARGV.include? '--verbose'
`strip #{args} #{path}`
end
end
end
def clean
prefix.find do |path|
if path==prefix #rubysucks
next
elsif path.file?
if path.extname == '.la'
path.unlink
else
fo=`file -h #{path}`
args=nil
args='-SxX' if fo =~ /Mach-O dynamically linked shared library/
args='' if fo =~ /Mach-O executable/ #defaults strip everything
if args
puts "Stripping: #{path}" if ARGV.include? '--verbose'
`strip #{args} #{path}`
end
elsif path.directory? and path!=prefix+'bin' and path!=prefix+'lib'
Find.prune
end
elsif path.directory? and path!=prefix+'bin' and path!=prefix+'lib'
Find.prune
end
end
end

22
Library/Homebrew/env.rb Normal file
View File

@ -0,0 +1,22 @@
# Copyright 2009 Max Howell <max@methylblue.com>
#
# This file is part of Homebrew.
#
# Homebrew is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Homebrew is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Homebrew. If not, see <http://www.gnu.org/licenses/>.
require 'pathname'
$root=Pathname.new(__FILE__).dirname.parent.parent.realpath
$formula=$root+'Library'+'Formula'
$cellar=$root+'Cellar'

View File

@ -1,11 +1,6 @@
#!/usr/bin/ruby
$:.unshift File.dirname(__FILE__)
require 'pathname'
$root=Pathname.new(__FILE__).realpath.dirname.parent.parent
$cellar=$root+'Cellar'
require 'brewkit'
require 'test/unit'
require "#{__FILE__}/../brewkit"
class TestFormula <Formula
def initialize url, md5

View File

@ -1,12 +1,9 @@
#!/usr/bin/ruby
# Copyright 2009 Max Howell <max@methylblue.com>
# Licensed as per the GPL version 3
require 'find'
require 'pathname'
$:.unshift "#{File.dirname __FILE__}/../Cellar/homebrew"
$root=Pathname.new(__FILE__).realpath.dirname.parent.parent
$formula=$root+'Formula'
$cellar=$root+'Cellar'
$:.unshift Pathname.new(__FILE__).dirname.parent.realpath+'Library'+'Homebrew'
require 'env'
def prune
n=0
@ -14,7 +11,7 @@ def prune
$root.find do |path|
if path.directory?
name=path.relative_path_from($root).to_s
if name == '.git' or name == 'Cellar' or name == 'Formula'
if name == '.git' or name == 'Cellar' or name == 'Library/Homebrew' or name == 'Library/Formula'
Find.prune
else
dirs<<path
@ -90,10 +87,10 @@ def ln name
raise '#{keg} is not a keg'
end
#TODO consider using hardlinks
# yeah indeed, you have to force anything you want in the main tree into
# these directories :P
# yeah indeed, you have to force anything you need in the main tree into
# these directories :P
# NOTE that not everything needs to be in the main tree
# TODO consider using hardlinks
$n=0
lnd(keg, 'etc') {nil}
lnd(keg, 'include') {nil}
@ -113,13 +110,8 @@ def ln name
end
lnd(keg, 'share') do |path|
path=path.to_s
if ['man','doc','locale','info'].include? path
:mkpath
else
mans=(1..9).collect {|x| "man/man#{x}"}
:mkpath if mans.include? path
end
includes=(1..9).collect {|x| "man/man#{x}"} <<'man'<<'doc'<<'locale'<<'info'
:mkpath if includes.include? path.to_s
end
return $n
@ -219,6 +211,8 @@ begin
o=__obj(name)
raise "#{o.prefix} already exists!" if o.prefix.exist?
o.brew { o.install }
ohai 'Finishing up'
o.clean
ln name
puts "#{o.prefix}: "+`find #{o.prefix} -type f | wc -l`.strip+
' files, '+