[PATCH] ruby: allow bindings to compile on Mac OS X

Ludovic LANGE ll-notmuchmail at lange.nom.fr
Sun Nov 16 12:48:26 PST 2014


On OS X, the library ends with .dylib (instead of .so). I also added
the .dll handling in any case.
Also, the flags '-Wl,--no-undefined' seems not accepted, so I excluded
them on OS X (only)
---
 bindings/ruby/extconf.rb | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index 6160db2..f9a7159 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -11,7 +11,9 @@ dir = File.join('..', '..', 'lib')
 $INCFLAGS = "-I#{dir} #{$INCFLAGS}"
 
 # make sure there are no undefined symbols
-$LDFLAGS += ' -Wl,--no-undefined'
+if CONFIG["arch"] !~ /darwin/
+  $LDFLAGS += " -Wl,--no-undefined"
+end
 
 def have_local_library(lib, path, func, headers = nil)
   checking_for checking_message(func, lib) do
@@ -22,9 +24,9 @@ def have_local_library(lib, path, func, headers = nil)
   end
 end
 
-if not have_local_library('libnotmuch.so', dir, 'notmuch_database_create', 'notmuch.h')
-  exit 1
-end
+['so', 'dylib', 'dll'].detect(lambda { print "Local library notmuch seems absent\n"; exit }) { |ext|
+	have_local_library("libnotmuch.#{ext}", dir, 'notmuch_database_create', 'notmuch.h')
+}
 
 # Create Makefile
 dir_config('notmuch')
-- 
1.8.0



More information about the notmuch mailing list