7c648d9732
When interpolating in strings passed to Formula#system, it should be done in such a way that if any interpolated variables contain spaces, they are either (a) passed as part of a list or (b) protected by quotes if they are part of a long string (which is subject to shell expansion). Otherwise, they will be split on the space when expanded by the shell and passed as multiple arguments to whatever process is being executed. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
40 lines
1.2 KiB
Ruby
40 lines
1.2 KiB
Ruby
require 'formula'
|
|
|
|
class CfitsioExamples < Formula
|
|
url 'http://heasarc.gsfc.nasa.gov/docs/software/fitsio/cexamples/cexamples.zip'
|
|
version '2010.08.19'
|
|
md5 '31a5f5622a111f25bee5a3fda2fdac28'
|
|
end
|
|
|
|
class Cfitsio < Formula
|
|
homepage 'http://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html'
|
|
url 'ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3300.tar.gz'
|
|
sha1 '70fd41db978401f423c07f53e6e7bf45b489e5cb'
|
|
version '3.30'
|
|
|
|
def options
|
|
[['--with-examples', "Compile and install example programs."]]
|
|
end
|
|
|
|
def install
|
|
system "./configure", "--prefix=#{prefix}"
|
|
system "make shared"
|
|
system "make install"
|
|
|
|
if ARGV.include? '--with-examples'
|
|
system "make fpack funpack"
|
|
bin.install 'fpack', 'funpack'
|
|
|
|
# fetch, compile and install examples programs
|
|
CfitsioExamples.new.brew do
|
|
mkdir 'bin'
|
|
Dir['*.c'].each do |f|
|
|
# compressed_fits.c does not work (obsolete function call)
|
|
next if f == 'compress_fits.c'
|
|
system ENV.cc, f, "-I#{include}", "-L#{lib}", "-lcfitsio", "-lm", "-o", "bin/#{f.sub('.c', '')}"
|
|
end
|
|
bin.install Dir['bin/*']
|
|
end
|
|
end
|
|
end
|
|
end
|