require 'formula' require 'brew.h' class GfortranPkgDownloadStrategy gfortran-4.2 symlink safe_system "ln -sf #{bin}/gfortran-4.2 #{bin}/gfortran" safe_system "ln -sf #{man1}/gfortran-4.2.1 #{man1}/gfortran.1" when 5659 ohai "Installing gfortran 4.2.4 for XCode 3.2.2 (build 5659)" safe_system "pax --insecure -rz -f Payload.gz -s ',./usr,#{prefix},'" safe_system "ln -sf #{man1}/gfortran-4.2.1 #{man1}/gfortran.1" when 5664 ohai "Installing gfortran 4.2.4 for XCode 3.2.3 (build 5664)" safe_system "pax --insecure -rz -f Payload.gz -s ',./usr,#{prefix},'" safe_system "ln -sf #{man1}/gfortran-4.2.1 #{man1}/gfortran.1" else onoe <<-EOS.undent Currently the gfortran compiler provided by this brew is only supported for XCode 3.1.4 on OS X 10.5.x and XCode 3.2.2/3.2.3 on OS X 10.6.x Software update can help upgrade your copy of XCode. The latest version of XCode is also available from: http://developer.apple.com/technologies/xcode.html EOS end end def caveats caveats = <<-EOS Fortran compiler support in brews is currently experimental. One of the consequences of this is that Homebrew does not set environment flags to ensure that a particular Fortran compiler is used and that the resulting code is optimized properly. Therefore, in addition to using: depends_on "gfortran" Fortran-based brews should also specify environment variables for the Fortran compiler in the install section: # Select the Fortran compiler to be used: ENV["FC"] = ENV["F77"] "\#{HOMEBREW_PREFIX}/bin/gfortran" # Set Fortran optimization flags: ENV["FFLAGS"] = ENV["FCFLAGS"] = ENV["CFLAGS"] Following these guidelines will allow Fortran-based brews to be easily edited so that alternate Fortran compilers, such as ifort, can be used instead of the version of gfortran provided by Homebrew. EOS end end