]> git.notmuchmail.org Git - notmuch/commitdiff
ruby: Add workarounds to use in-tree build not the installed one
authorAli Polatel <alip@exherbo.org>
Mon, 7 May 2012 15:02:45 +0000 (18:02 +0300)
committerDavid Bremner <bremner@debian.org>
Tue, 8 May 2012 13:34:33 +0000 (10:34 -0300)
- Make mkmf use the notmuch.h under ../../lib
- Use libnotmuch.a instead of linking to the installed libnotmuch.so

bindings/ruby/defs.h
bindings/ruby/extconf.rb

index a41cf10e923015827a677f7da653991888708d9a..6fe5787098c29f875e2ef699454298ececf80289 100644 (file)
@@ -1,6 +1,6 @@
 /* The Ruby interface to the notmuch mail library
  *
 /* The Ruby interface to the notmuch mail library
  *
- * Copyright © 2010, 2011 Ali Polatel
+ * Copyright © 2010, 2011, 2012 Ali Polatel
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,8 +21,8 @@
 #ifndef DEFS_H
 #define DEFS_H
 
 #ifndef DEFS_H
 #define DEFS_H
 
-#include <notmuch.h>
 #include <ruby.h>
 #include <ruby.h>
+#include "notmuch.h"
 
 VALUE notmuch_rb_cDatabase;
 VALUE notmuch_rb_cDirectory;
 
 VALUE notmuch_rb_cDatabase;
 VALUE notmuch_rb_cDirectory;
index ccac609ce6a1b63ccacabad5e2b6e25d1f829dbd..933f34a98db3e57d940bd39f68302843b6aa3d77 100644 (file)
@@ -1,13 +1,31 @@
 #!/usr/bin/env ruby
 # coding: utf-8
 #!/usr/bin/env ruby
 # coding: utf-8
-# Copyright 2010, 2011 Ali Polatel <alip@exherbo.org>
+# Copyright 2010, 2011, 2012 Ali Polatel <alip@exherbo.org>
 # Distributed under the terms of the GNU General Public License v3
 
 require 'mkmf'
 
 # Distributed under the terms of the GNU General Public License v3
 
 require 'mkmf'
 
-# Notmuch Library
-find_header('notmuch.h', '../../lib')
-find_library('notmuch', 'notmuch_database_create', '../../lib')
+NOTDIR = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
+NOTHDR = File.join(NOTDIR, 'notmuch.h')
+NOTLIB = File.join(NOTDIR, 'libnotmuch.a')
+
+unless File.exists? NOTHDR
+  $stderr.puts "notmuch.h is missing under #{NOTDIR}"
+  exit 1
+end
+
+unless File.exists? NOTLIB
+  $stderr.puts "libnotmuch.a is missing under #{NOTDIR}"
+  exit 1
+end
+
+# Small hack to build with in-tree version not the installed one.
+# find_header() and friends use standard include/library paths first.
+$stderr.puts "Added -I#{NOTDIR} to $INCFLAGS"
+$INCFLAGS = "-I#{NOTDIR}".quote + " " + $INCFLAGS
+find_header('notmuch.h', NOTDIR)
+
+$LOCAL_LIBS += NOTLIB
 
 # Create Makefile
 dir_config('notmuch')
 
 # Create Makefile
 dir_config('notmuch')