2010-06-28 21:21:19 +00:00
|
|
|
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
|
2010-07-29 01:19:04 +00:00
|
|
|
if MACOS_VERSION < 10.6
|
|
|
|
# Leopard
|
2010-07-16 20:27:12 +00:00
|
|
|
url 'http://r.research.att.com/gfortran-42-5577.pkg'
|
|
|
|
md5 '30fb495c93cf514003cdfcb7846dc701'
|
|
|
|
version "4.2.4-5577"
|
2010-07-29 01:19:04 +00:00
|
|
|
else
|
|
|
|
# Snow Leopard
|
2010-08-05 03:30:56 +00:00
|
|
|
case gcc_42_build
|
|
|
|
when 5659
|
|
|
|
url 'http://r.research.att.com/gfortran-42-5659.pkg'
|
|
|
|
md5 '71bd546baa45c9c0fb4943cdd72ee274'
|
|
|
|
version "4.2.4-5659"
|
|
|
|
else
|
2010-08-27 00:42:43 +00:00
|
|
|
url 'http://r.research.att.com/gfortran-42-5664.pkg'
|
|
|
|
md5 'eb64ba9f8507da22e582814a69fbb7ca'
|
|
|
|
version "4.2.4-5664"
|
2010-08-05 03:30:56 +00:00
|
|
|
end
|
2010-06-28 21:21:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
homepage 'http://r.research.att.com/tools/'
|
|
|
|
|
|
|
|
def download_strategy
|
|
|
|
GfortranPkgDownloadStrategy
|
|
|
|
end
|
|
|
|
|
|
|
|
# Shouldn't strip compiler binaries.
|
2010-07-10 19:33:52 +00:00
|
|
|
skip_clean [ 'bin', 'lib', 'libexec' ]
|
2010-06-28 21:21:19 +00:00
|
|
|
|
|
|
|
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
|
2010-07-10 19:33:52 +00:00
|
|
|
safe_system "ln -sf #{bin}/gfortran-4.2 #{bin}/gfortran"
|
|
|
|
safe_system "ln -sf #{man1}/gfortran-4.2.1 #{man1}/gfortran.1"
|
2010-06-28 21:21:19 +00:00
|
|
|
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},'"
|
2010-07-10 19:33:52 +00:00
|
|
|
safe_system "ln -sf #{man1}/gfortran-4.2.1 #{man1}/gfortran.1"
|
2010-07-29 01:19:04 +00:00
|
|
|
when 5664
|
2010-08-27 00:42:43 +00:00
|
|
|
ohai "Installing gfortran 4.2.4 for XCode 3.2.3 (build 5664)"
|
2010-08-05 03:30:56 +00:00
|
|
|
safe_system "pax --insecure -rz -f Payload.gz -s ',./usr,#{prefix},'"
|
|
|
|
safe_system "ln -sf #{man1}/gfortran-4.2.1 #{man1}/gfortran.1"
|
2010-07-16 20:27:12 +00:00
|
|
|
else
|
|
|
|
onoe <<-EOS.undent
|
|
|
|
Currently the gfortran compiler provided by this brew is only supported
|
2010-08-05 03:30:56 +00:00
|
|
|
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
|
2010-08-27 00:42:43 +00:00
|
|
|
|
|
|
|
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
|
2010-07-16 20:27:12 +00:00
|
|
|
EOS
|
2010-06-28 21:21:19 +00:00
|
|
|
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
|