diff options
| author | Charlie Sharpsteen | 2010-06-28 14:21:19 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2010-07-16 09:09:57 -0700 |
| commit | ae606d6bc7f4db269d2fa7647b4327dab3185095 (patch) | |
| tree | cfa69e3bd7af4c8b5d2a5a3ca6468b310a9886f2 /Library/Formula | |
| parent | 511d309374f693231938eecfda7202c2a6ce3e4d (diff) | |
| download | homebrew-ae606d6bc7f4db269d2fa7647b4327dab3185095.tar.bz2 | |
New formula for installing gfortran 4.2.4 binaries
This formula enables preliminary support for Fortran-based brews in the
Hombrew project by providing a Fortran compiler- specifically a build of
gfortran 4.2.4 that incorporates Apple's patches to GCC.
These gfortran 4.2.4 binaries were created to support the compilation of
Fortran code used by the R Project for statistical computing by Simon
Urbanek and are sourced from:
http://r.research.att.com/tools
The compilers are somewhat tied to specific versions of the XCode tool
chain. Therefore XCode version 3.1.4 is required on OS X 10.5.x and
XCode 3.2.2 is required on OS X 10.6.x for installation to take place.
Please read the caveats section of this brew for notes concerning the
creation of Fortran-based brews.
For more discussion concerning Fortran support in Homebrew see:
http://github.com/mxcl/homebrew/issues/issue/72
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/gfortran.rb | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/Library/Formula/gfortran.rb b/Library/Formula/gfortran.rb new file mode 100644 index 000000000..eec9f190e --- /dev/null +++ b/Library/Formula/gfortran.rb @@ -0,0 +1,93 @@ +require 'formula' +require 'brew.h' + +class GfortranPkgDownloadStrategy <CurlDownloadStrategy + + def stage + # The 4.2.4 compiler is distributed as a OS X 10.5 + # package- a single flat xar archive instead of a + # bundle. + safe_system "/usr/bin/xar -xf #{@tarball_path}" + chdir + + # Clean up. + safe_system "mv *.pkg/Payload Payload.gz" + safe_system "ls | grep -v Payload | xargs rm -r" + end + +end + +class Gfortran <Formula + + case gcc_42_build + + when 5577 + url 'http://r.research.att.com/gfortran-42-5577.pkg' + md5 '30fb495c93cf514003cdfcb7846dc701' + version "4.2.4-5577" + + when 5659 + url 'http://r.research.att.com/gfortran-42-5659.pkg' + md5 '71bd546baa45c9c0fb4943cdd72ee274' + version "4.2.4-5659" + + 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 on OS X 10.6.x + EOS + exit + + end + + homepage 'http://r.research.att.com/tools/' + + def download_strategy + GfortranPkgDownloadStrategy + end + + # Shouldn't strip compiler binaries. + skip_clean [ 'bin', 'lib', 'libexec' ] + + def install + + # The version of pax jumped 16 years in development between OS X 10.5 + # and OS X 10.6. In that time it became security concious. Additionally, + # there are some slight variations in the packaging- because of this + # installation is broken down by XCode version. + case gcc_42_build + when 5577 + ohai "Installing gfortran 4.2.4 for XCode 3.1.4 (build 5577)" + safe_system "pax -rz -f Payload.gz -s ',./usr,#{prefix},'" + # The 5577 package does not contain the gfortran->gfortran-4.2 symlink + safe_system "ln -sf #{bin + 'gfortran-4.2'} #{bin + 'gfortran'}" + 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},'" + 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 |
