aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2014-08-09 17:47:10 -0500
committerJack Nagel2014-08-09 17:50:52 -0500
commitf492d1c6959de7d32dc8665df9e7069b60d4e1c8 (patch)
treecb9cbc0317e1d02cf9d0f65c0e9a29153b0e4b01
parenta85f9c5dc5b0c95a897d0885395781900564f73a (diff)
downloadhomebrew-f492d1c6959de7d32dc8665df9e7069b60d4e1c8.tar.bz2
Extract build-time stdlib check to a method
-rw-r--r--Library/Homebrew/build.rb48
1 files changed, 25 insertions, 23 deletions
diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb
index ef7c2c45d..ff35b797a 100644
--- a/Library/Homebrew/build.rb
+++ b/Library/Homebrew/build.rb
@@ -163,29 +163,7 @@ class Build
begin
f.install
-
- keg = Keg.new(f.prefix)
- # This first test includes executables because we still
- # want to record the stdlib for something that installs no
- # dylibs.
- stdlibs = keg.detect_cxx_stdlibs
- # This currently only tracks a single C++ stdlib per dep,
- # though it's possible for different libs/executables in
- # a given formula to link to different ones.
- stdlib_in_use = CxxStdlib.create(stdlibs.first, ENV.compiler)
- begin
- stdlib_in_use.check_dependencies(f, deps)
- rescue IncompatibleCxxStdlibs => e
- opoo e.message
- end
-
- # This second check is recorded for checking dependencies,
- # so executable are irrelevant at this point. If a piece
- # of software installs an executable that links against libstdc++
- # and dylibs against libc++, libc++-only dependencies can safely
- # link against it.
- stdlibs = keg.detect_cxx_stdlibs :skip_executables => true
-
+ stdlibs = detect_stdlibs
Tab.create(f, ENV.compiler, stdlibs.first, f.build).write
rescue Exception => e
if ARGV.debug?
@@ -201,6 +179,30 @@ class Build
end
end
+ def detect_stdlibs
+ keg = Keg.new(f.prefix)
+ # This first test includes executables because we still
+ # want to record the stdlib for something that installs no
+ # dylibs.
+ stdlibs = keg.detect_cxx_stdlibs
+ # This currently only tracks a single C++ stdlib per dep,
+ # though it's possible for different libs/executables in
+ # a given formula to link to different ones.
+ stdlib_in_use = CxxStdlib.create(stdlibs.first, ENV.compiler)
+ begin
+ stdlib_in_use.check_dependencies(f, deps)
+ rescue IncompatibleCxxStdlibs => e
+ opoo e.message
+ end
+
+ # This second check is recorded for checking dependencies,
+ # so executable are irrelevant at this point. If a piece
+ # of software installs an executable that links against libstdc++
+ # and dylibs against libc++, libc++-only dependencies can safely
+ # link against it.
+ stdlibs = keg.detect_cxx_stdlibs :skip_executables => true
+ end
+
def fixopt f
path = if f.linked_keg.directory? and f.linked_keg.symlink?
f.linked_keg.resolved_path