Give "gem install" options for "ruby extconf.rb"

Hi!

I’d like to install ruby-netcdf, but my netcdf-installation is in a
non-standard directory. Is there any
possibility to call

gem install ruby-netcdf

with additional options so that the extconf.rb is called with an option
like

ruby extronf,rb --with-netcdf-dir=/PATH/TO/NETCDFROOT

instead of plain

ruby extconf.rb

thanks for hints
ralf

Ralf M. wrote in post #1041487:

Hi!

I’d like to install ruby-netcdf, but my netcdf-installation is in a
non-standard directory. Is there any
possibility to call

gem install ruby-netcdf

with additional options so that the extconf.rb is called with an option
like

ruby extronf,rb --with-netcdf-dir=/PATH/TO/NETCDFROOT

instead of plain

ruby extconf.rb

Read gem help install will set you free:

$ gem help install
Usage: gem install GEMNAME [GEMNAME …] [options] – --build-flags
[options]

If an extension fails to compile during gem installation the gem
specification is not written out, but the gem remains unpacked in 

the
repository. You may need to specify the path to the library’s
headers and
libraries to continue. You can do this by adding a – between
RubyGems’
options and the extension’s build options:

  $ gem install some_extension_gem
  [build fails]
  Gem files will remain installed in \
  /path/to/gems/some_extension_gem-1.0 for inspection.
  Results logged to 

/path/to/gems/some_extension_gem-1.0/gem_make.out

  $ gem install some_extension_gem -- 

–with-extension-lib=/path/to/lib
[build succeeds]


Luis L.

On 01/18/2012 02:29 PM, Luis L. wrote:

like
[…]

Luis L.

Thanks Luis!