Merge pull request #4185 from sjackman/superenv-linux
Add superenv for Linux
This commit is contained in:
commit
054866653d
@ -68,6 +68,7 @@ class Build
|
|||||||
def install
|
def install
|
||||||
formula_deps = deps.map(&:to_formula)
|
formula_deps = deps.map(&:to_formula)
|
||||||
keg_only_deps = formula_deps.select(&:keg_only?)
|
keg_only_deps = formula_deps.select(&:keg_only?)
|
||||||
|
run_time_deps = deps.reject(&:build?).map(&:to_formula)
|
||||||
|
|
||||||
formula_deps.each do |dep|
|
formula_deps.each do |dep|
|
||||||
fixopt(dep) unless dep.opt_prefix.directory?
|
fixopt(dep) unless dep.opt_prefix.directory?
|
||||||
@ -78,6 +79,7 @@ class Build
|
|||||||
if superenv?
|
if superenv?
|
||||||
ENV.keg_only_deps = keg_only_deps
|
ENV.keg_only_deps = keg_only_deps
|
||||||
ENV.deps = formula_deps
|
ENV.deps = formula_deps
|
||||||
|
ENV.run_time_deps = run_time_deps
|
||||||
ENV.x11 = reqs.any? { |rq| rq.is_a?(X11Requirement) }
|
ENV.x11 = reqs.any? { |rq| rq.is_a?(X11Requirement) }
|
||||||
ENV.setup_build_environment(formula)
|
ENV.setup_build_environment(formula)
|
||||||
post_superenv_hacks
|
post_superenv_hacks
|
||||||
|
|||||||
@ -15,12 +15,13 @@ module Superenv
|
|||||||
include SharedEnvExtension
|
include SharedEnvExtension
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
attr_accessor :keg_only_deps, :deps
|
attr_accessor :keg_only_deps, :deps, :run_time_deps
|
||||||
attr_accessor :x11
|
attr_accessor :x11
|
||||||
|
|
||||||
def self.extended(base)
|
def self.extended(base)
|
||||||
base.keg_only_deps = []
|
base.keg_only_deps = []
|
||||||
base.deps = []
|
base.deps = []
|
||||||
|
base.run_time_deps = []
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
@ -178,16 +179,6 @@ module Superenv
|
|||||||
keg_only_deps.map(&:opt_lib),
|
keg_only_deps.map(&:opt_lib),
|
||||||
HOMEBREW_PREFIX/"lib",
|
HOMEBREW_PREFIX/"lib",
|
||||||
]
|
]
|
||||||
|
|
||||||
if compiler == :llvm_clang
|
|
||||||
if MacOS::CLT.installed?
|
|
||||||
paths << "/usr/lib"
|
|
||||||
else
|
|
||||||
paths << "#{MacOS.sdk_path}/usr/lib"
|
|
||||||
end
|
|
||||||
paths << Formula["llvm"].opt_lib.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
paths += homebrew_extra_library_paths
|
paths += homebrew_extra_library_paths
|
||||||
PATH.new(paths).existing
|
PATH.new(paths).existing
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1 +1,5 @@
|
|||||||
require "extend/os/mac/extend/ENV/super" if OS.mac?
|
if OS.mac?
|
||||||
|
require "extend/os/mac/extend/ENV/super"
|
||||||
|
elsif OS.linux?
|
||||||
|
require "extend/os/linux/extend/ENV/super"
|
||||||
|
end
|
||||||
|
|||||||
40
Library/Homebrew/extend/os/linux/extend/ENV/super.rb
Normal file
40
Library/Homebrew/extend/os/linux/extend/ENV/super.rb
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
module Superenv
|
||||||
|
# @private
|
||||||
|
def self.bin
|
||||||
|
(HOMEBREW_SHIMS_PATH/"linux/super").realpath
|
||||||
|
end
|
||||||
|
|
||||||
|
# @private
|
||||||
|
def setup_build_environment(formula = nil)
|
||||||
|
generic_setup_build_environment(formula)
|
||||||
|
self["HOMEBREW_DYNAMIC_LINKER"] = determine_dynamic_linker_path
|
||||||
|
self["HOMEBREW_RPATH_PATHS"] = determine_rpath_paths(formula)
|
||||||
|
end
|
||||||
|
|
||||||
|
def homebrew_extra_paths
|
||||||
|
paths = []
|
||||||
|
paths += %w[binutils make].map do |f|
|
||||||
|
begin
|
||||||
|
bin = Formula[f].opt_bin
|
||||||
|
bin if bin.directory?
|
||||||
|
rescue FormulaUnavailableError
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end.compact
|
||||||
|
paths
|
||||||
|
end
|
||||||
|
|
||||||
|
def determine_rpath_paths(formula)
|
||||||
|
PATH.new(
|
||||||
|
formula&.lib,
|
||||||
|
"#{HOMEBREW_PREFIX}/lib",
|
||||||
|
PATH.new(run_time_deps.map { |dep| dep.opt_lib.to_s }).existing,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def determine_dynamic_linker_path
|
||||||
|
path = "#{HOMEBREW_PREFIX}/lib/ld.so"
|
||||||
|
return unless File.readable? path
|
||||||
|
path
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -58,6 +58,14 @@ module Superenv
|
|||||||
|
|
||||||
def homebrew_extra_library_paths
|
def homebrew_extra_library_paths
|
||||||
paths = []
|
paths = []
|
||||||
|
if compiler == :llvm_clang
|
||||||
|
if MacOS::CLT.installed?
|
||||||
|
paths << "/usr/lib"
|
||||||
|
else
|
||||||
|
paths << "#{MacOS.sdk_path}/usr/lib"
|
||||||
|
end
|
||||||
|
paths << Formula["llvm"].opt_lib.to_s
|
||||||
|
end
|
||||||
paths << MacOS::X11.lib.to_s if x11?
|
paths << MacOS::X11.lib.to_s if x11?
|
||||||
paths << "#{effective_sysroot}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries"
|
paths << "#{effective_sysroot}/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries"
|
||||||
paths
|
paths
|
||||||
|
|||||||
1
Library/Homebrew/shims/linux/super/c++
Symbolic link
1
Library/Homebrew/shims/linux/super/c++
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/c89
Symbolic link
1
Library/Homebrew/shims/linux/super/c89
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/c99
Symbolic link
1
Library/Homebrew/shims/linux/super/c99
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/cc
Symbolic link
1
Library/Homebrew/shims/linux/super/cc
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../super/cc
|
||||||
1
Library/Homebrew/shims/linux/super/clang
Symbolic link
1
Library/Homebrew/shims/linux/super/clang
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/clang++
Symbolic link
1
Library/Homebrew/shims/linux/super/clang++
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/cpp
Symbolic link
1
Library/Homebrew/shims/linux/super/cpp
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/g++
Symbolic link
1
Library/Homebrew/shims/linux/super/g++
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/g++-4.2
Symbolic link
1
Library/Homebrew/shims/linux/super/g++-4.2
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/g++-4.3
Symbolic link
1
Library/Homebrew/shims/linux/super/g++-4.3
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/g++-4.4
Symbolic link
1
Library/Homebrew/shims/linux/super/g++-4.4
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/g++-4.5
Symbolic link
1
Library/Homebrew/shims/linux/super/g++-4.5
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/g++-4.6
Symbolic link
1
Library/Homebrew/shims/linux/super/g++-4.6
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/g++-4.7
Symbolic link
1
Library/Homebrew/shims/linux/super/g++-4.7
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/g++-4.8
Symbolic link
1
Library/Homebrew/shims/linux/super/g++-4.8
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/g++-4.9
Symbolic link
1
Library/Homebrew/shims/linux/super/g++-4.9
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/g++-5
Symbolic link
1
Library/Homebrew/shims/linux/super/g++-5
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/g++-6
Symbolic link
1
Library/Homebrew/shims/linux/super/g++-6
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/g++-7
Symbolic link
1
Library/Homebrew/shims/linux/super/g++-7
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/g++-8
Symbolic link
1
Library/Homebrew/shims/linux/super/g++-8
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/gcc
Symbolic link
1
Library/Homebrew/shims/linux/super/gcc
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/gcc-4.2
Symbolic link
1
Library/Homebrew/shims/linux/super/gcc-4.2
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/gcc-4.3
Symbolic link
1
Library/Homebrew/shims/linux/super/gcc-4.3
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/gcc-4.4
Symbolic link
1
Library/Homebrew/shims/linux/super/gcc-4.4
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/gcc-4.5
Symbolic link
1
Library/Homebrew/shims/linux/super/gcc-4.5
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/gcc-4.6
Symbolic link
1
Library/Homebrew/shims/linux/super/gcc-4.6
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/gcc-4.7
Symbolic link
1
Library/Homebrew/shims/linux/super/gcc-4.7
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/gcc-4.8
Symbolic link
1
Library/Homebrew/shims/linux/super/gcc-4.8
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/gcc-4.9
Symbolic link
1
Library/Homebrew/shims/linux/super/gcc-4.9
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/gcc-5
Symbolic link
1
Library/Homebrew/shims/linux/super/gcc-5
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/gcc-6
Symbolic link
1
Library/Homebrew/shims/linux/super/gcc-6
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/gcc-7
Symbolic link
1
Library/Homebrew/shims/linux/super/gcc-7
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/gcc-8
Symbolic link
1
Library/Homebrew/shims/linux/super/gcc-8
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/git
Symbolic link
1
Library/Homebrew/shims/linux/super/git
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../scm/git
|
||||||
1
Library/Homebrew/shims/linux/super/gold
Symbolic link
1
Library/Homebrew/shims/linux/super/gold
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/ld
Symbolic link
1
Library/Homebrew/shims/linux/super/ld
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/ld.gold
Symbolic link
1
Library/Homebrew/shims/linux/super/ld.gold
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/llvm-g++
Symbolic link
1
Library/Homebrew/shims/linux/super/llvm-g++
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/llvm-g++-4.2
Symbolic link
1
Library/Homebrew/shims/linux/super/llvm-g++-4.2
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/llvm-gcc
Symbolic link
1
Library/Homebrew/shims/linux/super/llvm-gcc
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/llvm-gcc-4.2
Symbolic link
1
Library/Homebrew/shims/linux/super/llvm-gcc-4.2
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/llvm_clang
Symbolic link
1
Library/Homebrew/shims/linux/super/llvm_clang
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/llvm_clang++
Symbolic link
1
Library/Homebrew/shims/linux/super/llvm_clang++
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
1
Library/Homebrew/shims/linux/super/svn
Symbolic link
1
Library/Homebrew/shims/linux/super/svn
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../scm/svn
|
||||||
1
Library/Homebrew/shims/linux/super/x86_64-linux-gnu-gcc
Symbolic link
1
Library/Homebrew/shims/linux/super/x86_64-linux-gnu-gcc
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
cc
|
||||||
@ -13,6 +13,14 @@ exec "$HOMEBREW_RUBY_PATH" -x "$0" "$@"
|
|||||||
require "pathname"
|
require "pathname"
|
||||||
require "set"
|
require "set"
|
||||||
|
|
||||||
|
def mac?
|
||||||
|
RUBY_PLATFORM[/darwin/]
|
||||||
|
end
|
||||||
|
|
||||||
|
def linux?
|
||||||
|
RUBY_PLATFORM[/linux/]
|
||||||
|
end
|
||||||
|
|
||||||
class Cmd
|
class Cmd
|
||||||
attr_reader :config, :prefix, :cellar, :opt, :tmpdir, :sysroot, :deps
|
attr_reader :config, :prefix, :cellar, :opt, :tmpdir, :sysroot, :deps
|
||||||
attr_reader :archflags, :optflags, :keg_regex, :formula_prefix
|
attr_reader :archflags, :optflags, :keg_regex, :formula_prefix
|
||||||
@ -35,8 +43,10 @@ class Cmd
|
|||||||
end
|
end
|
||||||
|
|
||||||
def mode
|
def mode
|
||||||
if @arg0 == "cpp" || @arg0 == "ld"
|
if @arg0 == "cpp"
|
||||||
@arg0.to_sym
|
:cpp
|
||||||
|
elsif ["ld", "ld.gold", "gold"].include? @arg0
|
||||||
|
:ld
|
||||||
elsif @args.include? "-c"
|
elsif @args.include? "-c"
|
||||||
if @arg0 =~ /(?:c|g|clang)\+\+/
|
if @arg0 =~ /(?:c|g|clang)\+\+/
|
||||||
:cxx
|
:cxx
|
||||||
@ -59,6 +69,7 @@ class Cmd
|
|||||||
def tool
|
def tool
|
||||||
@tool ||= case @arg0
|
@tool ||= case @arg0
|
||||||
when "ld" then "ld"
|
when "ld" then "ld"
|
||||||
|
when "gold", "ld.gold" then "ld.gold"
|
||||||
when "cpp" then "cpp"
|
when "cpp" then "cpp"
|
||||||
when /llvm_(clang(\+\+)?)/
|
when /llvm_(clang(\+\+)?)/
|
||||||
"#{ENV["HOMEBREW_PREFIX"]}/opt/llvm/bin/#{$1}"
|
"#{ENV["HOMEBREW_PREFIX"]}/opt/llvm/bin/#{$1}"
|
||||||
@ -190,9 +201,13 @@ class Cmd
|
|||||||
when "-undefineddynamic_lookup"
|
when "-undefineddynamic_lookup"
|
||||||
args << "-Wl,-undefined,dynamic_lookup"
|
args << "-Wl,-undefined,dynamic_lookup"
|
||||||
when /^-isysroot/, /^--sysroot/
|
when /^-isysroot/, /^--sysroot/
|
||||||
sdk = enum.next
|
if mac?
|
||||||
# We set the sysroot for macOS SDKs
|
sdk = enum.next
|
||||||
args << "-isysroot" << sdk unless sdk.downcase.include? "osx"
|
# We set the sysroot for macOS SDKs
|
||||||
|
args << "-isysroot" << sdk unless sdk.downcase.include? "osx"
|
||||||
|
else
|
||||||
|
args << arg << enum.next
|
||||||
|
end
|
||||||
when "-dylib"
|
when "-dylib"
|
||||||
args << "-Wl,#{arg}"
|
args << "-Wl,#{arg}"
|
||||||
when /^-I(.+)?/
|
when /^-I(.+)?/
|
||||||
@ -220,11 +235,15 @@ class Cmd
|
|||||||
elsif path.start_with?(cellar) || path.start_with?(opt)
|
elsif path.start_with?(cellar) || path.start_with?(opt)
|
||||||
dep = path[keg_regex, 2]
|
dep = path[keg_regex, 2]
|
||||||
dep && @deps.include?(dep)
|
dep && @deps.include?(dep)
|
||||||
elsif path.start_with?(prefix)
|
elsif path.start_with?(prefix, tmpdir)
|
||||||
|
true
|
||||||
|
elsif path.start_with?("/opt/local", "/opt/boxen/homebrew", "/opt/X11", "/sw", "/usr/X11")
|
||||||
|
# ignore MacPorts, Boxen's Homebrew, X11, fink
|
||||||
|
false
|
||||||
|
elsif mac?
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
# ignore MacPorts, Boxen's Homebrew, X11, fink
|
false
|
||||||
!path.start_with?("/opt/local", "/opt/boxen/homebrew", "/opt/X11", "/sw", "/usr/X11")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -254,8 +273,7 @@ class Cmd
|
|||||||
path_flags("-isystem", isystem_paths) + path_flags("-I", include_paths)
|
path_flags("-isystem", isystem_paths) + path_flags("-I", include_paths)
|
||||||
end
|
end
|
||||||
|
|
||||||
def ldflags
|
def ldflags_mac(args)
|
||||||
args = path_flags("-L", library_paths)
|
|
||||||
case mode
|
case mode
|
||||||
when :ld
|
when :ld
|
||||||
args << "-headerpad_max_install_names"
|
args << "-headerpad_max_install_names"
|
||||||
@ -267,6 +285,27 @@ class Cmd
|
|||||||
args
|
args
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ldflags_linux(args)
|
||||||
|
unless mode == :ld
|
||||||
|
wl = "-Wl,"
|
||||||
|
args << "-B#{@opt}/glibc/lib"
|
||||||
|
end
|
||||||
|
args += rpath_flags("#{wl}-rpath=", rpath_paths)
|
||||||
|
args += ["#{wl}--dynamic-linker=#{dynamic_linker_path}"] if dynamic_linker_path
|
||||||
|
args
|
||||||
|
end
|
||||||
|
|
||||||
|
def ldflags
|
||||||
|
args = path_flags("-L", library_paths)
|
||||||
|
if mac?
|
||||||
|
ldflags_mac(args)
|
||||||
|
elsif linux?
|
||||||
|
ldflags_linux(args)
|
||||||
|
else
|
||||||
|
args
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def isystem_paths
|
def isystem_paths
|
||||||
path_split("HOMEBREW_ISYSTEM_PATHS")
|
path_split("HOMEBREW_ISYSTEM_PATHS")
|
||||||
end
|
end
|
||||||
@ -279,6 +318,14 @@ class Cmd
|
|||||||
path_split("HOMEBREW_LIBRARY_PATHS")
|
path_split("HOMEBREW_LIBRARY_PATHS")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def rpath_paths
|
||||||
|
path_split("HOMEBREW_RPATH_PATHS")
|
||||||
|
end
|
||||||
|
|
||||||
|
def dynamic_linker_path
|
||||||
|
chuzzle(ENV["HOMEBREW_DYNAMIC_LINKER"])
|
||||||
|
end
|
||||||
|
|
||||||
def system_library_paths
|
def system_library_paths
|
||||||
paths = ["#{sysroot}/usr/lib"]
|
paths = ["#{sysroot}/usr/lib"]
|
||||||
paths << "/usr/local/lib" unless sysroot || ENV["SDKROOT"]
|
paths << "/usr/local/lib" unless sysroot || ENV["SDKROOT"]
|
||||||
@ -325,6 +372,12 @@ class Cmd
|
|||||||
paths.map! { |path| prefix + path }
|
paths.map! { |path| prefix + path }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Unlike path_flags, do not prune non-existant directories.
|
||||||
|
# formula.lib for example does not yet exist, but should not be pruned.
|
||||||
|
def rpath_flags(prefix, paths)
|
||||||
|
paths.uniq.map { |path| prefix + path }
|
||||||
|
end
|
||||||
|
|
||||||
def path_split(key)
|
def path_split(key)
|
||||||
ENV.fetch(key) { "" }.split(File::PATH_SEPARATOR)
|
ENV.fetch(key) { "" }.split(File::PATH_SEPARATOR)
|
||||||
end
|
end
|
||||||
@ -350,6 +403,14 @@ def log(basename, argv, tool, args)
|
|||||||
File.open("#{ENV["HOMEBREW_CC_LOG_PATH"]}.cc", "a+") { |f| f.write(s) }
|
File.open("#{ENV["HOMEBREW_CC_LOG_PATH"]}.cc", "a+") { |f| f.write(s) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def remove_superbin_from_path(paths)
|
||||||
|
superbin = Pathname.new(__FILE__).dirname.realpath
|
||||||
|
paths.reject do |x|
|
||||||
|
path = Pathname.new(x)
|
||||||
|
path.directory? && path.realpath == superbin
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if __FILE__ == $PROGRAM_NAME
|
if __FILE__ == $PROGRAM_NAME
|
||||||
##################################################################### sanity
|
##################################################################### sanity
|
||||||
|
|
||||||
@ -369,5 +430,13 @@ if __FILE__ == $PROGRAM_NAME
|
|||||||
log(basename, ARGV, tool, args)
|
log(basename, ARGV, tool, args)
|
||||||
|
|
||||||
args << { :close_others => false }
|
args << { :close_others => false }
|
||||||
exec "#{dirname}/xcrun", tool, *args
|
if mac?
|
||||||
|
exec "#{dirname}/xcrun", tool, *args
|
||||||
|
else
|
||||||
|
paths = ENV["PATH"].split(":")
|
||||||
|
paths = remove_superbin_from_path(paths)
|
||||||
|
paths.unshift "#{ENV["HOMEBREW_PREFIX"]}/bin"
|
||||||
|
ENV["PATH"] = paths.join(":")
|
||||||
|
exec tool, *args
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -177,7 +177,7 @@ describe "brew install", :integration_test do
|
|||||||
it "succeeds when a non-fatal requirement isn't satisfied" do
|
it "succeeds when a non-fatal requirement isn't satisfied" do
|
||||||
setup_test_formula "testball1", <<~EOS
|
setup_test_formula "testball1", <<~EOS
|
||||||
class NonFatalRequirement < Requirement
|
class NonFatalRequirement < Requirement
|
||||||
satisfy { false }
|
satisfy(build_env: false) { false }
|
||||||
end
|
end
|
||||||
|
|
||||||
depends_on NonFatalRequirement
|
depends_on NonFatalRequirement
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user