From 8087c297daa4a16fb85b3fa0d5736594118f637a Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Tue, 21 May 2013 07:24:23 +1900 Subject: [PATCH] [PATCH 1/2] ruby: use in-tree notmuch library --- c5/5979f12cc25c9593ee875ec086029bcca62495 | 113 ++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 c5/5979f12cc25c9593ee875ec086029bcca62495 diff --git a/c5/5979f12cc25c9593ee875ec086029bcca62495 b/c5/5979f12cc25c9593ee875ec086029bcca62495 new file mode 100644 index 000000000..60b6a323a --- /dev/null +++ b/c5/5979f12cc25c9593ee875ec086029bcca62495 @@ -0,0 +1,113 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 0E572431FC2 + for ; Mon, 20 May 2013 05:26:10 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id W2bDspfQdy-e for ; + Mon, 20 May 2013 05:26:02 -0700 (PDT) +Received: from mail-ob0-f171.google.com (mail-ob0-f171.google.com + [209.85.214.171]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id B7F86431FC0 + for ; Mon, 20 May 2013 05:26:02 -0700 (PDT) +Received: by mail-ob0-f171.google.com with SMTP id ef5so6947731obb.2 + for ; Mon, 20 May 2013 05:26:00 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to + :references; bh=PeDYr2ns1fhDb+mYm0+8R2RNCyowSih5RC8fe5LC4TI=; + b=c3F3Z+WzN+y81DeeKiC1ynuVTD6D5CJT7DRhgja/qkht5qrNokcwVIWSCJI5l+NM+q + jJDXOsjlwrLD+ledSbUobcBYn3f4LoNjAyFKGjGuBT7vhkSd29XevzGrO4mYC7235zJk + CMmUTrmlKgl1sLDst22hqDSnWi9Lu2/1aVkVCKvVJTaLmb3yohPc28keSt2G/GMCl0Pp + 1bXrNAtJc2IwjFnRLH4QrDGTBTXZB40sZU56PnyOXUPTfAtYZd2tsdIHTfIm2dO80EIO + XmOSp3o+hF1vRfmpy+6PmVmjuVCOF+ESBE8UFjAvc8DFjgLRVtcSBz22+41lk1igGw43 + /OLw== +X-Received: by 10.60.60.10 with SMTP id d10mr28447630oer.6.1369052760396; + Mon, 20 May 2013 05:26:00 -0700 (PDT) +Received: from localhost (187-163-100-70.static.axtel.net. [187.163.100.70]) + by mx.google.com with ESMTPSA id + yx4sm19918411obb.11.2013.05.20.05.25.58 for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Mon, 20 May 2013 05:25:59 -0700 (PDT) +From: Felipe Contreras +To: notmuch@notmuchmail.org +Subject: [PATCH 1/2] ruby: use in-tree notmuch library +Date: Mon, 20 May 2013 07:24:23 -0500 +Message-Id: <1369052664-17869-2-git-send-email-felipe.contreras@gmail.com> +X-Mailer: git-send-email 1.8.3.rc3.286.g3d43083 +In-Reply-To: <1369052664-17869-1-git-send-email-felipe.contreras@gmail.com> +References: <1369052664-17869-1-git-send-email-felipe.contreras@gmail.com> +Cc: Ali Polatel +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 20 May 2013 12:26:10 -0000 + +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 +--- + 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 + -- 2.26.2