From 59a04dc132c563ab5e2908c761e27e205f0f8bc1 Mon Sep 17 00:00:00 2001 From: Wael Nasreddine Date: Sat, 24 May 2014 08:04:57 +1700 Subject: [PATCH] Re: [PATCH 2/3] build: add support to build Ruby bindings --- 6b/a929863374302094a8676550cf5483ef8c875c | 230 ++++++++++++++++++++++ 1 file changed, 230 insertions(+) create mode 100644 6b/a929863374302094a8676550cf5483ef8c875c diff --git a/6b/a929863374302094a8676550cf5483ef8c875c b/6b/a929863374302094a8676550cf5483ef8c875c new file mode 100644 index 000000000..181a00b04 --- /dev/null +++ b/6b/a929863374302094a8676550cf5483ef8c875c @@ -0,0 +1,230 @@ +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 30CF8431FC4 + for ; Fri, 23 May 2014 08:05:12 -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 fcAw2EB7hej6 for ; + Fri, 23 May 2014 08:05:04 -0700 (PDT) +Received: from mail-pb0-f52.google.com (mail-pb0-f52.google.com + [209.85.160.52]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id CD54E431FBF + for ; Fri, 23 May 2014 08:05:04 -0700 (PDT) +Received: by mail-pb0-f52.google.com with SMTP id rr13so4298242pbb.11 + for ; Fri, 23 May 2014 08:05:04 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:in-reply-to:references:user-agent:date + :message-id:mime-version:content-type; + bh=0loDcWV4TJExt85MSt/AzL11HcWD3NmgbGcUetjV5Kw=; + b=qW9DysoR35D/obOVHiGXLh1fPFTBT7/iqeWYKoajlJm7u9KgYPqxX63d24XszR8vFQ + JoYaQaYwOEa/UG1w1VRmmd+i2ijeCZ/cAx9lbq8VgkNbmA2wu0o7vDbJepO+epkhrYZY + Yc8hqEx9U9/A2pXTcanm8H46rEFJgpbfdEHtHy5y02NkL/34Nd8S4XYN6RTq3vRkpzD9 + bkgmwc8/Ky2VKgS1YNlUGMW3RQuiVPpyqHYorn9DGBjIpGwoo2C9m2zNczetc6mJeYB5 + DpvuGvvgthJpjcW036HlO2P6r/sEUEXcBGaJ551XKk5eNnTuFKEdQ8xtkqn2fnCR5qn9 + 4e+w== +X-Received: by 10.66.124.163 with SMTP id mj3mr6830414pab.38.1400857504046; + Fri, 23 May 2014 08:05:04 -0700 (PDT) +Received: from localhost ([2620:0:1000:2e00:ec3f:a511:27dc:adef]) + by mx.google.com with ESMTPSA id no9sm5058063pbc.83.2014.05.23.08.05.01 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Fri, 23 May 2014 08:05:02 -0700 (PDT) +From: Wael Nasreddine +To: Felipe Contreras , notmuch@notmuchmail.org +Subject: Re: [PATCH 2/3] build: add support to build Ruby bindings +In-Reply-To: <1400841267-12807-3-git-send-email-felipe.contreras@gmail.com> +References: <1400841267-12807-1-git-send-email-felipe.contreras@gmail.com> + <1400841267-12807-3-git-send-email-felipe.contreras@gmail.com> +User-Agent: Notmuch/0.18+10~g7d81d70 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-pc-linux-gnu) +Date: Fri, 23 May 2014 08:04:57 -0700 +Message-ID: +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="=-=-=" +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 15:05:12 -0000 + +--=-=-= +Content-Type: text/plain + +Felipe Contreras writes: + +> 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 +Why don't you do an OR check for ruby 1.9, 2.0 and 2.1 allowing it to +build with any Ruby version? + +> + 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 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch + +--=-=-= +Content-Type: multipart/signed; boundary="==-=-="; + micalg=pgp-sha1; protocol="application/pgp-signature" + +--==-=-= +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +=2D-=20 +Wael Nasreddine | SRE at Google | wael.nasreddine@gmail.com | (650) 735-1773 + +--==-=-= +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1 + +iEYEARECAAYFAlN/Y5kACgkQVWU5RcjdGKL6JwCgp84Bd8O94oUEZvqD/iFNzoJQ +S1IAn10tie1PhxKN4EvEDzdjyD8ugxgs +=xJvY +-----END PGP SIGNATURE----- +--==-=-=-- + +--=-=-=-- -- 2.26.2