unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob ed79bd2ec83cf513da6a6e279d539b9ec7d4678d 4853 bytes (raw)
name: compat/meson.build 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
 
notmuch_compat_srcs = [
]

config = configuration_data()

config.set_quoted('NOTMUCH_SRCDIR', meson.source_root())

# FIXME: this differs from the legacy build
config.set('PLATFORM', build_machine.system())

cc = meson.get_compiler('c')
cxx = meson.get_compiler('cpp')

have_canonicalize_file_name = cc.has_function('canonicalize_file_name',
					      prefix: '#include <stdlib.h>',
					      args: '-D_GNU_SOURCE')
config.set10('HAVE_CANONICALIZE_FILE_NAME', have_canonicalize_file_name)
if not have_canonicalize_file_name
	notmuch_compat_srcs += 'canonicalize_file_name.c'
endif

have_getline = cc.has_function('getline', prefix: '''#include <stdio.h>
#include <sys/types.h>
''')
config.set10('HAVE_GETLINE', have_getline)
if not have_getline
	notmuch_compat_srcs += [ 'getline.c', 'getdelim.c' ]
endif

have_strcasestr = cc.has_function('strcasestr', prefix: '#include <string.h>',
				  args: '-D_GNU_SOURCE')
config.set10('HAVE_STRCASESTR', have_strcasestr)
if not have_strcasestr
	notmuch_compat_srcs += 'strcasestr.c'
endif

have_strsep = cc.has_function('strsep', prefix: '#include <string.h>')
config.set10('HAVE_STRSEP', have_strsep)
if not have_strsep
	notmuch_compat_srcs += 'strsep.c'
endif

have_timegm = cc.has_function('timegm', prefix: '#include <time.h>')
config.set10('HAVE_TIMEGM', have_timegm)
if not have_timegm
	notmuch_compat_srcs += 'timegm.c'
endif

have_d_type = cc.has_member('struct dirent', 'd_type',
			    prefix: '#include <dirent.h>')
config.set10('HAVE_D_TYPE', have_d_type)

getpwuid_code = '''
#include <stdio.h>
#include <pwd.h>
int main()
{
	struct passwd passwd, *ignored;
	getpwuid_r (0, &passwd, NULL, 0, &ignored);
}
'''
std_getpwuid = cc.compiles(getpwuid_code, name: 'standard getpwuid_r')
config.set10('STD_GETPWUID', std_getpwuid)

asctime_code = '''
#include <time.h>
#include <stdio.h>
int main()
{
	struct tm tm;
	asctime_r (&tm, NULL);
}
'''
std_asctime = cc.compiles(asctime_code, name: 'standard asctime_r')
config.set10('STD_ASCTIME', std_asctime)

xapian_compact_code = '''
#include <xapian.h>
class TestCompactor : public Xapian::Compactor { };
'''
have_xapian_compact = cxx.compiles(xapian_compact_code, name: 'Xapian compact',
				   dependencies: dep_xapian)
config.set10('HAVE_XAPIAN_COMPACT', have_xapian_compact)

xapian_field_processor_code = '''
#include <xapian.h>
class TitleFieldProcessor : public Xapian::FieldProcessor { };
'''
have_xapian_field_processor = cxx.compiles(xapian_field_processor_code,
					   name: 'Xapian field processor',
					   dependencies: dep_xapian)
config.set10('HAVE_XAPIAN_FIELD_PROCESSOR', have_xapian_field_processor)

xapian_db_retry_lock_code = '''
#include <xapian.h>
int flag = Xapian::DB_RETRY_LOCK;
'''
have_xapian_db_retry_lock = cxx.compiles(xapian_db_retry_lock_code,
					 name: 'Xapian retry lock',
					 dependencies: dep_xapian)
config.set10('HAVE_XAPIAN_DB_RETRY_LOCK', have_xapian_db_retry_lock)

default_xapian_backend_code = '''
#include <xapian.h>
#include <unistd.h>
#include <stdio.h>

#define TESTDB "test.db"
int main(void) {
	int i;
	struct {
		const char *file;
		const char *name;
	} backends[] = {
		{ TESTDB "/iamglass", "glass" },
		{ TESTDB "/iamchert", "chert" },
		{ TESTDB "/iamflint", "flint" },
		{ NULL, "unknown" },
	};

	Xapian::WritableDatabase db("test.db", Xapian::DB_CREATE_OR_OPEN);

	for (i = 0; backends[i].file && access(backends[i].file, R_OK); i++)
		;

	printf("%s", backends[i].name);
}

'''
default_xapian_backend = cxx.run(default_xapian_backend_code,
				 name: 'Xapian default backend',
				 dependencies: dep_xapian)
message('Default Xapian backend: ' + default_xapian_backend.stdout())
config.set('DEFAULT_XAPIAN_BACKEND', default_xapian_backend.stdout())

configure_inc = include_directories('../lib')
libnotmuch_version_major = cc.get_define('LIBNOTMUCH_MAJOR_VERSION',
					 prefix: '#include <notmuch.h>',
					 include_directories: configure_inc)
libnotmuch_version_minor = cc.get_define('LIBNOTMUCH_MINOR_VERSION',
					 prefix: '#include <notmuch.h>',
					 include_directories: configure_inc)
libnotmuch_version_micro = cc.get_define('LIBNOTMUCH_MICRO_VERSION',
					 prefix: '#include <notmuch.h>',
					 include_directories: configure_inc)
libnotmuch_version = libnotmuch_version_major + '.' + libnotmuch_version_minor + '.' + libnotmuch_version_micro


config.set_quoted('PYTHON', cmd_python.path())

config.set('GMIME_MAJOR', dep_gmime.version().split('.')[0])

if cmd_ruby.found()
	ruby_dev = run_command(cmd_ruby.path(), ['-e', 'require \'mkmf\''])
	have_ruby_dev = ruby_dev.returncode() == 0
else
	have_ruby_dev = false
endif
config.set10('HAVE_RUBY_DEV', have_ruby_dev)


configure_file(input: 'config.h.in',
	       output: 'config.h',
	       configuration: config)

inc_compat = include_directories('.')

lib_compat = static_library('notmuch-compat',
			    notmuch_compat_srcs)

debug log:

solving ed79bd2ec83c ...
found ed79bd2ec83c in https://yhetil.org/notmuch/20200111164049.8237-1-jani@nikula.org/

applying [1/1] https://yhetil.org/notmuch/20200111164049.8237-1-jani@nikula.org/
diff --git a/compat/meson.build b/compat/meson.build
new file mode 100644
index 000000000000..ed79bd2ec83c

Checking patch compat/meson.build...
Applied patch compat/meson.build cleanly.

index at:
100644 ed79bd2ec83cf513da6a6e279d539b9ec7d4678d	compat/meson.build

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

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).