From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1A38A431FD0 for ; Fri, 23 May 2014 03:45:55 -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 gf7BtOAXzUkf for ; Fri, 23 May 2014 03:45:51 -0700 (PDT) Received: from mail-ob0-f170.google.com (mail-ob0-f170.google.com [209.85.214.170]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 24939431FC4 for ; Fri, 23 May 2014 03:45:50 -0700 (PDT) Received: by mail-ob0-f170.google.com with SMTP id uy5so5156871obc.15 for ; Fri, 23 May 2014 03:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YOeG9VXKwV0EKaXSe98Kd+vL9DXgloEni278dpjGgzE=; b=ynrtrAdU+HeILdItPO4trNHuu/d7UIYqeErtk55lUeI464OnUA1helwq70c7oPsxnT BmJbs4CC9PUgTnJN309hef3xSircUDXY36sWUWTkC5YirQPcMYjRILAqgWsj4S62i7mE OVVF5kCVDw+362Q0MmUoJNxWBYXrjZhI17mHIDT/x3+6H5kpBIcf/XkCYTYlaQmlfZCR VvFFVshwKdjjhyUGDJDC/Nkc1X+l/Qaabzm7ojefJae0Ay+K4rZuptPw++skD6zwRAUn hvhA/s6qrBvldg6btPa9UEOT1sD6kYzmsJmqjirupVPUQpgCUVTpq0uorfzfRwVoEngw TGAg== X-Received: by 10.60.92.170 with SMTP id cn10mr1991765oeb.76.1400841949764; Fri, 23 May 2014 03:45:49 -0700 (PDT) Received: from localhost (189-211-224-40.static.axtel.net. [189.211.224.40]) by mx.google.com with ESMTPSA id zv18sm4857197obb.27.2014.05.23.03.45.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 May 2014 03:45:49 -0700 (PDT) From: Felipe Contreras To: notmuch@notmuchmail.org Subject: [PATCH 2/3] build: add support to build Ruby bindings Date: Fri, 23 May 2014 05:34:26 -0500 Message-Id: <1400841267-12807-3-git-send-email-felipe.contreras@gmail.com> X-Mailer: git-send-email 1.9.3+fc1~5~gfaddd51 In-Reply-To: <1400841267-12807-1-git-send-email-felipe.contreras@gmail.com> References: <1400841267-12807-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: Fri, 23 May 2014 10:45:55 -0000 So there's no need for the user to manually do that. Signed-off-by: Felipe Contreras --- bindings/ruby/Makefile.local | 21 +++++++++++++++++++++ bindings/ruby/extconf.rb | 14 ++------------ configure | 21 +++++++++++++++++++++ 3 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 bindings/ruby/Makefile.local diff --git a/bindings/ruby/Makefile.local b/bindings/ruby/Makefile.local new file mode 100644 index 0000000..8b1837c --- /dev/null +++ b/bindings/ruby/Makefile.local @@ -0,0 +1,21 @@ +dir := bindings/ruby + +ifeq ($(WITH_RUBY),1) +all: $(dir)/notmuch.so +install: install-ruby +clean: clean-ruby +endif + +$(dir)/Makefile: $(dir)/extconf.rb + @ruby -C $(dir) extconf.rb --vendor + +$(dir)/notmuch.so: | $(dir)/Makefile lib/libnotmuch.so + @$(MAKE) -C $(dir) notmuch.so + +install-ruby: | $(dir)/Makefile + @$(MAKE) -C $(dir) install prefix=$(DESTDIR)/$(prefix) + +clean-ruby: | $(dir)/Makefile + $(MAKE) -C $(dir) clean + +.PHONY: install-ruby diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb index 6160db2..abd67fc 100644 --- a/bindings/ruby/extconf.rb +++ b/bindings/ruby/extconf.rb @@ -13,18 +13,8 @@ $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 -end - -if not have_local_library('libnotmuch.so', dir, 'notmuch_database_create', 'notmuch.h') - exit 1 -end +# library +$LOCAL_LIBS += "#{dir}/libnotmuch.so" # Create Makefile dir_config('notmuch') diff --git a/configure b/configure index 9bde2eb..3bdf6d7 100755 --- a/configure +++ b/configure @@ -21,6 +21,7 @@ srcdir=$(dirname "$0") subdirs="util compat lib parse-time-string completion doc emacs" subdirs="${subdirs} performance-test test test/test-databases" +subdirs="${subdirs} bindings/ruby" # For a non-srcdir configure invocation (such as ../configure), create # the directory structure and copy Makefiles. @@ -65,6 +66,7 @@ LIBDIR= WITH_EMACS=1 WITH_BASH=1 WITH_ZSH=1 +WITH_RUBY=1 # Compatible GMime versions (with constraints). # If using GMime 2.6, we need to have a version >= 2.6.5 to avoid a @@ -212,6 +214,14 @@ for option; do elif [ "${option#*=}" = '2.6' ]; then WITH_GMIME_VERSIONS=$GMIME_26_VERSION fi + elif [ "${option%%=*}" = '--with-ruby' ]; then + if [ "${option#*=}" = 'no' ]; then + WITH_RUBY=0 + else + WITH_RUBY=1 + fi + elif [ "${option}" = '--without-ruby' ] ; then + WITH_RUBY=0 elif [ "${option%%=*}" = '--build' ] ; then true elif [ "${option%%=*}" = '--host' ] ; then @@ -383,6 +393,14 @@ else WITH_BASH=0 fi +printf "Checking for ruby... " +if pkg-config --exists ruby-2.1; then + printf "Yes.\n" +else + printf "No (will not install Ruby bindings).\n" + WITH_RUBY=0 +fi + if [ -z "${EMACSLISPDIR}" ]; then if pkg-config --exists emacs; then EMACSLISPDIR=$(pkg-config emacs --variable sitepkglispdir) @@ -906,6 +924,9 @@ WITH_BASH = ${WITH_BASH} # Support for zsh completion WITH_ZSH = ${WITH_ZSH} +# Support for Ruby +WITH_RUBY = ${WITH_RUBY} + # Combined flags for compiling and linking against all of the above CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\ -DHAVE_CANONICALIZE_FILE_NAME=\$(HAVE_CANONICALIZE_FILE_NAME) \\ -- 1.9.3+fc1~5~gfaddd51