diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | Rakefile | 1 | ||||
-rw-r--r-- | ext/openbabel/extconf.rb | 35 | ||||
-rw-r--r-- | openbabel-0.0.1.gem | bin | 3584 -> 0 bytes | |||
-rw-r--r-- | openbabel-2.3.1.gem | bin | 4096 -> 0 bytes | |||
-rw-r--r-- | openbabel.gemspec | 4 |
7 files changed, 39 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4040c6c --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.gem +.bundle +Gemfile.lock +pkg/* @@ -12,4 +12,7 @@ openbabel gem has been tested with ruby 1.9. It only compiles on POSIX systems a ## Install gem install openbabel -It downloads the sources, compiles the ruby bindings and installs them. Check out [http://cs.maunz.de](http://cs.maunz.de) for more information. +It downloads the sources, compiles OpenBabel (if not installed) and the ruby bindings and installs them. +If OpenBabel is not yet installed installation may last very long - please be patient. + +Check out [http://cs.maunz.de](http://cs.maunz.de) for more information. @@ -1,3 +1,4 @@ +require "bundler/gem_tasks" require 'rake/testtask' Rake::TestTask.new do |t| diff --git a/ext/openbabel/extconf.rb b/ext/openbabel/extconf.rb index 4b6189c..98150ea 100644 --- a/ext/openbabel/extconf.rb +++ b/ext/openbabel/extconf.rb @@ -4,22 +4,43 @@ require 'tmpdir' ob_num_ver="2.3.1" ob_ver="openbabel-"+ob_num_ver -main_dir = Dir.mktmpdir -ob_main_dir=main_dir+"/"+ob_ver -ob_bindings_dir=ob_main_dir+"/scripts/ruby" +main_dir = File.expand_path(File.join(File.dirname(__FILE__),"..","..","src")) +lib_dir = File.expand_path(File.join(File.dirname(__FILE__),"..","..","src")) +Dir.mkdir main_dir +ob_main_dir = File.join(main_dir,ob_ver) +ob_bindings_dir = File.join(ob_main_dir,"scripts","ruby") begin Dir.chdir main_dir do FileUtils.rm_rf ob_main_dir - `curl -L -d use_mirror=netcologne "http://downloads.sourceforge.net/project/openbabel/openbabel/#{ob_num_ver}/openbabel-#{ob_num_ver}.tar.gz" | tar xz` + puts "Downloading OpenBabel sources" + puts `curl -L -d use_mirror=netcologne "http://downloads.sourceforge.net/project/openbabel/openbabel/#{ob_num_ver}/openbabel-#{ob_num_ver}.tar.gz" | tar xz` end Dir.chdir ob_main_dir do - `cmake #{ob_main_dir}` + puts "Configuring OpenBabel" + puts `cmake #{ob_main_dir} -DCMAKE_INSTALL_PREFIX=#{lib_dir}` + openbabel_libs = false + openbabel_libs = true if `/sbin/ldconfig -p`.split("\n").grep(/openbabel/) + unless openbabel_libs + ENV["LD_LIBRARY_PATH"].split(":").each do |dir| + openbabel_libs = true unless Dir[File.join(dir,"*libopenbabel*")].empty? + end + end + unless openbabel_libs + puts "OpenBabel not installed. Compiling sources." + puts `make` + puts `make install` + end end Dir.chdir ob_bindings_dir do + puts "Compiling and instaling OpenBabel Ruby bindings." `sed -i 's/Init_OpenBabel/Init_openbabel/g' *cpp` - require './extconf.rb' - `make` + # get include and lib from pkg-config + ob_include=`pkg-config openbabel-2.0 --cflags-only-I`.sub(/\s+/,'').sub(/-I/,'') + ob_lib=`pkg-config openbabel-2.0 --libs-only-L`.sub(/\s+/,'').sub(/-L/,'') + `ruby extconf.rb --with-openbabel-include=#{ob_include} --with-openbabel-lib=#{ob_lib}` + `sed -i 's/-flat_namespace//' Makefile` + puts `make` end FileUtils.cp(ob_bindings_dir+"/openbabel.so", "./") ensure diff --git a/openbabel-0.0.1.gem b/openbabel-0.0.1.gem Binary files differdeleted file mode 100644 index a9098c9..0000000 --- a/openbabel-0.0.1.gem +++ /dev/null diff --git a/openbabel-2.3.1.gem b/openbabel-2.3.1.gem Binary files differdeleted file mode 100644 index 706f164..0000000 --- a/openbabel-2.3.1.gem +++ /dev/null diff --git a/openbabel.gemspec b/openbabel.gemspec index 9409965..2ff4bf3 100644 --- a/openbabel.gemspec +++ b/openbabel.gemspec @@ -1,8 +1,8 @@ Gem::Specification.new do |s| s.name = "openbabel" - s.version = "2.3.1" + s.version = "2.3.1.5" - s.authors = ["Andreas Maunz"] + s.authors = ["Andreas Maunz, Christoph Helma"] s.date = %q{2012-04-03} s.description = %q{OpenBabel as a GEM} s.email = %q{andreas@maunz.de} |