openbabel-heroku 2.3.2.0 → 2.3.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/openbabel/extconf.rb +7 -75
- data/lib/openbabel.rb +4 -1
- data/lib/openbabel/version.rb +1 -1
- metadata +7 -6
data/ext/openbabel/extconf.rb
CHANGED
@@ -10,84 +10,16 @@ ob_ver = "openbabel-"+ob_num_ver
|
|
10
10
|
RUBY=File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
|
11
11
|
|
12
12
|
main_dir = File.expand_path(File.join(File.dirname(__FILE__),"..",".."))
|
13
|
-
|
14
|
-
|
15
|
-
install_dir =
|
13
|
+
ext_dir = File.join main_dir, "ext/openbabel"
|
14
|
+
|
15
|
+
install_dir = "~/vendor/openbabel"
|
16
16
|
install_lib_dir = File.join install_dir, "lib"
|
17
|
-
lib_dir = File.join main_dir, "lib", "openbabel"
|
18
|
-
ruby_src_dir = File.join src_dir, "scripts", "ruby"
|
19
|
-
cmake_dir = File.join main_dir, "cmake-2.8.11.2"
|
20
17
|
|
21
|
-
begin
|
22
|
-
nr_processors = `grep processor /proc/cpuinfo | wc -l` # speed up compilation, Linux only
|
23
|
-
rescue
|
24
|
-
nr_processors = 1
|
25
|
-
end
|
26
18
|
|
27
19
|
begin
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
Dir.chdir cmake_dir do
|
33
|
-
system "./bootstrap"
|
34
|
-
system "make"
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
Dir.chdir main_dir do
|
40
|
-
puts "Downloading OpenBabel sources"
|
41
|
-
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"
|
42
|
-
system "sed -i -e 's/-Wl,-flat_namespace//;s/-flat_namespace//' #{File.join ruby_src_dir, "extconf.rb"}" # remove unrecognized compiler option
|
43
|
-
system "sed -i -e 's/Init_OpenBabel/Init_openbabel/g' #{File.join ruby_src_dir,"*cpp"}" # fix swig bindings
|
44
|
-
end
|
45
|
-
FileUtils.mkdir_p build_dir
|
46
|
-
FileUtils.mkdir_p install_dir
|
47
|
-
Dir.chdir build_dir do
|
48
|
-
puts "Configuring OpenBabel"
|
49
|
-
|
50
|
-
|
51
|
-
cmake = "#{cmake_dir}/bin/cmake #{src_dir} -DCMAKE_INSTALL_PREFIX=#{install_dir} -DBUILD_GUI=OFF -DENABLE_TESTS=OFF -DRUBY_BINDINGS=ON"
|
52
|
-
# set rpath for local installations
|
53
|
-
# http://www.cmake.org/Wiki/CMake_RPATH_handling
|
54
|
-
# http://vtk.1045678.n5.nabble.com/How-to-force-cmake-not-to-remove-install-rpath-td5721193.html
|
55
|
-
cmake += " -DCMAKE_INSTALL_RPATH:STRING=\"#{install_lib_dir}\"" unless have_library('openbabel')
|
56
|
-
system cmake
|
57
|
-
end
|
58
|
-
unless have_library('openbabel')
|
59
|
-
# local installation in gem directory
|
60
|
-
Dir.chdir build_dir do
|
61
|
-
puts "OpenBabel not installed. Compiling sources."
|
62
|
-
system "make -j#{nr_processors}"
|
63
|
-
system "make install"
|
64
|
-
ENV["PKG_CONFIG_PATH"] = File.dirname(File.expand_path(Dir["#{install_dir}/**/openbabel*pc"].first))
|
65
|
-
end
|
66
|
-
end
|
67
|
-
# compile ruby bindings
|
68
|
-
puts "Compiling and installing OpenBabel Ruby bindings."
|
69
|
-
Dir.chdir ruby_src_dir do
|
70
|
-
# fix rpath
|
71
|
-
system "sed -i 's|with_ldflags.*$|with_ldflags(\"#\$LDFLAGS -dynamic -Wl,-rpath,#{install_lib_dir}\") do|' #{File.join(ruby_src_dir,'extconf.rb')}" unless have_library('openbabel')
|
72
|
-
# get include and lib from pkg-config
|
73
|
-
ob_include=`pkg-config openbabel-2.0 --cflags-only-I`.sub(/\s+/,'').sub(/-I/,'')
|
74
|
-
ob_lib=`pkg-config openbabel-2.0 --libs-only-L`.sub(/\s+/,'').sub(/-L/,'')
|
75
|
-
system "#{RUBY} extconf.rb --with-openbabel-include=#{ob_include} --with-openbabel-lib=#{ob_lib}"
|
76
|
-
system "make -j#{nr_processors}"
|
77
|
-
end
|
78
|
-
FileUtils.cp(ruby_src_dir+"/openbabel.#{RbConfig::CONFIG["DLEXT"]}", "./")
|
79
|
-
File.open('Makefile', 'w') do |makefile|
|
80
|
-
makefile.write <<"EOF"
|
81
|
-
.PHONY: openbabel.#{RbConfig::CONFIG["DLEXT"]}
|
82
|
-
openbabel.#{RbConfig::CONFIG["DLEXT"]}:
|
83
|
-
chmod 755 openbabel.#{RbConfig::CONFIG["DLEXT"]}
|
20
|
+
|
21
|
+
system "export LD_LIBRARY_PATH=~/vendor/openbabel/lib:$LD_LIBRARY_PATH"
|
22
|
+
|
23
|
+
create_makefile "openbabel"
|
84
24
|
|
85
|
-
.PHONY: install
|
86
|
-
install:
|
87
|
-
mkdir -p #{lib_dir}
|
88
|
-
mv openbabel.#{RbConfig::CONFIG["DLEXT"]} #{lib_dir}
|
89
|
-
EOF
|
90
|
-
end
|
91
|
-
ensure
|
92
|
-
FileUtils.remove_entry_secure src_dir, build_dir
|
93
25
|
end
|
data/lib/openbabel.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
|
1
|
+
# system "export LD_LIBRARY_PATH=~/vendor/openbabel/lib:$LD_LIBRARY_PATH"
|
2
|
+
|
3
|
+
require '/app/vendor/openbabel/lib/openbabel'
|
2
4
|
require 'openbabel/version'
|
3
5
|
# http://sourceforge.net/mailarchive/message.php?msg_id=31065700
|
4
6
|
OpenBabel::OBConversion.new # required to load plugins
|
7
|
+
|
data/lib/openbabel/version.rb
CHANGED
metadata
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openbabel-heroku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.2.
|
4
|
+
version: 2.3.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
- Dominic
|
8
|
+
- Dominic Luetjohann
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-10-06 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description: OpenBabel as a GEM
|
15
|
-
email:
|
14
|
+
description: OpenBabel as a GEM for heroku
|
15
|
+
email:
|
16
|
+
- dominic@luetjohann.com
|
16
17
|
executables: []
|
17
18
|
extensions:
|
18
19
|
- ext/openbabel/extconf.rb
|
@@ -23,7 +24,7 @@ files:
|
|
23
24
|
- lib/openbabel/version.rb
|
24
25
|
- test/test_openbabel.rb
|
25
26
|
- ext/openbabel/extconf.rb
|
26
|
-
homepage: http://github.com/
|
27
|
+
homepage: http://github.com/Cominch/openbabel-heroku-gem
|
27
28
|
licenses:
|
28
29
|
- GPL-3
|
29
30
|
post_install_message:
|