Browse files

Add `buildpath` to Formula

  • Loading branch information...
1 parent 531a576 commit 8bf54c485cc793c4bb423dd4f5d02dcc7b67fd7a @adamv adamv committed Feb 24, 2012
View
16 Library/Formula/ace.rb
@@ -27,15 +27,19 @@ def install
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
View
2 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
View
5 Library/Formula/gnu-smalltalk.rb
@@ -41,9 +41,8 @@ def install
# 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",
View
3 Library/Formula/graphviz.rb
@@ -46,8 +46,7 @@ def install
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
}
View
3 Library/Formula/llvm.rb
@@ -45,8 +45,7 @@ def install
end
if build_clang? or build_analyzer?
- clang_dir = Pathname.new(Dir.pwd)+'tools/clang'
@jvoorhis
jvoorhis added a line comment Feb 28, 2012

Removing this line breaks the formula when passing both --with-clang and --analyzer. clang_dir is used for building analyzer components later in #install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
- Clang.new("clang").brew { clang_dir.install Dir['*'] }
+ Clang.new("clang").brew { (buildpath+'tools/clang').install Dir['*'] }
end
if build_universal?
View
2 Library/Formula/monotone.rb
@@ -39,7 +39,7 @@ def install
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",
View
7 Library/Formula/netpbm.rb
@@ -37,11 +37,8 @@ def install
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']
View
4 Library/Formula/sbcl.rb
@@ -64,15 +64,13 @@ def install
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
View
7 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 @@ def stage
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

0 comments on commit 8bf54c4

Please sign in to comment.