[openbabel] Fix several issues related to ruby modules

Mamoru Tasaka mtasaka at fedoraproject.org
Fri Apr 6 02:30:25 UTC 2012


commit f7d6da13e38160fc16f4cf716d124e48adfad57c
Author: TASAKA Mamoru <mtasaka at localhost.localdomain>
Date:   Fri Apr 6 11:30:21 2012 +0900

    Fix several issues related to ruby modules
    
     - Fix build with gcc47 (on Linux)
     - Fix SWIG_init even when not using swig (#772149)
     - Use vendorarchdir instead of sitearch on F-17+
     - Fix ruby(abi) requirement

 openbabel-2.3.1-gcc47-darwin.patch      |   25 +++++++++++++++++++++++++
 openbabel-2.3.1-noswig-rubymethod.patch |   18 ++++++++++++++++++
 openbabel-2.3.1-ruby19-vendorarch.patch |   13 +++++++++++++
 openbabel.spec                          |   29 ++++++++++++++++++++++++++++-
 4 files changed, 84 insertions(+), 1 deletions(-)
---
diff --git a/openbabel-2.3.1-gcc47-darwin.patch b/openbabel-2.3.1-gcc47-darwin.patch
new file mode 100644
index 0000000..7f9bd47
--- /dev/null
+++ b/openbabel-2.3.1-gcc47-darwin.patch
@@ -0,0 +1,25 @@
+--- openbabel-2.3.1/scripts/ruby/extconf.rb.gcc47	2011-01-11 23:53:32.000000000 +0900
++++ openbabel-2.3.1/scripts/ruby/extconf.rb	2012-04-05 14:15:14.286842274 +0900
+@@ -3,11 +3,13 @@
+ # Compensate for the fact that Ruby will try to build universal
+ # binaries on OS X by default
+ require 'rbconfig'
++darwin_ldflags = ""
+ if Config::CONFIG["arch"] =~ /universal-darwin/
+   ENV['ARCHFLAGS'] = case `uname -smr`.chomp
+     when "i386" then '-arch i386'
+     when "ppc"  then '-arch ppc'
+   end
++  darwin_ldflags = "-flat_namespace"
+ end
+ 
+ require 'mkmf'
+@@ -36,7 +38,7 @@
+ end
+ 
+ if have_library('openbabel')
+-  with_ldflags("#$LDFLAGS -dynamic -flat_namespace") do #Enables cc to handle linking better.
++  with_ldflags("#$LDFLAGS -dynamic #$darwin_ldflags") do #Enables cc to handle linking better.
+   create_makefile('openbabel')
+ end
+ else
diff --git a/openbabel-2.3.1-noswig-rubymethod.patch b/openbabel-2.3.1-noswig-rubymethod.patch
new file mode 100644
index 0000000..de4b9cd
--- /dev/null
+++ b/openbabel-2.3.1-noswig-rubymethod.patch
@@ -0,0 +1,18 @@
+--- openbabel-2.3.1/scripts/CMakeLists.txt.noswig_ruby	2012-04-05 22:15:22.000000000 +0900
++++ openbabel-2.3.1/scripts/CMakeLists.txt	2012-04-06 00:09:36.000000000 +0900
+@@ -290,9 +290,14 @@
+       set(WORKAROUND_CMAKE260_BUG "s/rb_define_module(\"Openbabel\")/rb_define_module(\"OpenBabel\")/")
+       add_custom_command(OUTPUT ${openbabel_SOURCE_DIR}/scripts/ruby/openbabel-ruby.cpp
+           COMMAND ${SWIG_EXECUTABLE} -ruby -c++ -small -O -templatereduce -naturalvar -autorename -I${openbabel_SOURCE_DIR}/include -I${openbabel_BINARY_DIR}/include -o ${openbabel_SOURCE_DIR}/scripts/ruby/openbabel-ruby.txt ${openbabel_SOURCE_DIR}/scripts/openbabel-ruby.i
+-          COMMAND sed -e '${WORKAROUND_CMAKE_260_BUG}' -e's/void Init_OpenBabel/void Init_openbabel/' <${openbabel_SOURCE_DIR}/scripts/ruby/openbabel-ruby.txt >${openbabel_SOURCE_DIR}/scripts/ruby/openbabel-ruby.cpp 
++          COMMAND sed -e '${WORKAROUND_CMAKE260_BUG}' -e's/void Init_OpenBabel/void Init_openbabel/' <${openbabel_SOURCE_DIR}/scripts/ruby/openbabel-ruby.txt >${openbabel_SOURCE_DIR}/scripts/ruby/openbabel-ruby.cpp 
+           MAIN_DEPENDENCY openbabel-ruby.i
+       )
++    else (RUN_SWIG)
++        # Fix openbabel-ruby.cpp also in this case 
++      execute_process(
++          COMMAND sed -i -e s/void\ Init_OpenBabel/void\ Init_openbabel/ ${openbabel_SOURCE_DIR}/scripts/ruby/openbabel-ruby.cpp 
++      )
+     endif (RUN_SWIG)
+ 
+     include_directories(
diff --git a/openbabel-2.3.1-ruby19-vendorarch.patch b/openbabel-2.3.1-ruby19-vendorarch.patch
new file mode 100644
index 0000000..a87ef03
--- /dev/null
+++ b/openbabel-2.3.1-ruby19-vendorarch.patch
@@ -0,0 +1,13 @@
+--- openbabel-2.3.1/scripts/CMakeLists.txt.ruby19	2012-04-06 00:09:36.000000000 +0900
++++ openbabel-2.3.1/scripts/CMakeLists.txt	2012-04-06 01:03:29.000000000 +0900
+@@ -324,6 +324,10 @@
+       endif (RUBY_PREFIX)
+       add_custom_target(bindings_ruby ALL
+         COMMAND ${RUBY_EXECUTABLE} ${openbabel_SOURCE_DIR}/scripts/ruby/extconf.rb --with-openbabel-lib=${openbabel_BINARY_DIR}/lib${LIB_SUFFIX} --with-openbabel-include=${openbabel_BINARY_DIR}/include
++
++        # As same as rubygems does
++        COMMAND sed -i -e \"\\@^RUBYARCHDIR at s|sitearchdir|vendorarchdir|\" ${openbabel_SOURCE_DIR}/scripts/ruby/Makefile
++
+         COMMAND ${CMAKE_COMMAND} -E echo "Compiling Ruby bindings"
+         COMMAND make
+         DEPENDS ${openbabel_SOURCE_DIR}/scripts/ruby/openbabel-ruby.cpp
diff --git a/openbabel.spec b/openbabel.spec
index 619ca97..cfa3483 100644
--- a/openbabel.spec
+++ b/openbabel.spec
@@ -10,7 +10,7 @@
 
 Name: openbabel
 Version: 2.3.1
-Release: 3%{beta_ver}%{?dist}
+Release: 4%{beta_ver}%{?dist}
 Summary: Chemistry software file format converter
 License: GPLv2
 Group: Applications/File
@@ -20,6 +20,13 @@ Source1: obgui.desktop
 Patch1: %{name}-rpm.patch
 # fix plugin directory location (#680292, patch by lg)
 Patch4: openbabel-2.3.0-plugindir.patch
+# Patch 5-7: all ruby related
+# fix build with gcc47 + ruby on Linux
+Patch5: openbabel-2.3.1-gcc47-darwin.patch
+# fix SWIG_init even when not using swig (#772149)
+Patch6: openbabel-2.3.1-noswig-rubymethod.patch
+# On F-17, directory for C ruby files changed to use vendorarch directory
+Patch7: openbabel-2.3.1-ruby19-vendorarch.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: cmake
 BuildRequires: desktop-file-utils
@@ -114,7 +121,11 @@ Python wrapper for the Open Babel library.
 %package -n ruby-%{name}
 Summary: Ruby wrapper for the Open Babel library
 Group: Development/Libraries
+%if 0%{?fedora} >= 17
+Requires: ruby(abi) = 1.9.1
+%else
 Requires: ruby(abi) = 1.8
+%endif
 Requires: %{name} = %{version}-%{release}
 
 %description -n ruby-%{name}
@@ -124,6 +135,11 @@ Ruby wrapper for the Open Babel library.
 %setup -q -n %{name}-%{version}%{beta_dir}
 %patch1 -p1 -b .r
 %patch4 -p1 -b .plugindir
+%patch5 -p1 -b .gcc47
+%patch6 -p1 -b .noswig_ruby
+%if 0%{?fedora} >= 17
+%patch7 -p1 -b .ruby_vendor
+%endif
 chmod 644 src/formats/{fchk,genbank,mmcif}format.cpp
 chmod 644 src/math/align.cpp
 chmod 644 include/openbabel/{graphsym.h,math/align.h}
@@ -209,9 +225,20 @@ install -Dpm644 babel.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/ba
 
 %files -n ruby-%{name}
 %defattr(-, root, root, -)
+%if 0%{?fedora} >= 17
+%{ruby_vendorarchdir}/openbabel.so
+%else
 %{ruby_sitearch}/openbabel.so
+%endif
 
 %changelog
+* Fri Apr  6 2012 Mamoru Tasaka <mtasaka at fedoraproject.org> - 2.3.1-4
+- Fix several issues related to ruby modules
+ - Fix build with gcc47 (on Linux)
+ - Fix SWIG_init even when not using swig (#772149)
+ - Use vendorarchdir instead of sitearch on F-17+
+ - Fix ruby(abi) requirement
+
 * Tue Feb 28 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.3.1-3
 - Rebuilt for c++ ABI breakage
 


More information about the scm-commits mailing list