summaryrefslogtreecommitdiff
path: root/ext/lazar/extconf.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2016-03-24 13:43:27 +0100
committerChristoph Helma <helma@in-silico.ch>2016-03-24 13:43:27 +0100
commit90fbe8b3ef3fa05aa308e6650e11d690bb89b200 (patch)
tree524a984f6108188da15f9a25ad31ec314a294f89 /ext/lazar/extconf.rb
parent130524b0efa98f6e63d39c55e2f643130459ceee (diff)
local R package installation
Diffstat (limited to 'ext/lazar/extconf.rb')
-rw-r--r--ext/lazar/extconf.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/ext/lazar/extconf.rb b/ext/lazar/extconf.rb
index a76f0f4..006e24c 100644
--- a/ext/lazar/extconf.rb
+++ b/ext/lazar/extconf.rb
@@ -1,8 +1,24 @@
require 'fileutils'
require 'rbconfig'
+require 'mkmf'
main_dir = File.expand_path(File.join(File.dirname(__FILE__),"..",".."))
+# check for required programs
+programs = ["R","Rscript","mongod","java","getconf"]
+programs.each do |program|
+ abort "Please install #{program} on your system." unless find_executable program
+end
+
+abort "Please install Rserve on your system. Execute 'install.packages('Rserve')' in a R console running as root ('sudo R')." unless `R CMD Rserve --version`.match(/^Rserve/)
+
+# install R packages
+r_dir = File.join main_dir, "R"
+FileUtils.mkdir_p r_dir
+FileUtils.mkdir_p File.join(main_dir,"bin") # for Rserve binary
+rinstall = File.expand_path(File.join(File.dirname(__FILE__),"rinstall.R"))
+puts `Rscript --vanilla #{rinstall} #{r_dir}`
+
# install OpenBabel
openbabel_version = "2.3.2"
@@ -48,7 +64,4 @@ Dir.chdir build_dir do
ENV["PKG_CONFIG_PATH"] = File.dirname(File.expand_path(Dir["#{install_dir}/**/openbabel*pc"].first))
end
-ob_include= File.expand_path File.join(File.dirname(__FILE__),"../../openbabel/include/openbabel-2.0")
-ob_lib= File.expand_path File.join(File.dirname(__FILE__),"../../openbabel/lib")
-
$makefile_created = true