From 989f20ae58c3ecb0ce62bc4468c3dab2599637b3 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Mon, 14 Mar 2016 10:38:37 +0100 Subject: getconf for number of cores --- ext/lazar/extconf.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/lazar/extconf.rb') diff --git a/ext/lazar/extconf.rb b/ext/lazar/extconf.rb index f466afb..edb960a 100644 --- a/ext/lazar/extconf.rb +++ b/ext/lazar/extconf.rb @@ -17,7 +17,7 @@ lib_dir = File.join openbabel_dir, "lib", "openbabel" ruby_src_dir = File.join src_dir, "scripts", "ruby" begin - nr_processors = `grep processor /proc/cpuinfo | wc -l` # speed up compilation, Linux only + nr_processors = `getconf _NPROCESSORS_ONLN`.to_i # should be POSIX compatible rescue nr_processors = 1 end -- cgit v1.2.3 From 0c5d2e678908a2d4aea43efbedbedc2c0439be30 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Mon, 14 Mar 2016 15:25:50 +0100 Subject: descriptor tests --- ext/lazar/extconf.rb | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) (limited to 'ext/lazar/extconf.rb') diff --git a/ext/lazar/extconf.rb b/ext/lazar/extconf.rb index edb960a..a76f0f4 100644 --- a/ext/lazar/extconf.rb +++ b/ext/lazar/extconf.rb @@ -5,11 +5,10 @@ main_dir = File.expand_path(File.join(File.dirname(__FILE__),"..","..")) # install OpenBabel - openbabel_version = "2.3.2" openbabel_dir = File.join main_dir, "openbabel" -src_dir = openbabel_dir #File.join openbabel_dir, "openbabel-#{openbabel_version}" +src_dir = openbabel_dir build_dir = File.join src_dir, "build" install_dir = openbabel_dir install_lib_dir = File.join install_dir, "lib" @@ -52,37 +51,4 @@ 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") -# compile ruby bindings -=begin -puts "Compiling and installing OpenBabel Ruby bindings." -Dir.chdir ruby_src_dir do - # fix rpath - system "sed -i 's|with_ldflags.*$|with_ldflags(\"#\$LDFLAGS -dynamic -Wl,-rpath,#{install_lib_dir}\") do|' #{File.join(ruby_src_dir,'extconf.rb')}" - system "#{RbConfig.ruby} extconf.rb --with-openbabel-include=#{ob_include} --with-openbabel-lib=#{ob_lib}" - system "make -j#{nr_processors}" -end -=end - -# install fminer -fminer_dir = File.join main_dir, "libfminer" -system "git clone git://github.com/amaunz/fminer2.git #{fminer_dir}" - -["libbbrc","liblast"].each do |lib| - FileUtils.cd File.join(fminer_dir,lib) - 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) -Wl,-rpath,#{ob_lib.gsub('/','\/')} -L/' Makefile" # fix library path (CH) - system "make ruby" -end - -# install last-utils -FileUtils.cd main_dir -system "git clone git://github.com/amaunz/last-utils.git" -FileUtils.cd File.join(main_dir,"last-utils") -`sed -i '8s/"openbabel", //' lu.rb` - -# install R packagemain_dir $makefile_created = true -- cgit v1.2.3 From 90fbe8b3ef3fa05aa308e6650e11d690bb89b200 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Thu, 24 Mar 2016 13:43:27 +0100 Subject: local R package installation --- ext/lazar/extconf.rb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'ext/lazar/extconf.rb') 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 -- cgit v1.2.3 From 76d30230f589026d7019ddbfa8ae0a511e171e27 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Thu, 31 Mar 2016 10:04:42 +0200 Subject: lazar gem, version bumped to 0.9 --- ext/lazar/extconf.rb | 46 +++------------------------------------------- 1 file changed, 3 insertions(+), 43 deletions(-) (limited to 'ext/lazar/extconf.rb') diff --git a/ext/lazar/extconf.rb b/ext/lazar/extconf.rb index 006e24c..a577baa 100644 --- a/ext/lazar/extconf.rb +++ b/ext/lazar/extconf.rb @@ -19,49 +19,9 @@ 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" - -openbabel_dir = File.join main_dir, "openbabel" -src_dir = openbabel_dir -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" -ruby_src_dir = File.join src_dir, "scripts", "ruby" - -begin - nr_processors = `getconf _NPROCESSORS_ONLN`.to_i # should be POSIX compatible -rescue - nr_processors = 1 -end - -FileUtils.mkdir_p openbabel_dir -Dir.chdir main_dir do - FileUtils.rm_rf src_dir - puts "Downloading OpenBabel sources" - system "git clone https://github.com/openbabel/openbabel.git" -end - -FileUtils.mkdir_p build_dir -FileUtils.mkdir_p install_dir -Dir.chdir build_dir do - puts "Configuring OpenBabel" - cmake = "cmake #{src_dir} -DCMAKE_INSTALL_PREFIX=#{install_dir} -DBUILD_GUI=OFF -DENABLE_TESTS=OFF -DRUN_SWIG=ON -DRUBY_BINDINGS=ON" - # set rpath for local installations - # http://www.cmake.org/Wiki/CMake_RPATH_handling - # http://vtk.1045678.n5.nabble.com/How-to-force-cmake-not-to-remove-install-rpath-td5721193.html - cmake += " -DCMAKE_INSTALL_RPATH:STRING=\"#{install_lib_dir}\"" - system cmake -end - -# local installation in gem directory -Dir.chdir build_dir do - puts "Compiling OpenBabel sources." - system "make -j#{nr_processors}" - system "make install" - ENV["PKG_CONFIG_PATH"] = File.dirname(File.expand_path(Dir["#{install_dir}/**/openbabel*pc"].first)) +# create a fake Makefile +File.open(File.join(File.dirname(__FILE__),"Makefile"),"w+") do |makefile| + makefile.puts "all:\n\ttrue\n\ninstall:\n\ttrue\n" end $makefile_created = true -- cgit v1.2.3 From 243bb8d0289ffaba8891e35c12bca20f3bd6f5bc Mon Sep 17 00:00:00 2001 From: gebele Date: Mon, 4 Apr 2016 13:53:08 +0200 Subject: avoid rserve check at this point --- ext/lazar/extconf.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/lazar/extconf.rb') diff --git a/ext/lazar/extconf.rb b/ext/lazar/extconf.rb index a577baa..49d7506 100644 --- a/ext/lazar/extconf.rb +++ b/ext/lazar/extconf.rb @@ -10,7 +10,7 @@ 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/) +#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" -- cgit v1.2.3 From 73fabfa998e62fb1d5b5800c8655a6ea143488bd Mon Sep 17 00:00:00 2001 From: gebele Date: Mon, 4 Apr 2016 15:41:25 +0200 Subject: last commit doesnt work this way --- ext/lazar/extconf.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ext/lazar/extconf.rb') diff --git a/ext/lazar/extconf.rb b/ext/lazar/extconf.rb index 49d7506..a577baa 100644 --- a/ext/lazar/extconf.rb +++ b/ext/lazar/extconf.rb @@ -10,7 +10,7 @@ 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/) +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" -- cgit v1.2.3 From 024c08f3adaa384577fdc6fd2fe9de71beea5814 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Thu, 7 Apr 2016 17:54:46 +0200 Subject: check if R packages are correctly installed --- ext/lazar/extconf.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ext/lazar/extconf.rb') diff --git a/ext/lazar/extconf.rb b/ext/lazar/extconf.rb index a577baa..0e607f3 100644 --- a/ext/lazar/extconf.rb +++ b/ext/lazar/extconf.rb @@ -19,6 +19,9 @@ 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}` +r_libs = Dir[File.join(r_dir,"*")].collect{|l| l.sub(r_dir, '').sub('/','')}.sort +abort "Failed to install R packages." unless r_libs == ["caret","doMC","foreach","ggplot2","gridExtra","iterators","pls"].sort + # create a fake Makefile File.open(File.join(File.dirname(__FILE__),"Makefile"),"w+") do |makefile| makefile.puts "all:\n\ttrue\n\ninstall:\n\ttrue\n" -- cgit v1.2.3 From 8a269511605d11443afd24caaa944bcffe87827e Mon Sep 17 00:00:00 2001 From: gebele Date: Mon, 11 Apr 2016 13:33:22 +0200 Subject: fixed check check for R packages --- ext/lazar/extconf.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ext/lazar/extconf.rb') diff --git a/ext/lazar/extconf.rb b/ext/lazar/extconf.rb index 0e607f3..d3d2756 100644 --- a/ext/lazar/extconf.rb +++ b/ext/lazar/extconf.rb @@ -20,7 +20,9 @@ rinstall = File.expand_path(File.join(File.dirname(__FILE__),"rinstall.R")) puts `Rscript --vanilla #{rinstall} #{r_dir}` r_libs = Dir[File.join(r_dir,"*")].collect{|l| l.sub(r_dir, '').sub('/','')}.sort -abort "Failed to install R packages." unless r_libs == ["caret","doMC","foreach","ggplot2","gridExtra","iterators","pls"].sort +["caret","doMC","foreach","ggplot2","gridExtra","iterators","pls"].each do |lib| + abort "Failed to install R package '#{lib}'." unless r_libs.include?(lib) +end # create a fake Makefile File.open(File.join(File.dirname(__FILE__),"Makefile"),"w+") do |makefile| -- cgit v1.2.3