parent
4bf72a3e62
commit
88ad4c061d
@ -53,32 +53,17 @@ rescue Exception => e
|
||||
end
|
||||
|
||||
def post_superenv_hacks f
|
||||
# TODO replace with Formula DSL
|
||||
# Python etc. build but then pip can't build stuff.
|
||||
# Scons resets ENV and then can't find superenv's build-tools.
|
||||
# In some cases we should only apply in the case of an option I suggest the
|
||||
# following:
|
||||
#
|
||||
# option 'with-passenger' do
|
||||
# env :userpaths # for superenv
|
||||
# end
|
||||
# option 'without-foo' do
|
||||
# env :std, :x11
|
||||
# end
|
||||
#
|
||||
# NOTE I think all ENV stuff should be specified with a DSL like this now.
|
||||
case f.name.to_sym
|
||||
when :lilypond, :nginx, :auctex
|
||||
# Only allow Homebrew-approved directories into the PATH, unless
|
||||
# a formula opts-in to allowing the user's path.
|
||||
if f.env.userpaths?
|
||||
paths = ORIGINAL_PATHS.map{|pn| pn.realpath.to_s rescue nil } - %w{/usr/X11/bin /opt/X11/bin}
|
||||
ENV['PATH'] = "#{ENV['PATH']}:#{paths.join(':')}"
|
||||
end
|
||||
end
|
||||
|
||||
def pre_superenv_hacks f
|
||||
# fontforge needs 10.7 SDK, wine 32 bit, graphviz has mysteriously missing symbols
|
||||
# and ruby/python/ghc etc. create gem/pip that then won't work
|
||||
stdenvs = %w{fontforge python python3 ruby ruby-enterprise-edition jruby wine graphviz ghc}
|
||||
ARGV.unshift '--env=std' if (stdenvs.include?(f.name) or
|
||||
# Allow a formula to opt-in to the std environment.
|
||||
ARGV.unshift '--env=std' if (f.env.std? or
|
||||
f.recursive_deps.detect{|d| d.name == 'scons' }) and
|
||||
not ARGV.include? '--env=super'
|
||||
end
|
||||
|
15
Library/Homebrew/build_environment.rb
Normal file
15
Library/Homebrew/build_environment.rb
Normal file
@ -0,0 +1,15 @@
|
||||
require 'set'
|
||||
|
||||
class BuildEnvironment
|
||||
def initialize settings
|
||||
@settings = Set.new(settings)
|
||||
end
|
||||
|
||||
def std?
|
||||
@settings.include? :std
|
||||
end
|
||||
|
||||
def userpaths?
|
||||
@settings.include? :userpaths
|
||||
end
|
||||
end
|
@ -6,6 +6,7 @@ require 'bottles'
|
||||
require 'extend/fileutils'
|
||||
require 'patches'
|
||||
require 'compilers'
|
||||
require 'build_environment'
|
||||
|
||||
|
||||
class Formula
|
||||
@ -436,6 +437,10 @@ class Formula
|
||||
def deps; self.class.dependencies.deps; end
|
||||
def requirements; self.class.dependencies.requirements; end
|
||||
|
||||
def env
|
||||
@env ||= BuildEnvironment.new(self.class.environments)
|
||||
end
|
||||
|
||||
def conflicts
|
||||
requirements.select { |r| r.is_a? ConflictRequirement }
|
||||
end
|
||||
@ -646,6 +651,14 @@ private
|
||||
@stable.mirror(val)
|
||||
end
|
||||
|
||||
def environments
|
||||
@environments ||= []
|
||||
end
|
||||
|
||||
def env *settings
|
||||
environments.concat [settings].flatten
|
||||
end
|
||||
|
||||
def dependencies
|
||||
@dependencies ||= DependencyCollector.new
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user