From: Debian GIS Project <pkg-grass-devel@lists.alioth.debian.org>
Date: Fri, 5 Jul 2013 01:23:50 +0900
Subject: Fix NArray Library Path

In Debian, NArray was installed $vendorarchdir.
This patch fix search path for NArray.
---
 extconf.rb | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

--- ruby-hdfeos5.orig/extconf.rb
+++ ruby-hdfeos5/extconf.rb
@@ -1,6 +1,10 @@
 require "mkmf"
 
-dir_config('narray',$sitearchdir,$sitearchdir)
+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
@@ -14,7 +18,15 @@
    exit(-1)
 end
 
-dir_config('hdf5',$sitearchdir,$sitearchdir)
+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
@@ -32,9 +44,9 @@
   exit(-1)
 end
 
-dir_config('hdfeos5',$sitearchdir,$sitearchdir)
+dir_config('hdfeos5','/usr/include/hdf-eos5',$archlibdir)
 
-if ( ! ( have_header("HE5_HdfEosDef.h") && have_library("Gctp") && have_library("he5_hdfeos")  ) )then
+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. 
@@ -69,7 +81,7 @@
       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 ..") 
+      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
