2011-09-02 14:29:17 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Salt < Formula
|
2014-01-27 14:21:19 +00:00
|
|
|
homepage 'http://supernovae.in2p3.fr/salt/doku.php?id=start'
|
|
|
|
url 'http://supernovae.in2p3.fr/salt/lib/exe/fetch.php?media=snfit-2.4.0.tar.gz'
|
|
|
|
sha1 '7f6e36e78199d8dec0458b464643e1e90fc51282'
|
|
|
|
version '2.4'
|
2011-09-02 14:29:17 +00:00
|
|
|
|
2013-06-24 03:29:13 +00:00
|
|
|
depends_on :fortran
|
|
|
|
|
2013-11-13 05:42:35 +00:00
|
|
|
conflicts_with 'fastbit', :because => 'both install `include/filter.h`'
|
|
|
|
|
2014-01-27 14:21:19 +00:00
|
|
|
resource 'data' do
|
|
|
|
url 'http://supernovae.in2p3.fr/salt/lib/exe/fetch.php?media=salt2-4_data.tgz'
|
|
|
|
sha1 '92c34fe3363fe6a88c8cda75c543503a9b3196f7'
|
2013-09-18 15:49:13 +00:00
|
|
|
end
|
|
|
|
|
2014-01-27 14:21:19 +00:00
|
|
|
resource '03d4ag' do
|
|
|
|
url 'http://supernovae.in2p3.fr/salt/lib/exe/fetch.php?media=jla-03d4ag.tar.gz'
|
|
|
|
sha1 'b227f5e50ea227375720f3c00dd849f964cfa2ba'
|
2011-09-02 14:29:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
|
|
|
ENV.deparallelize
|
|
|
|
# the libgfortran.a path needs to be set explicitly
|
|
|
|
libgfortran = `$FC --print-file-name libgfortran.a`.chomp
|
2014-01-27 14:21:19 +00:00
|
|
|
ENV.append 'LDFLAGS', "-L#{File.dirname libgfortran} -lgfortran"
|
|
|
|
system "./configure", "--prefix=#{prefix}", "--disable-static"
|
2011-09-02 14:29:17 +00:00
|
|
|
system "make install"
|
|
|
|
# install all the model data
|
2014-01-27 14:21:19 +00:00
|
|
|
(prefix/'data').install resource('data')
|
2013-06-12 09:50:32 +00:00
|
|
|
# for testing
|
2014-01-27 14:21:19 +00:00
|
|
|
(prefix/'03d4ag').install resource('03d4ag')
|
2011-09-02 14:29:17 +00:00
|
|
|
end
|
|
|
|
|
2013-02-02 05:12:54 +00:00
|
|
|
test do
|
2014-01-27 14:21:19 +00:00
|
|
|
ENV['SALTPATH'] = "#{prefix}/data"
|
|
|
|
cp_r Dir[prefix + '03d4ag' + '*'], '.'
|
2013-02-02 05:12:54 +00:00
|
|
|
# I don't know why I need to redo the cd on the shell, but it doesn't work otherwise
|
2014-01-27 14:21:19 +00:00
|
|
|
system "cd #{Dir.pwd}; #{bin}/snfit lc-03D4ag.list"
|
|
|
|
system "cat result_salt2.dat"
|
2011-09-02 14:29:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def caveats
|
2013-06-12 09:50:32 +00:00
|
|
|
<<-EOS.undent
|
|
|
|
You should add the following to your .bashrc or equivalent:
|
2014-01-27 14:21:19 +00:00
|
|
|
export SALTPATH=#{prefix}/data
|
2013-06-12 09:50:32 +00:00
|
|
|
EOS
|
2011-09-02 14:29:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|