summaryrefslogtreecommitdiff
path: root/ext/lazar
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2015-08-15 14:57:16 +0200
committerChristoph Helma <helma@in-silico.ch>2015-08-15 14:57:16 +0200
commitc26112cbe94689da20688b4924c9025a995310ae (patch)
treebd1e814beaf9ce2f8f349fb80cd0663c21e50c3d /ext/lazar
parent9a5b7b1bfb352b3a6555babe8bc2344414f66185 (diff)
openbabel and fminer installation added
Diffstat (limited to 'ext/lazar')
-rw-r--r--ext/lazar/extconf.rb41
1 files changed, 22 insertions, 19 deletions
diff --git a/ext/lazar/extconf.rb b/ext/lazar/extconf.rb
index 738a85b..c37b40b 100644
--- a/ext/lazar/extconf.rb
+++ b/ext/lazar/extconf.rb
@@ -1,17 +1,16 @@
require 'fileutils'
+require 'rbconfig'
+
main_dir = File.expand_path(File.join(File.dirname(__FILE__),"..",".."))
# install OpenBabel
-require 'mkmf'
-require 'rbconfig'
-require 'openbabel/version'
-openbabel_version = 2.3.2
+openbabel_version = "2.3.2"
openbabel_dir = File.join main_dir, "openbabel"
-src_dir = File.join openbabel_dir, "openbabel-#{openbabel_version}"
-build_dir = File.join openbabel_dir, "build"
+src_dir = openbabel_dir #File.join openbabel_dir, "openbabel-#{openbabel_version}"
+build_dir = File.join src_dir, "build"
install_dir = openbabel_dir
install_lib_dir = File.join install_dir, "lib"
lib_dir = File.join openbabel_dir, "lib", "openbabel"
@@ -23,14 +22,12 @@ rescue
nr_processors = 1
end
-Dir.chdir openbabel_dir do
+#FileUtils.mkdir_p openbabel_dir
+=begin
+Dir.chdir main_dir do
FileUtils.rm_rf src_dir
puts "Downloading OpenBabel sources"
- system "curl -L -d use_mirror=netcologne 'http://downloads.sourceforge.net/project/openbabel/openbabel/#{ob_num_ver}/openbabel-#{ob_num_ver}.tar.gz' | tar xz"
- system "sed -i -e 's/-Wl,-flat_namespace//;s/-flat_namespace//' #{File.join ruby_src_dir, "extconf.rb"}" # remove unrecognized compiler option
- system "sed -i -e 's/Init_OpenBabel/Init_openbabel/g' #{File.join ruby_src_dir,"*cpp"}" # fix swig bindings
- system "sed -i -e 's/Config::CONFIG/RbConfig::CONFIG/' #{File.join src_dir, "scripts", "CMakeLists.txt" }" # fix Ruby Config
- system "sed -i -e 's/Config::CONFIG/RbConfig::CONFIG/' #{File.join ruby_src_dir, "extconf.rb" }" # fix Ruby Config
+ system "git clone https://github.com/openbabel/openbabel.git"
end
FileUtils.mkdir_p build_dir
FileUtils.mkdir_p install_dir
@@ -51,11 +48,13 @@ Dir.chdir build_dir do
system "make install"
ENV["PKG_CONFIG_PATH"] = File.dirname(File.expand_path(Dir["#{install_dir}/**/openbabel*pc"].first))
end
+=end
# 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/,'')
+ob_include= File.expand_path "../../openbabel/include/openbabel-2.0"
+ob_lib= File.expand_path "../../openbabel/lib"
+=begin
# compile ruby bindings
puts "Compiling and installing OpenBabel Ruby bindings."
Dir.chdir ruby_src_dir do
@@ -64,10 +63,11 @@ Dir.chdir ruby_src_dir do
system "#{RbConfig.ruby} extconf.rb --with-openbabel-include=#{ob_include} --with-openbabel-lib=#{ob_lib}"
system "make -j#{nr_processors}"
end
-FileUtils.cp(ruby_src_dir+"/openbabel.#{RbConfig::CONFIG["DLEXT"]}", "./")
-FileUtils.mkdir_p lib_dir
-FileUtils.mv "openbabel.#{RbConfig::CONFIG["DLEXT"]}" lib_dir
-FileUtils.remove_entry_secure src_dir, build_dir
+#FileUtils.cp(ruby_src_dir+"/openbabel.#{RbConfig::CONFIG["DLEXT"]}", "./")
+#FileUtils.mkdir_p lib_dir
+#FileUtils.mv "openbabel.#{RbConfig::CONFIG["DLEXT"]}", lib_dir
+#FileUtils.remove_entry_secure src_dir, build_dir
+=end
# install fminer
fminer_dir = File.join main_dir, "libfminer"
@@ -78,11 +78,14 @@ system "git clone git://github.com/amaunz/fminer2.git #{fminer_dir}"
system "sed -i 's,^INCLUDE_OB.*,INCLUDE_OB\ =\ #{ob_include},g' Makefile"
system "sed -i 's,^LDFLAGS_OB.*,LDFLAGS_OB\ =\ #{ob_lib},g' Makefile"
system "sed -i 's,^INCLUDE_RB.*,INCLUDE_RB\ =\ #{RbConfig::CONFIG['rubyhdrdir']},g' Makefile"
+ # TODO fix in fminer Makefile
+ system "sed -i 's,-g, -g -I #{RbConfig::CONFIG['rubyhdrdir']} -I #{RbConfig::CONFIG['rubyarchhdrdir']} -I,' Makefile" # fix include path (CH)
+ system "sed -i '74s/$(CC)/$(CC) -L/' Makefile" # fix library path (CH)
system "make ruby"
end
# install last-utils
FileUtils.cd main_dir
-"git clone git://github.com/amaunz/last-utils.git"
+system "git clone git://github.com/amaunz/last-utils.git"
# install R packagemain_dir