2023-01-17 20:51:02 +01:00
|
|
|
## Copyright (C) 2022-2023 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
2021-02-11 23:49:35 +01:00
|
|
|
##
|
|
|
|
## 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
|
|
|
|
## the Free Software Foundation; either version 3 of the License, or
|
|
|
|
## (at your option) any later version.
|
|
|
|
##
|
|
|
|
## This program is distributed in the hope that it will be useful,
|
|
|
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
## GNU General Public License for more details.
|
|
|
|
##
|
|
|
|
## You should have received a copy of the GNU General Public License
|
|
|
|
## along with this program; if not, write to the Free Software Foundation,
|
|
|
|
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# project setup
|
|
|
|
project('mu', ['c', 'cpp'],
|
2023-11-15 19:51:24 +01:00
|
|
|
version: '1.11.25',
|
2022-12-18 18:18:06 +01:00
|
|
|
meson_version: '>= 0.56.0',
|
2022-09-28 18:13:24 +02:00
|
|
|
license: 'GPL-3.0-or-later',
|
|
|
|
default_options : [
|
|
|
|
'buildtype=debugoptimized',
|
|
|
|
'warning_level=3',
|
|
|
|
'c_std=c11',
|
2023-10-14 14:15:41 +02:00
|
|
|
'cpp_std=c++17'])
|
|
|
|
|
|
|
|
# hard-code the date here (for reproduciblity); we derive the dates used in e.g.
|
|
|
|
# documentation from this.
|
2023-11-15 19:51:24 +01:00
|
|
|
mu_date='2023-11-15'
|
2021-02-11 23:49:35 +01:00
|
|
|
|
|
|
|
# installation paths
|
|
|
|
prefixdir = get_option('prefix')
|
2022-12-29 11:25:58 +01:00
|
|
|
bindir = prefixdir / get_option('bindir')
|
2022-09-28 18:13:24 +02:00
|
|
|
datadir = prefixdir / get_option('datadir')
|
|
|
|
mandir = prefixdir / get_option('mandir')
|
|
|
|
infodir = prefixdir / get_option('infodir')
|
2022-07-02 11:18:51 +02:00
|
|
|
|
|
|
|
# allow for configuring lispdir, as with autotools.
|
|
|
|
if get_option('lispdir') == ''
|
|
|
|
mu4e_lispdir= datadir / join_paths('emacs', 'site-lisp', 'mu4e')
|
|
|
|
else
|
|
|
|
mu4e_lispdir= get_option('lispdir') / 'mu4e'
|
|
|
|
endif
|
2021-02-11 23:49:35 +01:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# compilers / flags
|
|
|
|
#
|
2023-09-18 23:06:39 +02:00
|
|
|
|
|
|
|
# compilers
|
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
cxx= meson.get_compiler('cpp')
|
|
|
|
|
2021-02-11 23:49:35 +01:00
|
|
|
extra_flags = [
|
2022-02-18 09:52:41 +01:00
|
|
|
'-Wno-unused-parameter',
|
|
|
|
'-Wno-cast-function-type',
|
2022-05-14 11:43:09 +02:00
|
|
|
'-Wformat-security',
|
|
|
|
'-Wformat=2',
|
|
|
|
'-Wstack-protector',
|
2023-12-01 18:12:15 +01:00
|
|
|
'-fstack-protector-strong',
|
2022-05-14 11:43:09 +02:00
|
|
|
'-Wno-switch-enum',
|
2023-07-16 12:02:11 +02:00
|
|
|
# assuming these are false alarm... (in fmt, with gcc13):
|
|
|
|
'-Wno-array-bounds',
|
2023-12-01 18:12:15 +01:00
|
|
|
'-Wno-stringop-overflow',]
|
2023-09-18 23:06:39 +02:00
|
|
|
|
|
|
|
if (cxx.get_id() == 'clang')
|
|
|
|
extra_flags += [
|
|
|
|
'-Wc11-extensions',
|
|
|
|
'-Wno-keyword-macro',
|
|
|
|
'-Wno-deprecated-volatile',
|
|
|
|
'-Wno-#warnings']
|
|
|
|
endif
|
|
|
|
|
|
|
|
extra_cpp_flags= [
|
|
|
|
'-Wno-volatile'
|
2023-07-16 12:02:11 +02:00
|
|
|
]
|
2021-02-11 23:49:35 +01:00
|
|
|
|
2022-03-04 23:41:53 +01:00
|
|
|
if get_option('buildtype') == 'debug'
|
|
|
|
extra_flags += [
|
2023-12-01 18:12:15 +01:00
|
|
|
'-D_GLIBCXX_ASSERTIONS',
|
2022-03-04 23:41:53 +01:00
|
|
|
'-ggdb',
|
2023-09-18 23:06:39 +02:00
|
|
|
'-g3']
|
2022-03-04 23:41:53 +01:00
|
|
|
endif
|
|
|
|
|
2021-02-11 23:49:35 +01:00
|
|
|
# extra arguments, if available
|
|
|
|
foreach extra_arg : extra_flags
|
|
|
|
if cc.has_argument (extra_arg)
|
|
|
|
add_project_arguments([extra_arg], language: 'c')
|
|
|
|
endif
|
2023-09-18 23:06:39 +02:00
|
|
|
endforeach
|
|
|
|
|
|
|
|
foreach extra_arg : extra_flags + extra_cpp_flags
|
2021-02-11 23:49:35 +01:00
|
|
|
if cxx.has_argument (extra_arg)
|
|
|
|
add_project_arguments([extra_arg], language: 'cpp')
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2022-10-15 09:45:15 +02:00
|
|
|
# some clang don't have charconv, but we need it.
|
|
|
|
# https://github.com/djcb/mu/issues/2347
|
|
|
|
cxx.check_header('charconv', required:true)
|
2022-09-28 18:13:24 +02:00
|
|
|
|
2023-10-14 14:15:41 +02:00
|
|
|
|
2023-10-14 15:22:31 +02:00
|
|
|
build_aux = join_paths(meson.current_source_dir(), 'build-aux')
|
2023-10-14 14:15:41 +02:00
|
|
|
################################################################################
|
|
|
|
# derived date values (based on 'mu-date'); used in docs
|
2023-10-14 15:22:31 +02:00
|
|
|
# we can't use the 'date' because MacOS 'date' is incompatible with GNU's.
|
2023-10-14 15:46:05 +02:00
|
|
|
pdate=find_program(join_paths(build_aux, 'date.py'))
|
2023-10-14 14:15:41 +02:00
|
|
|
env = environment()
|
|
|
|
env.set('LANG', 'C')
|
2023-10-14 15:22:31 +02:00
|
|
|
mu_day_month_year = run_command(pdate, mu_date, '%d %B %Y',
|
2023-10-14 14:15:41 +02:00
|
|
|
check:true, capture:true,
|
|
|
|
env: env).stdout().strip()
|
2023-10-14 15:22:31 +02:00
|
|
|
mu_month_year = run_command(pdate, mu_date, '%B %Y',
|
2023-10-14 14:15:41 +02:00
|
|
|
check:true, capture:true,
|
|
|
|
env: env).stdout().strip()
|
2023-10-14 15:22:31 +02:00
|
|
|
mu_year = run_command(pdate, mu_date, '%Y',
|
2023-10-14 14:15:41 +02:00
|
|
|
check:true, capture:true, env: env).stdout().strip()
|
|
|
|
|
2021-02-11 23:49:35 +01:00
|
|
|
################################################################################
|
|
|
|
# config.h setup
|
|
|
|
#
|
|
|
|
config_h_data=configuration_data()
|
2023-06-30 22:19:17 +02:00
|
|
|
config_h_data.set('MU_STORE_SCHEMA_VERSION', 500)
|
2021-02-11 23:49:35 +01:00
|
|
|
config_h_data.set_quoted('PACKAGE_VERSION', meson.project_version())
|
2021-09-02 22:15:03 +02:00
|
|
|
config_h_data.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' +
|
|
|
|
meson.project_version())
|
2021-02-11 23:49:35 +01:00
|
|
|
config_h_data.set_quoted('VERSION', meson.project_version())
|
|
|
|
config_h_data.set_quoted('PACKAGE_NAME', meson.project_name())
|
|
|
|
|
2021-10-15 07:20:33 +02:00
|
|
|
add_project_arguments(['-DHAVE_CONFIG_H'], language: 'c')
|
|
|
|
add_project_arguments(['-DHAVE_CONFIG_H'], language: 'cpp')
|
|
|
|
config_h_dep=declare_dependency(
|
|
|
|
include_directories: include_directories(['.']))
|
|
|
|
|
2023-08-12 14:59:32 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# d_type, d_ino are not available universally, so let's check
|
|
|
|
# (we use them for optimizations in mu-scanner
|
|
|
|
#
|
|
|
|
if cxx.has_member('struct dirent', 'd_ino', prefix : '#include<dirent.h>')
|
|
|
|
config_h_data.set('HAVE_DIRENT_D_INO', 1)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if cxx.has_member('struct dirent', 'd_type', prefix : '#include<dirent.h>')
|
|
|
|
config_h_data.set('HAVE_DIRENT_D_TYPE', 1)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2021-02-11 23:49:35 +01:00
|
|
|
functions=[
|
|
|
|
'setsid'
|
|
|
|
]
|
|
|
|
foreach f : functions
|
|
|
|
if cc.has_function(f)
|
|
|
|
define = 'HAVE_' + f.underscorify().to_upper()
|
|
|
|
config_h_data.set(define, 1)
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2021-09-07 23:12:20 +02:00
|
|
|
if cc.has_function('wordexp')
|
|
|
|
config_h_data.set('HAVE_WORDEXP_H',1)
|
2023-08-02 20:17:45 +02:00
|
|
|
else
|
|
|
|
message('no wordexp, no command-line option expansion')
|
2021-09-07 23:12:20 +02:00
|
|
|
endif
|
|
|
|
|
2023-08-27 10:37:15 +02:00
|
|
|
testmaildir=join_paths(meson.current_source_dir(), 'testdata')
|
2021-11-07 10:41:55 +01:00
|
|
|
config_h_data.set_quoted('MU_TESTMAILDIR', join_paths(testmaildir, 'testdir'))
|
|
|
|
config_h_data.set_quoted('MU_TESTMAILDIR2', join_paths(testmaildir, 'testdir2'))
|
|
|
|
config_h_data.set_quoted('MU_TESTMAILDIR4', join_paths(testmaildir, 'testdir4'))
|
2021-11-22 21:17:46 +01:00
|
|
|
config_h_data.set_quoted('MU_TESTMAILDIR_CJK', join_paths(testmaildir, 'cjk'))
|
2021-02-11 23:49:35 +01:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# hard dependencies
|
|
|
|
#
|
2023-04-29 21:55:54 +02:00
|
|
|
glib_dep = dependency('glib-2.0', version: '>= 2.60')
|
|
|
|
gobject_dep = dependency('gobject-2.0', version: '>= 2.60')
|
|
|
|
gio_dep = dependency('gio-2.0', version: '>= 2.60')
|
|
|
|
gio_unix_dep = dependency('gio-unix-2.0', version: '>= 2.60')
|
2021-02-11 23:49:35 +01:00
|
|
|
gmime_dep = dependency('gmime-3.0', version: '>= 3.2')
|
|
|
|
thread_dep = dependency('threads')
|
|
|
|
|
2023-09-09 10:57:05 +02:00
|
|
|
# we need Xapian 1.4; if we have 1.4.23, we have some newer APIs.
|
|
|
|
xapian_dep = dependency('xapian-core', version:'>= 1.4.23', required:false)
|
|
|
|
if xapian_dep.found()
|
|
|
|
config_h_data.set('HAVE_XAPIAN_FLAG_NGRAMS', 1)
|
|
|
|
else
|
|
|
|
xapian_dep = dependency('xapian-core', version:'>= 1.4')
|
|
|
|
message('Found xapian ' + xapian_dep.version())
|
|
|
|
endif
|
|
|
|
|
2023-05-11 22:19:31 +02:00
|
|
|
# optionally, use Compact Language Detector2 if we can find it.
|
|
|
|
cld2_dep = meson.get_compiler('cpp').find_library('cld2', required: false)
|
|
|
|
if cld2_dep.found()
|
|
|
|
config_h_data.set('HAVE_CLD2', 1)
|
|
|
|
else
|
|
|
|
message('CLD2 not found; no support for language detection')
|
|
|
|
endif
|
|
|
|
|
2023-07-18 22:15:53 +02:00
|
|
|
# note: these are for the unit-tests
|
|
|
|
|
2023-07-18 20:33:59 +02:00
|
|
|
cp=find_program('cp')
|
|
|
|
mv=find_program('mv')
|
2023-07-18 22:15:53 +02:00
|
|
|
ln=find_program('ln')
|
2023-07-18 20:33:59 +02:00
|
|
|
rm=find_program('rm')
|
2021-02-11 23:49:35 +01:00
|
|
|
awk=find_program(['gawk', 'awk'])
|
2022-06-30 20:34:29 +02:00
|
|
|
gzip=find_program('gzip')
|
2021-02-11 23:49:35 +01:00
|
|
|
|
2023-07-18 20:33:59 +02:00
|
|
|
config_h_data.set_quoted('CP_PROGRAM', cp.full_path())
|
|
|
|
config_h_data.set_quoted('MV_PROGRAM', mv.full_path())
|
|
|
|
config_h_data.set_quoted('RM_PROGRAM', rm.full_path())
|
2023-07-18 22:15:53 +02:00
|
|
|
config_h_data.set_quoted('LN_PROGRAM', ln.full_path())
|
2023-07-18 20:33:59 +02:00
|
|
|
config_h_data.set_quoted('AWK_PROGRAM', awk.full_path())
|
|
|
|
config_h_data.set_quoted('GZIP_PROGRAM', gzip.full_path())
|
|
|
|
|
2022-06-30 20:34:29 +02:00
|
|
|
# soft dependencies
|
|
|
|
guile_dep = dependency('guile-3.0', required: get_option('guile'))
|
2023-08-09 19:17:25 +02:00
|
|
|
# allow for a custom guile-extension-dir
|
|
|
|
if guile_dep.found()
|
|
|
|
custom_guile_xd=get_option('guile-extension-dir')
|
|
|
|
if custom_guile_xd == ''
|
|
|
|
guile_extension_dir = guile_dep.get_variable(pkgconfig: 'extensiondir')
|
|
|
|
else
|
|
|
|
guile_extension_dir = custom_guile_xd
|
|
|
|
endif
|
|
|
|
config_h_data.set_quoted('MU_GUILE_EXTENSION_DIR', guile_extension_dir)
|
2023-08-09 22:11:54 +02:00
|
|
|
message('Using guile-extension-dir: ' + guile_extension_dir)
|
2023-08-09 19:17:25 +02:00
|
|
|
endif
|
2021-02-11 23:49:35 +01:00
|
|
|
|
|
|
|
# emacs -- needed for mu4e compilation
|
2022-06-30 20:31:44 +02:00
|
|
|
emacs_name=get_option('emacs')
|
2023-08-23 02:04:31 +02:00
|
|
|
emacs_min_version='26.3'
|
|
|
|
emacs=find_program([emacs_name], version: '>='+emacs_min_version, required:false)
|
2021-02-11 23:49:35 +01:00
|
|
|
if not emacs.found()
|
|
|
|
message('emacs not found; not pre-compiling mu4e sources')
|
|
|
|
endif
|
|
|
|
|
|
|
|
makeinfo=find_program(['makeinfo'], required:false)
|
|
|
|
if not makeinfo.found()
|
|
|
|
message('makeinfo (texinfo) not found; not building info documentation')
|
2022-06-30 20:34:29 +02:00
|
|
|
else
|
|
|
|
install_info=find_program(['install-info'], required:false)
|
|
|
|
if not install_info.found()
|
|
|
|
message('install-info not found')
|
|
|
|
else
|
2023-10-14 15:22:31 +02:00
|
|
|
install_info_script=join_paths(build_aux, 'meson-install-info.sh')
|
2022-06-30 20:34:29 +02:00
|
|
|
endif
|
2021-02-11 23:49:35 +01:00
|
|
|
endif
|
|
|
|
|
2021-09-02 22:15:03 +02:00
|
|
|
# readline. annoyingly, macos has an incompatible libedit claiming to be
|
2022-01-14 16:11:08 +01:00
|
|
|
# readline. this is only a dev/debug convenience for the mu4e repl.
|
2021-02-11 23:49:35 +01:00
|
|
|
readline_dep=[]
|
|
|
|
if get_option('readline').enabled()
|
|
|
|
readline_dep = dependency('readline', version:'>= 8.0')
|
|
|
|
config_h_data.set('HAVE_LIBREADLINE', 1)
|
|
|
|
config_h_data.set('HAVE_READLINE_READLINE_H', 1)
|
|
|
|
config_h_data.set('HAVE_READLINE_HISTORY', 1)
|
|
|
|
config_h_data.set('HAVE_READLINE_HISTORY_H', 1)
|
|
|
|
endif
|
|
|
|
|
2021-03-16 23:16:49 +01:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# write out version.texi (for texiinfo builds in mu4e, guile)
|
|
|
|
version_texi_data=configuration_data()
|
|
|
|
version_texi_data.set('VERSION', meson.project_version())
|
|
|
|
version_texi_data.set('EDITION', meson.project_version())
|
2023-10-14 14:15:41 +02:00
|
|
|
|
|
|
|
# derived date values
|
|
|
|
version_texi_data.set('UPDATED', mu_day_month_year)
|
|
|
|
version_texi_data.set('UPDATEDMONTH', mu_month_year)
|
|
|
|
version_texi_data.set('UPDATEDYEAR', mu_year)
|
2021-03-16 23:16:49 +01:00
|
|
|
|
2023-10-14 15:22:31 +02:00
|
|
|
configure_file(input: join_paths(build_aux, 'version.texi.in'),
|
2022-09-28 18:13:24 +02:00
|
|
|
output: 'version.texi',
|
|
|
|
configuration: version_texi_data)
|
2021-03-16 23:16:49 +01:00
|
|
|
|
2021-09-02 22:15:03 +02:00
|
|
|
################################################################################
|
|
|
|
# install some data files
|
|
|
|
install_data('NEWS.org',
|
|
|
|
install_dir : join_paths(datadir,'doc', 'mu'))
|
|
|
|
|
2021-02-11 23:49:35 +01:00
|
|
|
################################################################################
|
|
|
|
# subdirs
|
|
|
|
subdir('lib')
|
|
|
|
subdir('mu')
|
2022-12-17 23:21:52 +01:00
|
|
|
|
|
|
|
if emacs.found()
|
|
|
|
subdir('man')
|
|
|
|
else
|
|
|
|
message('emacs not found; not generating manpages')
|
|
|
|
endif
|
2021-02-11 23:49:35 +01:00
|
|
|
|
|
|
|
if emacs.found()
|
|
|
|
subdir('mu4e')
|
2022-12-17 23:21:52 +01:00
|
|
|
else
|
|
|
|
message('emacs not found; not preparing mu4e support')
|
2021-02-11 23:49:35 +01:00
|
|
|
endif
|
|
|
|
|
2021-10-15 07:20:33 +02:00
|
|
|
if not get_option('guile').disabled() and guile_dep.found()
|
|
|
|
config_h_data.set('BUILD_GUILE', 1)
|
2022-05-21 16:44:09 +02:00
|
|
|
config_h_data.set_quoted('GUILE_BINARY',
|
2022-12-18 18:18:06 +01:00
|
|
|
guile_dep.get_variable(pkgconfig: 'guile'))
|
2022-05-21 16:44:09 +02:00
|
|
|
#message('guile is disabled for now')
|
|
|
|
subdir('guile')
|
2021-02-11 23:49:35 +01:00
|
|
|
endif
|
|
|
|
|
2021-11-07 10:41:55 +01:00
|
|
|
config_h_data.set_quoted('MU_PROGRAM', mu.full_path())
|
2021-02-11 23:49:35 +01:00
|
|
|
################################################################################
|
2021-10-15 07:20:33 +02:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# write-out config.h
|
|
|
|
configure_file(output : 'config.h', configuration : config_h_data)
|
2023-04-03 19:43:36 +02:00
|
|
|
|
|
|
|
if gmime_dep.version() == '3.2.13'
|
|
|
|
warning('gmime version 3.2.13 detected, which as a decoding bug')
|
|
|
|
warning('See: https://github.com/jstedfast/gmime/issues/133')
|
|
|
|
endif
|