Hello All,
The following patch against Open Babel 2.3.0 bypasses the mkmf-generated
makefile for installation of the Ruby bindings. It substitutes a CMake
install(FILES ...) stanza, along with a bit of setup. The choice of files to
install (only one, actually) and permissions is based on what the mkmf Makefile
does. The install location is determined based on RUBY_PREFIX and
CMAKE_INSTALL_DIR, as described in the installation docs (and contrary to what
the build system actually does in vanilla 2.3.0). This also provides DESTDIR
support implicitly.
I tested the changes on CentOS 5.5.
====
diff -Naur openbabel-2.3.0/scripts/CMakeLists.txt
openbabel-2.3.0-mod/scripts/CMakeLists.txt
--- openbabel-2.3.0/scripts/CMakeLists.txt 2011-01-11 12:12:22.000000000
-0600
+++ openbabel-2.3.0-mod/scripts/CMakeLists.txt 2011-01-11 12:06:03.000000000
-0600
@@ -290,14 +290,20 @@
)
add_dependencies(bindings_ruby pre_bindings_ruby)
if (RUBY_PREFIX)
- install(CODE "execute_process(COMMAND DESTDIR=${RUBY_PREFIX} make
install WORKING_DIRECTORY ${openbabel_BINARY_DIR}/scripts/ruby)")
+ # It is reasonably safe to assume that RUBY_POSSIBLE_LIB_DIR contains
+ # no regex metacharacters except possibly '.':
+ string(REGEX REPLACE ^${RUBY_POSSIBLE_LIB_DIR}/ruby ${RUBY_PREFIX}
ruby_install_dir "${RUBY_SITEARCH_DIR}")
else (RUBY_PREFIX)
- if (${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local")
- install(CODE "execute_process(COMMAND make install WORKING_DIRECTORY
${openbabel_BINARY_DIR}/scripts/ruby)")
- else (${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local")
- install(CODE "execute_process(COMMAND
DESTDIR=${CMAKE_INSTALL_PREFIX} make install WORKING_DIRECTORY
${openbabel_BINARY_DIR}/scripts/ruby)")
- endif (${CMAKE_INSTALL_PREFIX} STREQUAL "/usr/local")
+ execute_process(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print
Config::CONFIG['exec_prefix']"
+ OUTPUT_VARIABLE ruby_exec_prefix)
+ # It is reasonably safe to assume that ruby_exec_prefix contains no
+ # regex metacharacters except possibly '.':
+ string(REGEX REPLACE ^${ruby_exec_prefix} ${CMAKE_INSTALL_PREFIX}
ruby_install_dir "${RUBY_SITEARCH_DIR}")
endif (RUBY_PREFIX)
+ set(ruby_install_dir ${ruby_install_dir}
+ CACHE PATH "The directory where the Ruby bindings will be installed")
+ install(FILES ruby/openbabel.so DESTINATION ${ruby_install_dir}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
else(NOT MSVC)
add_library(bindings_ruby MODULE
${openbabel_SOURCE_DIR}/scripts/ruby/openbabel-ruby.cpp)
target_link_libraries(bindings_ruby ${RUBY_LIBRARY} ${BABEL_LIBRARY})
====
I hope this is acceptable.
Cheers,
John
--
John C. Bollinger, Ph.D.
Department of Structural Biology
St. Jude Children's Research Hospital
Email Disclaimer: www.stjude.org/emaildisclaimer
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
OpenBabel-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-devel