diff options
| author | David Bremner <david@tethera.net> | 2015-12-13 08:39:11 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2015-12-13 08:39:11 -0400 |
| commit | e3cd357fdddd2d8d29e8eea0b40a1043c46f1791 (patch) | |
| tree | b0e4f0549fc1216439e4593b73206c7923995ad4 /bindings/ruby | |
| parent | ad5b7434978ed98b1eb832b77684869f5d02594a (diff) | |
| parent | 1432a4f946e0f236179b53ac71d03764da725f33 (diff) | |
Merge tag 'debian/0.21-3' into jessie-backports
uploaded to unstable
Diffstat (limited to 'bindings/ruby')
| -rw-r--r-- | bindings/ruby/README | 7 | ||||
| -rw-r--r-- | bindings/ruby/extconf.rb | 16 | ||||
| -rw-r--r-- | bindings/ruby/query.c | 38 |
3 files changed, 34 insertions, 27 deletions
diff --git a/bindings/ruby/README b/bindings/ruby/README new file mode 100644 index 00000000..a2946b66 --- /dev/null +++ b/bindings/ruby/README @@ -0,0 +1,7 @@ +To build the the notmuch ruby extension, run the following commands +from the *top level* notmuch source directory: + +% ./configure +% make ruby-bindings + +The generic documentation about building notmuch also applies. diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb index 6160db26..ddaa6841 100644 --- a/bindings/ruby/extconf.rb +++ b/bindings/ruby/extconf.rb @@ -10,22 +10,16 @@ dir = File.join('..', '..', 'lib') # includes $INCFLAGS = "-I#{dir} #{$INCFLAGS}" -# make sure there are no undefined symbols -$LDFLAGS += ' -Wl,--no-undefined' - -def have_local_library(lib, path, func, headers = nil) - checking_for checking_message(func, lib) do - lib = File.join(path, lib) - if try_func(func, lib, headers) - $LOCAL_LIBS += lib - end - end +if ENV['EXTRA_LDFLAGS'] + $LDFLAGS += " " + ENV['EXTRA_LDFLAGS'] end -if not have_local_library('libnotmuch.so', dir, 'notmuch_database_create', 'notmuch.h') +if not ENV['LIBNOTMUCH'] exit 1 end +$LOCAL_LIBS += ENV['LIBNOTMUCH'] + # Create Makefile dir_config('notmuch') create_makefile('notmuch') diff --git a/bindings/ruby/query.c b/bindings/ruby/query.c index a7dacba3..8cbc73f2 100644 --- a/bindings/ruby/query.c +++ b/bindings/ruby/query.c @@ -134,12 +134,13 @@ notmuch_rb_query_search_threads (VALUE self) { notmuch_query_t *query; notmuch_threads_t *threads; + notmuch_status_t status; Data_Get_Notmuch_Query (self, query); - threads = notmuch_query_search_threads (query); - if (!threads) - rb_raise (notmuch_rb_eMemoryError, "Out of memory"); + status = notmuch_query_search_threads_st (query, &threads); + if (status) + notmuch_rb_status_raise (status); return Data_Wrap_Struct (notmuch_rb_cThreads, NULL, NULL, threads); } @@ -154,12 +155,13 @@ notmuch_rb_query_search_messages (VALUE self) { notmuch_query_t *query; notmuch_messages_t *messages; + notmuch_status_t status; Data_Get_Notmuch_Query (self, query); - messages = notmuch_query_search_messages (query); - if (!messages) - rb_raise (notmuch_rb_eMemoryError, "Out of memory"); + status = notmuch_query_search_messages_st (query, &messages); + if (status) + notmuch_rb_status_raise (status); return Data_Wrap_Struct (notmuch_rb_cMessages, NULL, NULL, messages); } @@ -173,14 +175,16 @@ VALUE notmuch_rb_query_count_messages (VALUE self) { notmuch_query_t *query; + notmuch_status_t status; + unsigned int count; Data_Get_Notmuch_Query (self, query); - /* Xapian exceptions are not handled properly. - * (function may return 0 after printing a message) - * Thus there is nothing we can do here... - */ - return UINT2NUM(notmuch_query_count_messages(query)); + status = notmuch_query_count_messages_st (query, &count); + if (status) + notmuch_rb_status_raise (status); + + return UINT2NUM(count); } /* @@ -192,12 +196,14 @@ VALUE notmuch_rb_query_count_threads (VALUE self) { notmuch_query_t *query; + notmuch_status_t status; + unsigned int count; Data_Get_Notmuch_Query (self, query); - /* Xapian exceptions are not handled properly. - * (function may return 0 after printing a message) - * Thus there is nothing we can do here... - */ - return UINT2NUM(notmuch_query_count_threads(query)); + status = notmuch_query_count_threads_st (query, &count); + if (status) + notmuch_rb_status_raise (status); + + return UINT2NUM(count); } |
