| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  | ## This file defines dependencies and requirements. | 
					
						
							|  |  |  | ## | 
					
						
							|  |  |  | ## A dependency is a formula that another formula needs to install. | 
					
						
							|  |  |  | ## A requirement is something other than a formula that another formula | 
					
						
							|  |  |  | ## needs to be present. This includes external language modules, | 
					
						
							|  |  |  | ## command-line tools in the path, or any arbitrary predicate. | 
					
						
							|  |  |  | ## | 
					
						
							|  |  |  | ## The `depends_on` method in the formula DSL is used to declare | 
					
						
							|  |  |  | ## dependencies and requirements. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # This class is used by `depends_on` in the formula DSL to turn dependency | 
					
						
							|  |  |  | # specifications into the proper kinds of dependencies and requirements. | 
					
						
							|  |  |  | class DependencyCollector | 
					
						
							|  |  |  |   # Define the languages that we can handle as external dependencies. | 
					
						
							|  |  |  |   LANGUAGE_MODULES = [ | 
					
						
							|  |  |  |     :chicken, :jruby, :lua, :node, :perl, :python, :rbx, :ruby | 
					
						
							|  |  |  |   ].freeze | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-23 17:06:38 -07:00
										 |  |  |   attr_reader :deps, :requirements | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def initialize | 
					
						
							|  |  |  |     @deps = Dependencies.new | 
					
						
							| 
									
										
										
										
											2012-07-23 17:06:38 -07:00
										 |  |  |     @requirements = Set.new | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def add spec | 
					
						
							| 
									
										
										
										
											2012-06-07 22:29:44 +02:00
										 |  |  |     tag = nil | 
					
						
							|  |  |  |     spec, tag = spec.shift if spec.is_a? Hash | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-03 07:49:30 -07:00
										 |  |  |     dep = parse_spec(spec, tag) | 
					
						
							|  |  |  |     # Some symbol specs are conditional, and resolve to nil if there is no | 
					
						
							|  |  |  |     # dependency needed for the current platform. | 
					
						
							|  |  |  |     return if dep.nil? | 
					
						
							|  |  |  |     # Add dep to the correct bucket | 
					
						
							| 
									
										
										
										
											2012-07-23 17:06:38 -07:00
										 |  |  |     (dep.is_a?(Requirement) ? @requirements : @deps) << dep | 
					
						
							| 
									
										
										
										
											2012-07-03 07:49:30 -07:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def parse_spec spec, tag | 
					
						
							|  |  |  |     case spec | 
					
						
							| 
									
										
										
										
											2012-06-08 04:31:51 +02:00
										 |  |  |     when Symbol | 
					
						
							| 
									
										
										
										
											2012-07-03 07:49:30 -07:00
										 |  |  |       parse_symbol_spec(spec, tag) | 
					
						
							| 
									
										
										
										
											2012-06-07 22:29:44 +02:00
										 |  |  |     when String | 
					
						
							|  |  |  |       if LANGUAGE_MODULES.include? tag | 
					
						
							|  |  |  |         LanguageModuleDependency.new(tag, spec) | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |       else | 
					
						
							| 
									
										
										
										
											2012-06-07 22:29:44 +02:00
										 |  |  |         Dependency.new(spec, tag) | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2012-06-07 22:29:44 +02:00
										 |  |  |     when Formula | 
					
						
							|  |  |  |       Dependency.new(spec.name, tag) | 
					
						
							|  |  |  |     when Dependency, Requirement | 
					
						
							|  |  |  |       spec | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |     else | 
					
						
							|  |  |  |       raise "Unsupported type #{spec.class} for #{spec}" | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2012-07-03 07:49:30 -07:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-06-07 22:29:44 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-03 07:49:30 -07:00
										 |  |  |   def parse_symbol_spec spec, tag | 
					
						
							|  |  |  |     case spec | 
					
						
							| 
									
										
										
										
											2012-07-10 09:53:03 -07:00
										 |  |  |     when :autoconf, :automake, :bsdmake, :libtool | 
					
						
							|  |  |  |       # Xcode no longer provides autotools or some other build tools | 
					
						
							| 
									
										
										
										
											2012-07-10 20:25:16 -05:00
										 |  |  |       Dependency.new(spec.to_s) unless MacOS::Xcode.provides_autotools? | 
					
						
							| 
									
										
										
										
											2012-07-30 21:34:44 +01:00
										 |  |  |     when :libpng, :freetype, :pixman, :fontconfig, :cairo | 
					
						
							| 
									
										
										
										
											2012-08-22 13:34:26 -07:00
										 |  |  |       if MacOS.version >= :mountain_lion | 
					
						
							|  |  |  |         Dependency.new(spec.to_s) | 
					
						
							| 
									
										
										
										
											2012-07-30 21:34:44 +01:00
										 |  |  |       else | 
					
						
							|  |  |  |         X11Dependency.new(tag) | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     when :x11 | 
					
						
							| 
									
										
										
										
											2012-07-03 07:49:30 -07:00
										 |  |  |       X11Dependency.new(tag) | 
					
						
							| 
									
										
										
										
											2012-07-12 07:08:23 -07:00
										 |  |  |     when :xcode | 
					
						
							|  |  |  |       XCodeDependency.new | 
					
						
							| 
									
										
										
										
											2012-07-03 07:49:30 -07:00
										 |  |  |     else | 
					
						
							|  |  |  |       raise "Unsupported special dependency #{spec}" | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-06-07 18:34:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # A list of formula dependencies. | 
					
						
							|  |  |  | class Dependencies < Array | 
					
						
							|  |  |  |   def include? dependency_name | 
					
						
							|  |  |  |     self.any?{|d| d.name == dependency_name} | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # A dependency on another Homebrew formula. | 
					
						
							|  |  |  | class Dependency | 
					
						
							|  |  |  |   attr_reader :name, :tags | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def initialize name, tags=nil | 
					
						
							|  |  |  |     @name = name | 
					
						
							| 
									
										
										
										
											2012-06-07 22:29:44 +02:00
										 |  |  |     @tags = case tags | 
					
						
							|  |  |  |       when Array then tags.each {|s| s.to_s} | 
					
						
							|  |  |  |       when nil then [] | 
					
						
							|  |  |  |       else [tags.to_s] | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def to_s | 
					
						
							|  |  |  |     @name | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def ==(other_dep) | 
					
						
							| 
									
										
										
										
											2012-03-20 22:31:14 -07:00
										 |  |  |     @name == other_dep.to_s | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-11 18:24:24 -05:00
										 |  |  |   def <=>(other_dep) | 
					
						
							|  |  |  |     @name <=> other_dep.to_s | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |   def options | 
					
						
							|  |  |  |     @tags.select{|p|p.start_with? '--'} | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # A base class for non-formula requirements needed by formulae. | 
					
						
							|  |  |  | # A "fatal" requirement is one that will fail the build if it is not present. | 
					
						
							|  |  |  | # By default, Requirements are non-fatal. | 
					
						
							|  |  |  | class Requirement | 
					
						
							| 
									
										
										
										
											2012-08-09 20:32:57 -07:00
										 |  |  |   # Should return true if this requirement is met. | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |   def satisfied?; false; end | 
					
						
							| 
									
										
										
										
											2012-08-09 20:32:57 -07:00
										 |  |  |   # Should return true if not meeting this requirement should fail the build. | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |   def fatal?; false; end | 
					
						
							| 
									
										
										
										
											2012-08-09 20:32:57 -07:00
										 |  |  |   # The message to show when the requirement is not met. | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |   def message; ""; end | 
					
						
							| 
									
										
										
										
											2012-08-09 20:32:57 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   # Requirements can modify the current build environment by overriding this. | 
					
						
							|  |  |  |   # See X11Dependency | 
					
						
							| 
									
										
										
										
											2012-07-09 11:33:43 -05:00
										 |  |  |   def modify_build_environment; nil end | 
					
						
							| 
									
										
										
										
											2012-07-27 02:50:29 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def eql?(other) | 
					
						
							|  |  |  |     other.is_a? self.class and hash == other.hash | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def hash | 
					
						
							| 
									
										
										
										
											2012-08-14 23:13:18 -05:00
										 |  |  |     message.hash | 
					
						
							| 
									
										
										
										
											2012-07-27 02:50:29 -05:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # A dependency on a language-specific module. | 
					
						
							|  |  |  | class LanguageModuleDependency < Requirement | 
					
						
							| 
									
										
										
										
											2012-03-20 19:43:41 -07:00
										 |  |  |   def initialize language, module_name, import_name=nil | 
					
						
							|  |  |  |     @language = language | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |     @module_name = module_name | 
					
						
							| 
									
										
										
										
											2012-03-20 19:43:41 -07:00
										 |  |  |     @import_name = import_name || module_name | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def fatal?; true; end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def satisfied? | 
					
						
							| 
									
										
										
										
											2012-04-30 14:17:56 +10:00
										 |  |  |     quiet_system(*the_test) | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def message; <<-EOS.undent
 | 
					
						
							|  |  |  |     Unsatisfied dependency: #{@module_name} | 
					
						
							| 
									
										
										
										
											2012-03-20 19:43:41 -07:00
										 |  |  |     Homebrew does not provide #{@language.to_s.capitalize} dependencies; install with: | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |       #{command_line} #{@module_name} | 
					
						
							|  |  |  |     EOS | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def the_test | 
					
						
							| 
									
										
										
										
											2012-03-20 19:43:41 -07:00
										 |  |  |     case @language | 
					
						
							|  |  |  |       when :chicken then %W{/usr/bin/env csi -e (use #{@import_name})} | 
					
						
							|  |  |  |       when :jruby then %W{/usr/bin/env jruby -rubygems -e require\ '#{@import_name}'} | 
					
						
							|  |  |  |       when :lua then %W{/usr/bin/env luarocks show #{@import_name}} | 
					
						
							|  |  |  |       when :node then %W{/usr/bin/env node -e require('#{@import_name}');} | 
					
						
							|  |  |  |       when :perl then %W{/usr/bin/env perl -e use\ #{@import_name}} | 
					
						
							|  |  |  |       when :python then %W{/usr/bin/env python -c import\ #{@import_name}} | 
					
						
							|  |  |  |       when :ruby then %W{/usr/bin/env ruby -rubygems -e require\ '#{@import_name}'} | 
					
						
							|  |  |  |       when :rbx then %W{/usr/bin/env rbx -rubygems -e require\ '#{@import_name}'} | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def command_line | 
					
						
							| 
									
										
										
										
											2012-03-20 19:43:41 -07:00
										 |  |  |     case @language | 
					
						
							| 
									
										
										
										
											2012-02-28 19:56:29 -08:00
										 |  |  |       when :chicken then "chicken-install" | 
					
						
							|  |  |  |       when :jruby   then "jruby -S gem install" | 
					
						
							|  |  |  |       when :lua     then "luarocks install" | 
					
						
							|  |  |  |       when :node    then "npm install" | 
					
						
							|  |  |  |       when :perl    then "cpan -i" | 
					
						
							|  |  |  |       when :python  then "easy_install" | 
					
						
							|  |  |  |       when :rbx     then "rbx gem install" | 
					
						
							|  |  |  |       when :ruby    then "gem install" | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2012-06-07 18:34:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-09 20:32:57 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | # This requirement is used to require an X11 implementation, | 
					
						
							|  |  |  | # optionally with a minimum version number. | 
					
						
							| 
									
										
										
										
											2012-06-07 18:34:40 +02:00
										 |  |  | class X11Dependency < Requirement | 
					
						
							|  |  |  |   def initialize min_version=nil | 
					
						
							|  |  |  |     @min_version = min_version | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def fatal?; true; end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def satisfied? | 
					
						
							| 
									
										
										
										
											2012-07-25 15:04:46 -05:00
										 |  |  |     MacOS::XQuartz.installed? and (@min_version.nil? or @min_version <= MacOS::XQuartz.version) | 
					
						
							| 
									
										
										
										
											2012-06-07 18:34:40 +02:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def message; <<-EOS.undent
 | 
					
						
							|  |  |  |     Unsatisfied dependency: XQuartz #{@min_version} | 
					
						
							|  |  |  |     Please install the latest version of XQuartz: | 
					
						
							|  |  |  |       https://xquartz.macosforge.org | 
					
						
							|  |  |  |     EOS | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-09 11:33:43 -05:00
										 |  |  |   def modify_build_environment | 
					
						
							|  |  |  |     ENV.x11 | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-14 23:13:18 -05:00
										 |  |  |   def hash | 
					
						
							|  |  |  |     "X11".hash | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-06-07 18:34:40 +02:00
										 |  |  | end | 
					
						
							| 
									
										
										
										
											2012-07-06 11:47:45 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-09 20:32:57 -07:00
										 |  |  | # There are multiple implementations of MPI-2 available. | 
					
						
							|  |  |  | # http://www.mpi-forum.org/ | 
					
						
							|  |  |  | # This requirement is used to find an appropriate one. | 
					
						
							| 
									
										
										
										
											2012-07-06 11:47:45 -08:00
										 |  |  | class MPIDependency < Requirement | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   attr_reader :lang_list | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def initialize *lang_list | 
					
						
							|  |  |  |     @lang_list = lang_list | 
					
						
							|  |  |  |     @non_functional = [] | 
					
						
							|  |  |  |     @unknown_langs = [] | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def fatal?; true; end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def mpi_wrapper_works? compiler | 
					
						
							|  |  |  |     compiler = which compiler | 
					
						
							|  |  |  |     return false if compiler.nil? or not compiler.executable? | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # Some wrappers are non-functional and will return a non-zero exit code | 
					
						
							|  |  |  |     # when invoked for version info. | 
					
						
							|  |  |  |     # | 
					
						
							|  |  |  |     # NOTE: A better test may be to do a small test compilation a la autotools. | 
					
						
							|  |  |  |     quiet_system compiler, '--version' | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def satisfied? | 
					
						
							|  |  |  |     @lang_list.each do |lang| | 
					
						
							|  |  |  |       case lang | 
					
						
							|  |  |  |       when :cc, :cxx, :f90, :f77 | 
					
						
							|  |  |  |         compiler = 'mpi' + lang.to_s | 
					
						
							|  |  |  |         @non_functional << compiler unless mpi_wrapper_works? compiler | 
					
						
							|  |  |  |       else | 
					
						
							|  |  |  |         @unknown_langs << lang.to_s | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     @unknown_langs.empty? and @non_functional.empty? | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def modify_build_environment | 
					
						
							|  |  |  |     # Set environment variables to help configure scripts find MPI compilers. | 
					
						
							|  |  |  |     # Variable names taken from: | 
					
						
							| 
									
										
										
										
											2012-08-09 20:32:57 -07:00
										 |  |  |     # http://www.gnu.org/software/autoconf-archive/ax_mpi.html | 
					
						
							| 
									
										
										
										
											2012-07-06 11:47:45 -08:00
										 |  |  |     lang_list.each do |lang| | 
					
						
							|  |  |  |       compiler = 'mpi' + lang.to_s | 
					
						
							|  |  |  |       mpi_path = which compiler | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       # Fortran 90 environment var has a different name | 
					
						
							|  |  |  |       compiler = 'MPIFC' if lang == :f90 | 
					
						
							|  |  |  |       ENV[compiler.upcase] = mpi_path | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def message | 
					
						
							|  |  |  |     if not @unknown_langs.empty? | 
					
						
							|  |  |  |       <<-EOS.undent
 | 
					
						
							|  |  |  |         There is no MPI compiler wrapper for: | 
					
						
							|  |  |  |             #{@unknown_langs.join ', '} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         The following values are valid arguments to `MPIDependency.new`: | 
					
						
							|  |  |  |             :cc, :cxx, :f90, :f77 | 
					
						
							|  |  |  |         EOS | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |       <<-EOS.undent
 | 
					
						
							|  |  |  |         Homebrew could not locate working copies of the following MPI compiler | 
					
						
							|  |  |  |         wrappers: | 
					
						
							|  |  |  |             #{@non_functional.join ', '} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         If you have a MPI installation, please ensure the bin folder is on your | 
					
						
							|  |  |  |         PATH and that all the wrappers are functional. Otherwise, a MPI | 
					
						
							|  |  |  |         installation can be obtained from homebrew by *picking one* of the | 
					
						
							|  |  |  |         following formulae: | 
					
						
							|  |  |  |             open-mpi, mpich2 | 
					
						
							|  |  |  |         EOS | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2012-07-28 13:02:46 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-09 20:32:57 -07:00
										 |  |  | # This requirement added by the `conflicts_with` DSL method. | 
					
						
							| 
									
										
										
										
											2012-07-28 13:02:46 -03:00
										 |  |  | class ConflictRequirement < Requirement | 
					
						
							|  |  |  |   attr_reader :formula | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def initialize formula, message | 
					
						
							|  |  |  |     @formula = formula | 
					
						
							|  |  |  |     @message = message | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def message; @message; end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def satisfied? | 
					
						
							|  |  |  |     keg = Formula.factory(@formula).prefix | 
					
						
							|  |  |  |     not keg.exist? && Keg.new(keg).linked? | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-09 20:32:57 -07:00
										 |  |  |   # The user can chose to force installation even in the face of conflicts. | 
					
						
							| 
									
										
										
										
											2012-07-28 13:02:46 -03:00
										 |  |  |   def fatal? | 
					
						
							|  |  |  |     not ARGV.force? | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2012-07-12 07:08:23 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | class XCodeDependency < Requirement | 
					
						
							|  |  |  |   def fatal?; true; end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def satisfied? | 
					
						
							|  |  |  |     MacOS::Xcode.installed? | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def message; <<-EOS.undent
 | 
					
						
							| 
									
										
										
										
											2012-08-24 13:28:36 -07:00
										 |  |  |     A full installation of XCode.app is required to compile this software. | 
					
						
							|  |  |  |     Installing just the Command Line Tools is not sufficent. | 
					
						
							| 
									
										
										
										
											2012-07-12 07:08:23 -07:00
										 |  |  |     EOS | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |