| 
									
										
										
										
											2013-01-26 20:05:39 -06:00
										 |  |  | require 'requirement' | 
					
						
							| 
									
										
										
										
											2013-06-23 18:35:20 -07:00
										 |  |  | require 'requirements/fortran_dependency' | 
					
						
							| 
									
										
										
										
											2013-04-02 15:33:35 -05:00
										 |  |  | require 'requirements/language_module_dependency' | 
					
						
							| 
									
										
										
										
											2013-09-14 11:48:48 +01:00
										 |  |  | require 'requirements/minimum_macos_requirement' | 
					
						
							| 
									
										
										
										
											2014-10-20 21:45:40 +01:00
										 |  |  | require 'requirements/maximum_macos_requirement' | 
					
						
							| 
									
										
										
										
											2013-04-02 15:33:35 -05:00
										 |  |  | require 'requirements/mpi_dependency' | 
					
						
							| 
									
										
										
										
											2014-08-29 14:05:12 -05:00
										 |  |  | require 'requirements/osxfuse_dependency' | 
					
						
							| 
									
										
										
										
											2013-01-21 10:33:56 +01:00
										 |  |  | require 'requirements/python_dependency' | 
					
						
							| 
									
										
										
										
											2014-11-04 04:01:10 +00:00
										 |  |  | require 'requirements/tuntap_dependency' | 
					
						
							| 
									
										
										
										
											2014-10-20 21:45:40 +01:00
										 |  |  | require 'requirements/unsigned_kext_requirement' | 
					
						
							| 
									
										
										
										
											2013-06-23 18:35:20 -07:00
										 |  |  | require 'requirements/x11_dependency' | 
					
						
							| 
									
										
										
										
											2012-10-24 18:06:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-24 18:17:43 -05:00
										 |  |  | class XcodeDependency < Requirement | 
					
						
							| 
									
										
										
										
											2012-12-23 19:44:15 -06:00
										 |  |  |   fatal true | 
					
						
							| 
									
										
										
										
											2012-10-24 18:06:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-09 09:26:38 +00:00
										 |  |  |   satisfy(:build_env => false) { xcode_installed_version } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def initialize(tags) | 
					
						
							| 
									
										
										
										
											2014-12-09 11:48:00 -05:00
										 |  |  |     @version = tags.find { |t| tags.delete(t) if /(\d\.)+\d/ === t } | 
					
						
							| 
									
										
										
										
											2014-12-09 09:26:38 +00:00
										 |  |  |     super | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def xcode_installed_version | 
					
						
							|  |  |  |     return false unless MacOS::Xcode.installed? | 
					
						
							| 
									
										
										
										
											2014-12-09 11:48:00 -05:00
										 |  |  |     return true unless @version | 
					
						
							| 
									
										
										
										
											2014-12-09 09:26:38 +00:00
										 |  |  |     MacOS::Xcode.version >= @version | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2012-10-24 18:06:00 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-23 17:44:43 +01:00
										 |  |  |   def message | 
					
						
							| 
									
										
										
										
											2014-12-09 09:26:38 +00:00
										 |  |  |     version = " #{@version}" if @version | 
					
						
							| 
									
										
										
										
											2013-10-23 17:44:43 +01:00
										 |  |  |     message = <<-EOS.undent
 | 
					
						
							| 
									
										
										
										
											2014-12-09 09:26:38 +00:00
										 |  |  |       A full installation of Xcode.app#{version} is required to compile this software. | 
					
						
							| 
									
										
										
										
											2013-10-23 17:44:43 +01:00
										 |  |  |       Installing just the Command Line Tools is not sufficient. | 
					
						
							| 
									
										
										
										
											2012-10-24 18:06:00 -05:00
										 |  |  |     EOS | 
					
						
							| 
									
										
										
										
											2013-10-23 17:44:43 +01:00
										 |  |  |     if MacOS.version >= :lion | 
					
						
							|  |  |  |       message += <<-EOS.undent
 | 
					
						
							|  |  |  |         Xcode can be installed from the App Store. | 
					
						
							|  |  |  |       EOS | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |       message += <<-EOS.undent
 | 
					
						
							|  |  |  |         Xcode can be installed from https://developer.apple.com/downloads/ | 
					
						
							|  |  |  |       EOS | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2012-10-24 18:06:00 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2012-11-05 20:03:26 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-12 16:24:30 -06:00
										 |  |  | class MysqlDependency < Requirement | 
					
						
							| 
									
										
										
										
											2012-12-23 19:44:15 -06:00
										 |  |  |   fatal true | 
					
						
							| 
									
										
										
										
											2013-05-10 13:35:38 +01:00
										 |  |  |   default_formula 'mysql' | 
					
						
							| 
									
										
										
										
											2012-11-05 20:03:26 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-19 20:45:59 -06:00
										 |  |  |   satisfy { which 'mysql_config' } | 
					
						
							| 
									
										
										
										
											2012-11-05 20:03:26 -06:00
										 |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-12 16:24:30 -06:00
										 |  |  | class PostgresqlDependency < Requirement | 
					
						
							| 
									
										
										
										
											2012-12-23 19:44:15 -06:00
										 |  |  |   fatal true | 
					
						
							| 
									
										
										
										
											2013-06-02 17:14:42 -05:00
										 |  |  |   default_formula 'postgresql' | 
					
						
							| 
									
										
										
										
											2012-11-05 20:03:26 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-19 20:45:59 -06:00
										 |  |  |   satisfy { which 'pg_config' } | 
					
						
							| 
									
										
										
										
											2012-11-05 20:03:26 -06:00
										 |  |  | end | 
					
						
							| 
									
										
										
										
											2012-12-13 22:23:06 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-12 16:24:30 -06:00
										 |  |  | class TeXDependency < Requirement | 
					
						
							| 
									
										
										
										
											2012-12-13 22:23:06 -08:00
										 |  |  |   fatal true | 
					
						
							| 
									
										
										
										
											2014-12-25 20:44:43 +00:00
										 |  |  |   cask "mactex" | 
					
						
							|  |  |  |   download "http://www.tug.org/mactex/" | 
					
						
							| 
									
										
										
										
											2012-12-13 22:23:06 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-19 20:45:59 -06:00
										 |  |  |   satisfy { which('tex') || which('latex') } | 
					
						
							| 
									
										
										
										
											2012-12-13 22:23:06 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-25 20:44:43 +00:00
										 |  |  |   def message | 
					
						
							|  |  |  |     s = <<-EOS.undent
 | 
					
						
							|  |  |  |       A LaTeX distribution is required for Homebrew to install this formula. | 
					
						
							| 
									
										
										
										
											2012-12-13 22:23:06 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-25 20:44:43 +00:00
										 |  |  |       Make sure that "/usr/texbin", or the location you installed it to, is in | 
					
						
							|  |  |  |       your PATH before proceeding. | 
					
						
							| 
									
										
										
										
											2012-12-13 22:23:06 -08:00
										 |  |  |     EOS | 
					
						
							| 
									
										
										
										
											2014-12-25 20:44:43 +00:00
										 |  |  |     s += super | 
					
						
							|  |  |  |     s | 
					
						
							| 
									
										
										
										
											2012-12-13 22:23:06 -08:00
										 |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2013-01-23 00:26:30 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-01 11:53:13 -05:00
										 |  |  | class ArchRequirement < Requirement | 
					
						
							|  |  |  |   fatal true | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def initialize(arch) | 
					
						
							| 
									
										
										
										
											2013-05-06 22:49:31 -05:00
										 |  |  |     @arch = arch.pop | 
					
						
							| 
									
										
										
										
											2013-04-01 11:53:13 -05:00
										 |  |  |     super | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   satisfy do | 
					
						
							|  |  |  |     case @arch | 
					
						
							|  |  |  |     when :x86_64 then MacOS.prefer_64_bit? | 
					
						
							| 
									
										
										
										
											2013-08-01 19:57:05 -07:00
										 |  |  |     when :intel, :ppc then Hardware::CPU.type == @arch | 
					
						
							| 
									
										
										
										
											2013-04-01 11:53:13 -05:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-02 15:33:35 -05:00
										 |  |  |   def message | 
					
						
							|  |  |  |     "This formula requires an #{@arch} architecture." | 
					
						
							| 
									
										
										
										
											2013-04-01 11:53:13 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2013-04-17 10:01:38 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | class MercurialDependency < Requirement | 
					
						
							|  |  |  |   fatal true | 
					
						
							| 
									
										
										
										
											2013-05-10 13:35:38 +01:00
										 |  |  |   default_formula 'mercurial' | 
					
						
							| 
									
										
										
										
											2013-04-17 10:01:38 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   satisfy { which('hg') } | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2013-09-28 16:37:05 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | class GitDependency < Requirement | 
					
						
							|  |  |  |   fatal true | 
					
						
							|  |  |  |   default_formula 'git' | 
					
						
							| 
									
										
										
										
											2014-03-13 18:07:11 -05:00
										 |  |  |   satisfy { !!which('git') } | 
					
						
							| 
									
										
										
										
											2013-09-28 16:37:05 -05:00
										 |  |  | end | 
					
						
							| 
									
										
										
										
											2014-07-21 02:11:08 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | class JavaDependency < Requirement | 
					
						
							|  |  |  |   fatal true | 
					
						
							| 
									
										
										
										
											2014-12-25 20:44:43 +00:00
										 |  |  |   cask "java" | 
					
						
							|  |  |  |   download "http://www.oracle.com/technetwork/java/javase/downloads/index.html" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-21 02:11:08 -07:00
										 |  |  |   satisfy { java_version } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def initialize(tags) | 
					
						
							|  |  |  |     @version = tags.pop | 
					
						
							|  |  |  |     super | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def java_version | 
					
						
							| 
									
										
										
										
											2014-09-11 23:25:18 -05:00
										 |  |  |     args = %w[/usr/libexec/java_home --failfast] | 
					
						
							|  |  |  |     args << "--version" << "#{@version}+" if @version | 
					
						
							|  |  |  |     quiet_system(*args) | 
					
						
							| 
									
										
										
										
											2014-07-21 02:11:08 -07:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def message | 
					
						
							|  |  |  |     version_string = " #{@version}" if @version | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-25 20:44:43 +00:00
										 |  |  |     s = "Java#{version_string} is required to install this formula." | 
					
						
							|  |  |  |     s += super | 
					
						
							|  |  |  |     s | 
					
						
							| 
									
										
										
										
											2014-07-21 02:11:08 -07:00
										 |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2014-11-05 20:32:09 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | class AprDependency < Requirement | 
					
						
							|  |  |  |   fatal true | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   satisfy(:build_env => false) { MacOS::CLT.installed? } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def message | 
					
						
							|  |  |  |     message = <<-EOS.undent
 | 
					
						
							|  |  |  |       Due to packaging problems on Apple's part, software that compiles | 
					
						
							|  |  |  |       against APR requires the standalone Command Line Tools. | 
					
						
							|  |  |  |     EOS | 
					
						
							|  |  |  |     if MacOS.version >= :mavericks | 
					
						
							|  |  |  |       message += <<-EOS.undent
 | 
					
						
							|  |  |  |         Run `xcode-select --install` to install them. | 
					
						
							|  |  |  |       EOS | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |       message += <<-EOS.undent
 | 
					
						
							|  |  |  |         The standalone package can be obtained from | 
					
						
							|  |  |  |         https://developer.apple.com/downloads/, | 
					
						
							|  |  |  |         or it can be installed via Xcode's preferences. | 
					
						
							|  |  |  |       EOS | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |