aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2012-02-24 12:50:21 -0800
committerAdam Vandenberg2012-02-24 21:35:51 -0800
commit8bf54c485cc793c4bb423dd4f5d02dcc7b67fd7a (patch)
treeb16bfe7af4d56758b68a1b603818cc0ea0791f66 /Library
parent531a5765099c95f56c0455e0a4686b8952569105 (diff)
downloadhomebrew-8bf54c485cc793c4bb423dd4f5d02dcc7b67fd7a.tar.bz2
Add `buildpath` to Formula
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/ace.rb16
-rw-r--r--Library/Formula/clozure-cl.rb2
-rw-r--r--Library/Formula/gnu-smalltalk.rb5
-rw-r--r--Library/Formula/graphviz.rb3
-rw-r--r--Library/Formula/llvm.rb3
-rw-r--r--Library/Formula/monotone.rb2
-rw-r--r--Library/Formula/netpbm.rb7
-rw-r--r--Library/Formula/sbcl.rb4
-rw-r--r--Library/Homebrew/formula.rb7
9 files changed, 26 insertions, 23 deletions
diff --git a/Library/Formula/ace.rb b/Library/Formula/ace.rb
index da1f38d23..9b1bbc0c5 100644
--- a/Library/Formula/ace.rb
+++ b/Library/Formula/ace.rb
@@ -27,15 +27,19 @@ class Ace < Formula
ln_sf makefile, "include/makeinclude/platform_macros.GNU"
# Set up the environment the way ACE expects during build.
- root=Dir.pwd
- ENV['ACE_ROOT']=root
- ENV['DYLD_LIBRARY_PATH']="#{root}/ace:#{root}/lib"
+ ENV['ACE_ROOT'] = buildpath
+ ENV['DYLD_LIBRARY_PATH'] = "#{buildpath}/ace:#{buildpath}/lib"
# Done! We go ahead and build.
cd "ace" do
- system "make", "-f", "GNUmakefile.ACE", "INSTALL_PREFIX=#{prefix}",
- "LDFLAGS=", "DESTDIR=", "INST_DIR=/ace",
- "debug=0", "shared_libs=1", "static_libs=0", "install"
+ system "make", "-f", "GNUmakefile.ACE",
+ "INSTALL_PREFIX=#{prefix}",
+ "LDFLAGS=",
+ "DESTDIR=",
+ "INST_DIR=/ace",
+ "debug=0",
+ "shared_libs=1", "static_libs=0",
+ "install"
end
end
end
diff --git a/Library/Formula/clozure-cl.rb b/Library/Formula/clozure-cl.rb
index 0464e0b5f..4b285e3a5 100644
--- a/Library/Formula/clozure-cl.rb
+++ b/Library/Formula/clozure-cl.rb
@@ -10,7 +10,7 @@ class ClozureCl < Formula
def install
# Get rid of all the .svn dirs, that for some reason are
# included in the tarball
- Find.find(Dir.pwd) do |path|
+ Find.find(buildpath) do |path|
if File.directory?(path) && File.basename(path) == '.svn'
rm_rf path
Find.prune
diff --git a/Library/Formula/gnu-smalltalk.rb b/Library/Formula/gnu-smalltalk.rb
index 039a43eae..ed3d25be9 100644
--- a/Library/Formula/gnu-smalltalk.rb
+++ b/Library/Formula/gnu-smalltalk.rb
@@ -41,9 +41,8 @@ class GnuSmalltalk < Formula
# GNU Smalltalk thinks it needs GNU awk, but it works fine
# with OS X awk, so let's trick configure.
- here = Dir.pwd
- system "ln -s /usr/bin/awk #{here}/gawk"
- ENV['AWK'] = "#{here}/gawk"
+ system "ln -s /usr/bin/awk #{buildpath}/gawk"
+ ENV['AWK'] = "#{buildpath}/gawk"
ENV['FFI_CFLAGS'] = '-I/usr/include/ffi'
system "./configure", "--disable-debug", "--disable-dependency-tracking",
diff --git a/Library/Formula/graphviz.rb b/Library/Formula/graphviz.rb
index 58c42ffb8..ced286086 100644
--- a/Library/Formula/graphviz.rb
+++ b/Library/Formula/graphviz.rb
@@ -46,8 +46,7 @@ class Graphviz < Formula
def test
mktemp do
- p = Pathname.new Dir.pwd
- (p+'sample.dot').write <<-EOS.undent
+ (Pathname.pwd+'sample.dot').write <<-EOS.undent
digraph G {
a -> b
}
diff --git a/Library/Formula/llvm.rb b/Library/Formula/llvm.rb
index 8be6964b9..76caa7d36 100644
--- a/Library/Formula/llvm.rb
+++ b/Library/Formula/llvm.rb
@@ -45,8 +45,7 @@ class Llvm < Formula
end
if build_clang? or build_analyzer?
- clang_dir = Pathname.new(Dir.pwd)+'tools/clang'
- Clang.new("clang").brew { clang_dir.install Dir['*'] }
+ Clang.new("clang").brew { (buildpath+'tools/clang').install Dir['*'] }
end
if build_universal?
diff --git a/Library/Formula/monotone.rb b/Library/Formula/monotone.rb
index af61ef935..6f39bc2ae 100644
--- a/Library/Formula/monotone.rb
+++ b/Library/Formula/monotone.rb
@@ -39,7 +39,7 @@ class Monotone < Formula
boost = Formula.factory('boost')
unless boost.installed?
# Add header location to CPPFLAGS
- boost.brew { ENV.append "CPPFLAGS", "-I"+Dir.pwd }
+ boost.brew { ENV.append "CPPFLAGS", "-I#{buildpath}" }
end
system "./configure", "--disable-dependency-tracking",
diff --git a/Library/Formula/netpbm.rb b/Library/Formula/netpbm.rb
index b93651f60..dcaa711b8 100644
--- a/Library/Formula/netpbm.rb
+++ b/Library/Formula/netpbm.rb
@@ -37,11 +37,8 @@ class Netpbm < Formula
ENV.deparallelize
system "make"
-
- stage_dir = Pathname(Dir.pwd) + 'stage'
- system "make", "package", "pkgdir=#{stage_dir}"
-
- cd stage_dir do
+ system "make", "package", "pkgdir=#{buildpath}/stage"
+ cd 'stage' do
prefix.install %w{ bin include lib misc }
# do man pages explicitly; otherwise a junk file is installed in man/web
man1.install Dir['man/man1/*.1']
diff --git a/Library/Formula/sbcl.rb b/Library/Formula/sbcl.rb
index bd6fd69f9..3fdced2cc 100644
--- a/Library/Formula/sbcl.rb
+++ b/Library/Formula/sbcl.rb
@@ -64,15 +64,13 @@ class Sbcl < Formula
value =~ /[\x80-\xff]/
end
- build_directory = pwd
-
SbclBootstrapBinaries.new.brew {
# We only need the binaries for bootstrapping, so don't install anything:
command = Dir.pwd + "/src/runtime/sbcl"
core = Dir.pwd + "/output/sbcl.core"
xc_cmdline = "#{command} --core #{core} --disable-debugger --no-userinit --no-sysinit"
- cd build_directory do
+ cd buildpath do
if ARGV.build_32_bit?
system "SBCL_ARCH=x86 ./make.sh --prefix='#{prefix}' --xc-host='#{xc_cmdline}'"
else
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 30c8d953b..7335afd24 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -11,6 +11,10 @@ class Formula
attr_reader :standard, :unstable
attr_reader :bottle_url, :bottle_sha1, :head
+ # The build folder, usually in /tmp.
+ # Will only be non-nil during the stage method.
+ attr_reader :buildpath
+
# Homebrew determines the name
def initialize name='__UNKNOWN__', path=nil
set_instance_variable 'homepage'
@@ -573,7 +577,10 @@ EOF
verify_download_integrity fetched if fetched.kind_of? Pathname
mktemp do
downloader.stage
+ # Set path after the downloader changes the working folder.
+ @buildpath = Pathname.pwd
yield
+ @buildpath = nil
end
end