Skip to content
Snippets Groups Projects
Commit 8991d9bf authored by Charlie Sharpsteen's avatar Charlie Sharpsteen Committed by Adam Vandenberg
Browse files

Add Fortran configuration to ENV.rb


This provides a uniform way for formulae to indicate a Fortran compiler
is required.

Signed-off-by: default avatarAdam Vandenberg <flangy@gmail.com>
parent ddb8d1cd
No related branches found
No related tags found
No related merge requests found
......@@ -131,6 +131,54 @@ module HomebrewEnvExtension
self.O4
end
def fortran
if self['FC']
ohai "Building with an alternative Fortran compiler. This is unsupported."
self['F77'] = self['FC'] unless self['F77']
if ARGV.include? '--default-fortran-flags'
self['FCFLAGS'] = self['CFLAGS'] unless self['FCFLAGS']
self['FFFLAGS'] = self['CFLAGS'] unless self['FFFLAGS']
elsif not self['FCFLAGS'] or self['FFLAGS']
opoo <<-EOS
No Fortran optimization information was provided. You may want to consider
setting FCFLAGS and FFLAGS or pass the `--default-fortran-flags` option to
`brew install` if your compiler is compatible with GCC.
If you like the default optimization level of your compiler, ignore this
warning.
EOS
end
elsif `/usr/bin/which gfortran`.chomp.size > 0
ohai <<-EOS
Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
EOS
self['FC'] = `/usr/bin/which gfortran`.chomp
self['F77'] = self['FC']
self['FCFLAGS'] = self['CFLAGS']
self['FFLAGS'] = self['CFLAGS']
else
onoe <<-EOS
This formula requires a fortran compiler, but we could not find one by
looking at the FC environment variable or searching your PATH for `gfortran`.
Please take one of the following actions:
- Decide to use the build of gfortran 4.2.x provided by Homebrew using
`brew install gfortran`
- Choose another Fortran compiler by setting the FC environment variable:
export FC=/path/to/some/fortran/compiler
Using an alternative compiler may produce more efficient code, but we will
not be able to provide support for build errors.
EOS
exit 1
end
end
def osx_10_4
self['MACOSX_DEPLOYMENT_TARGET']="10.4"
remove_from_cflags(/ ?-mmacosx-version-min=10\.\d/)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment