]> git.notmuchmail.org Git - notmuch/blob - bindings/ruby/extconf.rb
ruby: Add workarounds to use in-tree build not the installed one
[notmuch] / bindings / ruby / extconf.rb
1 #!/usr/bin/env ruby
2 # coding: utf-8
3 # Copyright 2010, 2011, 2012 Ali Polatel <alip@exherbo.org>
4 # Distributed under the terms of the GNU General Public License v3
5
6 require 'mkmf'
7
8 NOTDIR = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
9 NOTHDR = File.join(NOTDIR, 'notmuch.h')
10 NOTLIB = File.join(NOTDIR, 'libnotmuch.a')
11
12 unless File.exists? NOTHDR
13   $stderr.puts "notmuch.h is missing under #{NOTDIR}"
14   exit 1
15 end
16
17 unless File.exists? NOTLIB
18   $stderr.puts "libnotmuch.a is missing under #{NOTDIR}"
19   exit 1
20 end
21
22 # Small hack to build with in-tree version not the installed one.
23 # find_header() and friends use standard include/library paths first.
24 $stderr.puts "Added -I#{NOTDIR} to $INCFLAGS"
25 $INCFLAGS = "-I#{NOTDIR}".quote + " " + $INCFLAGS
26 find_header('notmuch.h', NOTDIR)
27
28 $LOCAL_LIBS += NOTLIB
29
30 # Create Makefile
31 dir_config('notmuch')
32 create_makefile('notmuch')