aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAndrew Janke2016-04-10 17:49:28 -0400
committerAndrew Janke2016-04-13 02:20:17 -0400
commita8ed06ba741b627f48d2a9ec76f2aa62aec2c160 (patch)
tree95f47be6a5b969f759ee0a99c252018a8c353c76 /Library
parent4e8c6e633c3c746299169a9792ec3297099575af (diff)
downloadbrew-a8ed06ba741b627f48d2a9ec76f2aa62aec2c160.tar.bz2
superenv: allow paths under self's keg
Fixes build error in Homebrew/homebrew-core#100. Closes #63. Signed-off-by: Andrew Janke <andrew@apjanke.net>
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/ENV/4.3/cc14
-rw-r--r--Library/Homebrew/extend/ENV/super.rb4
2 files changed, 16 insertions, 2 deletions
diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc
index 05d48fc60..6b3efd259 100755
--- a/Library/ENV/4.3/cc
+++ b/Library/ENV/4.3/cc
@@ -15,7 +15,7 @@ require "set"
class Cmd
attr_reader :config, :prefix, :cellar, :opt, :tmpdir, :sysroot, :deps
- attr_reader :archflags, :optflags, :keg_regex
+ attr_reader :archflags, :optflags, :keg_regex, :formula, :formula_version
def initialize(arg0, args)
@arg0 = arg0
@@ -29,6 +29,8 @@ class Cmd
@archflags = ENV.fetch("HOMEBREW_ARCHFLAGS") { "" }.split(" ")
@optflags = ENV.fetch("HOMEBREW_OPTFLAGS") { "" }.split(" ")
@deps = Set.new(ENV.fetch("HOMEBREW_DEPENDENCIES") { "" }.split(","))
+ @formula = ENV["HOMEBREW_FORMULA"]
+ @formula_version = ENV["HOMEBREW_FORMULA_VERSION"]
# matches opt or cellar prefix and formula name
@keg_regex = %r[(#{Regexp.escape(opt)}|#{Regexp.escape(cellar)})/([\w\-_\+]+)]
end
@@ -205,9 +207,12 @@ class Cmd
# but is currently opt-in.
return keep_orig?(path) unless ENV["HOMEBREW_EXPERIMENTAL_FILTER_FLAGS_ON_DEPS"]
+ # Allow references to self
+ if keg_path && path.start_with?(keg_path)
+ true
# first two paths: reject references to Cellar or opt paths
# for unspecified dependencies
- if path.start_with?(cellar) || path.start_with?(opt)
+ elsif path.start_with?(cellar) || path.start_with?(opt)
dep = path[keg_regex, 2]
dep && @deps.include?(dep)
elsif path.start_with?(prefix)
@@ -276,6 +281,11 @@ class Cmd
%W[#{sysroot}/usr/lib /usr/local/lib]
end
+ def keg_path
+ return nil if formula.nil?
+ "#{cellar}/#{formula}/#{formula_version}"
+ end
+
def configure?
# configure scripts generated with autoconf 2.61 or later export as_nl
ENV.key? "as_nl"
diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb
index ca244849f..8566c7d0d 100644
--- a/Library/Homebrew/extend/ENV/super.rb
+++ b/Library/Homebrew/extend/ENV/super.rb
@@ -68,6 +68,10 @@ module Superenv
self["HOMEBREW_INCLUDE_PATHS"] = determine_include_paths
self["HOMEBREW_LIBRARY_PATHS"] = determine_library_paths
self["HOMEBREW_DEPENDENCIES"] = determine_dependencies
+ unless formula.nil?
+ self["HOMEBREW_FORMULA"] = formula.name
+ self["HOMEBREW_FORMULA_VERSION"] = formula.version
+ end
if MacOS::Xcode.without_clt? || (MacOS::Xcode.installed? && MacOS::Xcode.version.to_i >= 7)
self["MACOSX_DEPLOYMENT_TARGET"] = MacOS.version.to_s