1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
require "mkmf"
$configure_args["--with-hdf5-dir"] = ENV["HDF5_DIR"]
require "rbconfig" unless defined? RbConfig
$vendorarchdir=RbConfig::CONFIG['vendorarchdir']
$archlibdir=RbConfig::CONFIG['archlibdir']
dir_config('narray',$vendorarchdir,$vendorarchdir)
if ( ! ( have_header("narray.h") && have_header("narray_config.h") ) ) then
print <<EOS
** configure error **
Header narray.h or narray_config.h is not found. If you have these files in
/narraydir/include, try the following:
% ruby extconf.rb --with-narray-include=/narraydir/include
EOS
exit(-1)
end
dir_config('gctp', $archlibdir, $archlibdir)
if ( ! have_library("gctp") ) then
print <<-EOS
** configure error **
EOS
exit(-1)
end
dir_config('hdf5',$archlibdir,$archlibdir)
if ( ! ( have_header("hdf5.h") && have_library("hdf5") ) )then
print <<-EOS
** configure error **
Header hdf.h or the compiled hdf5 library is not found.
If you have the library installed under /hdf5dir (that is, hdf5.h is
in /hdf5dir/include and the library in /hdf5dir/lib/),
try the following:
% ruby extconf.rb --with-hdf5-dir=/hdf5dir
Alternatively, you can specify the two directory separately
with --with-hdf5-include and --with-hdf5-lib.
EOS
exit(-1)
end
dir_config('hdfeos5','/usr/include/hdf-eos5',$archlibdir)
if ( ! ( have_header("HE5_HdfEosDef.h") && have_library("he5_hdfeos") ) )then
print <<-EOS
** configure error **
Header hdfeos5.h or the compiled hdfeos5 library is not found.
If you have the library installed under /hdfeos5dir (that is, hdfeos5.h is
in /hdfeos5dir/include and the library in /hdfeos5dir/lib/),
try the following:
% ruby extconf.rb --with-hdfeos5-dir=/hdfeos5dir
Alternatively, you can specify the two directory separately
with --with-hdfeos5-include and --with-hdfeos5-lib.
EOS
exit(-1)
end
if /cygwin|mingw/ =~ RUBY_PLATFORM
have_library("narray") || raise("ERROR: narray library is not found")
end
create_makefile "numru/hdfeos5raw"
###### Modify Makefile: #######
File.rename("Makefile","Makefile.orig")
oldmkfl = File.open("Makefile.orig")
newmkfl = File.open("Makefile","w")
oldmkfl.each_line{ |line|
case(line)
when /^distclean:/
newmkfl.puts(line)
newmkfl.puts("\t\t@$(RM) *.he5 Makefile.orig")
when /^all:/
newmkfl.puts(line)
newmkfl.puts("")
newmkfl.puts("test: all") # insert the "test" target
newmkfl.puts("\t\t@cd test && ruby test.rb && echo 'test did not fail :-p (please ignore the warnings)' && cd ..")
else
newmkfl.puts(line)
end
}
newmkfl.close
|