unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Wael Nasreddine <wael.nasreddine@gmail.com>
To: Felipe Contreras <felipe.contreras@gmail.com>, notmuch@notmuchmail.org
Cc: Ali Polatel <alip@exherbo.org>
Subject: Re: [PATCH 2/3] build: add support to build Ruby bindings
Date: Fri, 23 May 2014 08:04:57 -0700	[thread overview]
Message-ID: <w52c61kwh6xy.fsf@gaea.mtv.corp.google.com> (raw)
In-Reply-To: <1400841267-12807-3-git-send-email-felipe.contreras@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4102 bytes --]

Felipe Contreras <felipe.contreras@gmail.com> writes:

> So there's no need for the user to manually do that.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  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

[-- Attachment #2.1: Type: text/plain, Size: 83 bytes --]

-- 
Wael Nasreddine | SRE at Google | wael.nasreddine@gmail.com | (650) 735-1773

[-- Attachment #2.2: Type: application/pgp-signature, Size: 180 bytes --]

  reply	other threads:[~2014-05-23 15:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23 10:34 [PATCH 0/3] Build and test Ruby bindings Felipe Contreras
2014-05-23 10:34 ` [PATCH 1/3] build: don't add sub Makefiles to the global deps Felipe Contreras
2014-05-25  7:58   ` Jani Nikula
2014-05-25  7:53     ` Felipe Contreras
2014-05-25  9:17       ` Jani Nikula
2014-05-25 15:47         ` Felipe Contreras
2014-05-25 17:01           ` Jani Nikula
2014-05-23 10:34 ` [PATCH 2/3] build: add support to build Ruby bindings Felipe Contreras
2014-05-23 15:04   ` Wael Nasreddine [this message]
2014-07-13 14:28   ` David Bremner
2014-05-23 10:34 ` [PATCH 3/3] test: add tests for " Felipe Contreras
2014-07-13 13:11   ` David Bremner

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=w52c61kwh6xy.fsf@gaea.mtv.corp.google.com \
    --to=wael.nasreddine@gmail.com \
    --cc=alip@exherbo.org \
    --cc=felipe.contreras@gmail.com \
    --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).