2010-04-08 10:04:37 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Cfitsio < Formula
|
2010-04-08 10:04:37 +00:00
|
|
|
homepage 'http://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html'
|
2013-07-16 21:27:09 +00:00
|
|
|
url 'ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3350.tar.gz'
|
2013-07-30 16:40:27 +00:00
|
|
|
sha1 'e928832708d6a5df21a1e17ae4a63036cab7c1b9'
|
2013-07-16 21:27:09 +00:00
|
|
|
version '3.350'
|
2010-04-08 10:04:37 +00:00
|
|
|
|
2012-08-23 04:37:04 +00:00
|
|
|
option 'with-examples', "Compile and install example programs"
|
2011-08-29 15:36:01 +00:00
|
|
|
|
2013-08-07 05:28:49 +00:00
|
|
|
resource 'examples' do
|
|
|
|
url 'http://heasarc.gsfc.nasa.gov/docs/software/fitsio/cexamples/cexamples.zip'
|
|
|
|
version '2012.09.24'
|
|
|
|
sha1 '668ffa9a65a66c9f1d7f4241867e1e8adf653231'
|
|
|
|
end if build.with? 'examples'
|
|
|
|
|
2010-04-08 10:04:37 +00:00
|
|
|
def install
|
|
|
|
system "./configure", "--prefix=#{prefix}"
|
|
|
|
system "make shared"
|
|
|
|
system "make install"
|
2011-08-29 15:36:01 +00:00
|
|
|
|
2013-08-07 05:28:49 +00:00
|
|
|
if build.with? 'examples'
|
2011-08-29 15:36:01 +00:00
|
|
|
system "make fpack funpack"
|
2012-02-22 04:48:36 +00:00
|
|
|
bin.install 'fpack', 'funpack'
|
2011-08-29 15:36:01 +00:00
|
|
|
|
2013-08-07 05:28:49 +00:00
|
|
|
resource('examples').stage do
|
|
|
|
# compressed_fits.c does not work (obsolete function call)
|
|
|
|
Dir['*.c'].reject{|f| f == 'compress_fits.c'}.each do |f|
|
2013-06-13 18:43:03 +00:00
|
|
|
system ENV.cc, f, "-I#{include}", "-L#{lib}", "-lcfitsio", "-lm", "-o", "#{bin}/#{f.sub('.c', '')}"
|
2011-08-29 15:36:01 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2010-04-08 10:04:37 +00:00
|
|
|
end
|
|
|
|
end
|