unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: notmuch@notmuchmail.org
Cc: Ali Polatel <alip@exherbo.org>
Subject: [PATCH 1/2] ruby: use in-tree notmuch library
Date: Mon, 20 May 2013 07:24:23 -0500	[thread overview]
Message-ID: <1369052664-17869-2-git-send-email-felipe.contreras@gmail.com> (raw)
In-Reply-To: <1369052664-17869-1-git-send-email-felipe.contreras@gmail.com>

Currently it simply finds any library available, and if notmuch is
installed in the system, it would give priority to that library.

Let's implement our own helper functions to link directly to the local
library, and give priority to the local header file.

Also, add an option to properly check if there are missing symbols.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 bindings/ruby/extconf.rb | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index 7b9750f..ddd4e48 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -5,9 +5,26 @@
 
 require 'mkmf'
 
-# Notmuch Library
-find_header('notmuch.h', '../../lib')
-find_library('notmuch', 'notmuch_database_create', '../../lib')
+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.funcall_style, lib) do
+    lib = File.join(path, lib)
+    if try_func(func, lib, headers)
+      $LOCAL_LIBS += lib
+    end
+  end
+end
+
+if not have_local_library('libnotmuch.so', dir, 'notmuch_database_create', 'notmuch.h')
+  exit 1
+end
 
 # Create Makefile
 dir_config('notmuch')
-- 
1.8.3.rc3.286.g3d43083

  reply	other threads:[~2013-05-20 12:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-20 12:24 [PATCH 0/2] ruby: general improvements Felipe Contreras
2013-05-20 12:24 ` Felipe Contreras [this message]
2013-05-20 14:41   ` [PATCH 1/2] ruby: use in-tree notmuch library David Bremner
2013-05-20 22:24     ` Felipe Contreras
2013-05-23 11:44       ` David Bremner
2013-05-20 12:24 ` [PATCH 2/2] ruby: fix missing symbol UINT2FIX() Felipe Contreras
2013-05-21 14:17   ` Tomi Ollila
2013-05-21 14:46     ` Ali Polatel
2013-05-21 14:59       ` Tomi Ollila

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1369052664-17869-2-git-send-email-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=alip@exherbo.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).