Extract build-time stdlib check to a method

This commit is contained in:
Jack Nagel 2014-08-09 17:47:10 -05:00
parent f743351c60
commit 105db77fc0

View File

@ -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