run meson formatter

This commit is contained in:
Ailin Nemui 2026-01-25 22:07:44 +01:00
commit 221d520c37
33 changed files with 661 additions and 315 deletions

View file

@ -1,7 +1,10 @@
project('irssi', 'c',
project(
'irssi',
'c',
version : '1.5-head',
meson_version : '>=0.53',
default_options : ['warning_level=1'])
default_options : [ 'warning_level=1' ],
)
############################
############################
@ -11,11 +14,11 @@ glib_pcre2_internal_version = 'pcre2-10.40'
glib_libffi_internal_version = 'libffi'
cc = meson.get_compiler('c')
rootinc = include_directories('.')
dep = []
textui_dep = []
dep = [ ]
textui_dep = [ ]
need_dl_cross_link = false
need_dl_cross_link_main = false
dl_cross_irssi_main = []
dl_cross_irssi_main = [ ]
# The Android environment requires that all modules are linked to each other.
# See https://github.com/android/ndk/issues/201
if host_machine.system() == 'android'
@ -66,14 +69,33 @@ if fs.exists('config.status') or fs.exists('irssi-version.h') or fs.exists('defa
endif
UNSET = '=INVALID='
UNSET_ARR = [UNSET]
UNSET_ARR = [ UNSET ]
chat_modules = ['irc']
chat_modules = [ 'irc' ]
run_command('mkdir', meson.current_build_dir() / incdir, check : false)
run_command('ln', '-s', meson.current_source_dir() / 'src', meson.current_build_dir() / incdir, check : false)
run_command('ln', '-s', meson.current_build_dir() / 'irssi-config.h', meson.current_build_dir() / incdir, check : false)
run_command('ln', '-s', meson.current_build_dir() / 'irssi-version.h', meson.current_build_dir() / incdir, check : false)
run_command(
'mkdir',
meson.current_build_dir() / incdir,
check : false,
)
run_command(
'ln',
'-s', meson.current_source_dir() / 'src',
meson.current_build_dir() / incdir,
check : false,
)
run_command(
'ln',
'-s', meson.current_build_dir() / 'irssi-config.h',
meson.current_build_dir() / incdir,
check : false,
)
run_command(
'ln',
'-s', meson.current_build_dir() / 'irssi-version.h',
meson.current_build_dir() / incdir,
check : false,
)
def_moduledir = '-D' + 'MODULEDIR' + '="' + (get_option('prefix') / moduledir) + '"'
def_sysconfdir = '-D' + 'SYSCONFDIR' + '="' + (get_option('prefix') / get_option('sysconfdir')) + '"'
@ -83,12 +105,11 @@ def_scriptdir = '-D' + 'SCRIPTDIR' + '="' + (get_option('prefix') / scriptdir)
def_suppress_printf_fallback = '-D' + 'SUPPRESS_PRINTF_FALLBACK'
module_suffix = []
perl_module_suffix = []
module_suffix = [ ]
perl_module_suffix = [ ]
# Meson uses the wrong module extensions on Mac.
# https://gitlab.gnome.org/GNOME/glib/issues/520
if ['darwin', 'ios'].contains(host_machine.system())
if [ 'darwin', 'ios' ].contains(host_machine.system())
module_suffix = 'so'
perl_module_suffix = 'bundle'
endif
@ -97,13 +118,20 @@ endif
# Help files #
##############
build_perl = find_program('perl', native : true)
build_perl = find_program(
'perl',
native : true,
)
if meson.is_cross_build()
cross_perl = find_program('perl')
else
cross_perl = build_perl
endif
run_command(build_perl, files('utils/syntax.pl'), check : true)
run_command(
build_perl,
files('utils/syntax.pl'),
check : true,
)
###################
# irssi-version.h #
@ -111,12 +139,12 @@ run_command(build_perl, files('utils/syntax.pl'), check : true)
env = find_program('env')
irssi_version_sh = find_program('utils/irssi-version.sh')
irssi_version_h = custom_target('irssi-version.h',
irssi_version_h = custom_target(
'irssi-version.h',
build_by_default : true,
build_always_stale : true,
capture : true,
command : [env, 'VERSION=' + meson.project_version(),
irssi_version_sh, meson.current_source_dir()],
command : [ env, 'VERSION=' + meson.project_version(), irssi_version_sh, meson.current_source_dir() ],
output : 'irssi-version.h',
install : true,
install_dir : includedir / incdir,
@ -127,22 +155,24 @@ irssi_version_h = custom_target('irssi-version.h',
####################
file2header = find_program('utils/file2header.sh')
default_config_h = custom_target('default-config.h',
default_config_h = custom_target(
'default-config.h',
input : files('irssi.conf'),
output : 'default-config.h',
capture : true,
command : [file2header, '@INPUT@', 'default_config'],
command : [ file2header, '@INPUT@', 'default_config' ],
)
###################
# default-theme.h #
###################
default_theme_h = custom_target('default-theme.h',
default_theme_h = custom_target(
'default-theme.h',
input : files('themes/default.theme'),
output : 'default-theme.h',
capture : true,
command : [file2header, '@INPUT@', 'default_theme'],
command : [ file2header, '@INPUT@', 'default_theme' ],
)
################
@ -151,12 +181,18 @@ default_theme_h = custom_target('default-theme.h',
#### inet_addr ####
inet_addr_found = false
foreach inet_addr_provider : ['', 'nsl']
prov_lib = []
foreach inet_addr_provider : [ '', 'nsl' ]
prov_lib = [ ]
if inet_addr_provider != ''
prov_lib += cc.find_library(inet_addr_provider, required : false)
prov_lib += cc.find_library(
inet_addr_provider,
required : false,
)
endif
if (prov_lib.length() == 0 or prov_lib[0].found()) and cc.has_function('inet_addr', dependencies : prov_lib)
if (prov_lib.length() == 0 or prov_lib[0].found()) and cc.has_function(
'inet_addr',
dependencies : prov_lib,
)
dep += prov_lib
inet_addr_found = true
break
@ -168,12 +204,18 @@ endif
#### socket ####
socket_found = false
foreach socket_provider : ['', 'socket', 'network']
prov_lib = []
foreach socket_provider : [ '', 'socket', 'network' ]
prov_lib = [ ]
if socket_provider != ''
prov_lib += cc.find_library(socket_provider, required : false)
prov_lib += cc.find_library(
socket_provider,
required : false,
)
endif
if (prov_lib.length() == 0 or prov_lib[0].found()) and cc.has_function('socket', dependencies : prov_lib)
if (prov_lib.length() == 0 or prov_lib[0].found()) and cc.has_function(
'socket',
dependencies : prov_lib,
)
dep += prov_lib
socket_found = true
break
@ -183,7 +225,7 @@ if not socket_found
error('socket not found')
endif
built_src = []
built_src = [ ]
glib_internal = false
message('*** If you don\'t have GLib, you can run meson ... -Dinstall-glib=yes')
message('*** to download and build it automatically')
@ -191,54 +233,82 @@ message('*** Or alternatively install your distribution\'s package')
message('*** On Debian: sudo apt-get install libglib2.0-dev')
message('*** On Redhat: dnf install glib2-devel')
if not require_glib_internal
glib_dep = dependency('glib-2.0', version : '>=2.32', required : not want_glib_internal, static : want_static_dependency, include_type : 'system')
glib_dep = dependency(
'glib-2.0',
version : '>=2.32',
required : not want_glib_internal,
static : want_static_dependency,
include_type : 'system',
)
else
glib_dep = dependency('', required : false)
glib_dep = dependency(
'',
required : false,
)
endif
if not glib_dep.found()
glib_internal = true
meson_cmd = find_program('meson')
ninja = find_program('ninja')
glib_internal_download_t = custom_target('glib-internal-download',
glib_internal_download_t = custom_target(
'glib-internal-download',
command : [ meson_cmd, 'subprojects', 'download', 'glib', '--sourcedir', meson.current_source_dir() ],
console : true,
output : ['glib-internal-download'],
output : [ 'glib-internal-download' ],
)
glib_internal_dependencies = [
dependency('threads'),
]
glib_internal_configure_args = []
glib_internal_configure_args = [ ]
glib_internal_usr_local = false
if not cc.has_function('iconv_open')
prov_lib = cc.find_library('iconv', required : false)
prov_lib = cc.find_library(
'iconv',
required : false,
)
if not prov_lib.found()
prov_lib = cc.find_library('iconv', dirs : '/usr/local/lib')
prov_lib = cc.find_library(
'iconv',
dirs : '/usr/local/lib',
)
glib_internal_usr_local = true
endif
glib_internal_dependencies += prov_lib
endif
if not cc.has_function('ngettext')
prov_lib = cc.find_library('intl', required : false)
prov_lib = cc.find_library(
'intl',
required : false,
)
if not prov_lib.found()
prov_lib = cc.find_library('intl', dirs : '/usr/local/lib')
prov_lib = cc.find_library(
'intl',
dirs : '/usr/local/lib',
)
glib_internal_usr_local = true
endif
glib_internal_dependencies += prov_lib
endif
if glib_internal_usr_local
glib_internal_configure_args += ['-Dc_args=-I/usr/local/include', '-Dc_link_args=-L/usr/local/lib']
glib_internal_configure_args += [ '-Dc_args=-I/usr/local/include', '-Dc_link_args=-L/usr/local/lib' ]
endif
if not cc.has_function('getxattr') or not cc.has_header('sys/xattr.h')
if cc.has_header_symbol('attr/xattr.h', 'getxattr')
prov_lib = cc.find_library('xattr', required : false)
prov_lib = cc.find_library(
'xattr',
required : false,
)
else
prov_lib = dependency('', required : false)
prov_lib = dependency(
'',
required : false,
)
endif
if prov_lib.found()
glib_internal_dependencies += prov_lib
@ -247,28 +317,41 @@ if not glib_dep.found()
endif
endif
glib_internal_configure_t = custom_target('glib-internal-configure',
command : [ meson_cmd, 'setup', '--prefix=/irssi-glib-internal',
glib_internal_configure_t = custom_target(
'glib-internal-configure',
command : [
meson_cmd,
'setup',
'--prefix=/irssi-glib-internal',
'--buildtype=' + get_option('buildtype'),
'-Dlibmount=disabled', '-Dselinux=disabled', '-Ddefault_library=static', '-Dforce_fallback_for=pcre2,libffi',
'-Dlibmount=disabled',
'-Dselinux=disabled',
'-Ddefault_library=static',
'-Dforce_fallback_for=pcre2,libffi',
glib_internal_configure_args,
(meson.current_build_dir() / 'build-subprojects' / 'glib'),
(meson.current_source_dir() / 'subprojects' / glib_internal_version) ],
(meson.current_source_dir() / 'subprojects' / glib_internal_version),
],
console : true,
output : ['glib-internal-configure'],
depends : glib_internal_download_t,)
glib_internal_build_t = custom_target('glib-internal-build',
command : [ ninja, '-C', meson.current_build_dir() / 'build-subprojects' / 'glib',
output : [ 'glib-internal-configure' ],
depends : glib_internal_download_t,
)
glib_internal_build_t = custom_target(
'glib-internal-build',
command : [
ninja,
'-C', meson.current_build_dir() / 'build-subprojects' / 'glib',
'subprojects' / glib_libffi_internal_version / 'src' / 'libffi.a',
'subprojects' / glib_pcre2_internal_version / 'libpcre2-8.a',
'glib' / 'libglib-2.0.a',
'gmodule' / 'libgmodule-2.0.a',
'gobject' / 'libgobject-2.0.a',
'gio' / 'libgio-2.0.a',
],
],
console : true,
output : ['glib-internal-build'],
depends : glib_internal_configure_t,)
output : [ 'glib-internal-build' ],
depends : glib_internal_configure_t,
)
glib_dep = declare_dependency(
dependencies : glib_internal_dependencies,
sources : glib_internal_build_t,
@ -283,28 +366,37 @@ if not glib_dep.found()
],
)
built_src += glib_internal_build_t
libdl_dep = []
prov_lib = cc.find_library('dl', required : false)
if prov_lib.found() and cc.has_function('dlopen', dependencies : prov_lib)
libdl_dep = [ ]
prov_lib = cc.find_library(
'dl',
required : false,
)
if prov_lib.found() and cc.has_function(
'dlopen',
dependencies : prov_lib,
)
libdl_dep += prov_lib
endif
gmodule_dep = declare_dependency(sources : glib_internal_build_t,
gmodule_dep = declare_dependency(
sources : glib_internal_build_t,
dependencies : libdl_dep,
compile_args : [
'-isystem' + (meson.current_source_dir() / 'subprojects' / glib_internal_version / 'gmodule'),
],
link_args : [ meson.current_build_dir() / 'build-subprojects' / 'glib' / 'gmodule' / 'libgmodule-2.0.a' ],
)
gobject_dep = declare_dependency(sources : glib_internal_build_t,
gobject_dep = declare_dependency(
sources : glib_internal_build_t,
compile_args : [
'-isystem' + (meson.current_build_dir() / 'build-subprojects' / 'glib'),
],
link_args : [
meson.current_build_dir() / 'build-subprojects' / 'glib' / 'subprojects' / glib_libffi_internal_version / 'src' / 'libffi.a',
meson.current_build_dir() / 'build-subprojects' / 'glib' / 'gobject' / 'libgobject-2.0.a'
meson.current_build_dir() / 'build-subprojects' / 'glib' / 'gobject' / 'libgobject-2.0.a',
],
)
gio_dep = declare_dependency(sources : glib_internal_build_t,
gio_dep = declare_dependency(
sources : glib_internal_build_t,
dependencies : cc.find_library('z'),
compile_args : [
'-isystem' + (meson.current_source_dir() / 'subprojects' / glib_internal_version / 'gio'),
@ -313,9 +405,21 @@ if not glib_dep.found()
link_args : [ meson.current_build_dir() / 'build-subprojects' / 'glib' / 'gio' / 'libgio-2.0.a' ],
)
else
gmodule_dep = dependency('gmodule-2.0', static : want_static_dependency, include_type : 'system')
gobject_dep = dependency('gobject-2.0', static : want_static_dependency, include_type : 'system')
gio_dep = dependency('gio-2.0', static : want_static_dependency, include_type : 'system')
gmodule_dep = dependency(
'gmodule-2.0',
static : want_static_dependency,
include_type : 'system',
)
gobject_dep = dependency(
'gobject-2.0',
static : want_static_dependency,
include_type : 'system',
)
gio_dep = dependency(
'gio-2.0',
static : want_static_dependency,
include_type : 'system',
)
endif
dep += glib_dep
dep += gmodule_dep
@ -323,10 +427,17 @@ dep += gobject_dep
dep += gio_dep
if glib_internal and want_static_dependency and want_fuzzer
openssl_proj = subproject('openssl', default_options : ['default_library=static', 'asm=disabled'])
openssl_proj = subproject(
'openssl',
default_options : [ 'default_library=static', 'asm=disabled' ],
)
openssl_dep = openssl_proj.get_variable('openssl_dep')
else
openssl_dep = dependency('openssl', static : want_static_dependency, include_type : 'system')
openssl_dep = dependency(
'openssl',
static : want_static_dependency,
include_type : 'system',
)
endif
dep += openssl_dep
@ -335,10 +446,16 @@ dep += openssl_dep
############
have_libutf8proc = false
libutf8proc = []
libutf8proc = [ ]
if want_libutf8proc
libutf8proc = cc.find_library('utf8proc', required : require_libutf8proc)
have_libutf8proc = cc.has_function('utf8proc_version', dependencies : libutf8proc)
libutf8proc = cc.find_library(
'utf8proc',
required : require_libutf8proc,
)
have_libutf8proc = cc.has_function(
'utf8proc_version',
dependencies : libutf8proc,
)
if have_libutf8proc
dep += libutf8proc
endif
@ -353,9 +470,15 @@ endif
if want_textui
setupterm_found = false
foreach setupterm_provider : ['tinfo', 'ncursesw', 'ncurses', 'terminfo']
prov_lib = cc.find_library(setupterm_provider, required : false)
if prov_lib.found() and cc.has_function('setupterm', dependencies : prov_lib)
foreach setupterm_provider : [ 'tinfo', 'ncursesw', 'ncurses', 'terminfo' ]
prov_lib = cc.find_library(
setupterm_provider,
required : false,
)
if prov_lib.found() and cc.has_function(
'setupterm',
dependencies : prov_lib,
)
textui_dep += prov_lib
setupterm_found = true
break
@ -372,15 +495,20 @@ endif
have_perl = false
if want_perl
perl_cflags = []
perl_ldflags = []
perl_rpath_flags = []
perl_cflags = [ ]
perl_ldflags = [ ]
perl_rpath_flags = [ ]
perl_rpath = ''
#### ccopts ####
perl_ccopts = meson.get_cross_property('perl_ccopts', UNSET_ARR)
if perl_ccopts == UNSET_ARR
res = run_command(cross_perl, '-MExtUtils::Embed', '-e', 'ccopts', check : true)
res = run_command(
cross_perl,
'-MExtUtils::Embed',
'-e', 'ccopts',
check : true,
)
perl_ccopts = res.stdout().strip().split()
endif
foreach fl : perl_ccopts
@ -397,10 +525,15 @@ if want_perl
#### ldopts ####
perl_ldopts = meson.get_cross_property('perl_ldopts', UNSET_ARR)
if perl_ldopts == UNSET_ARR
res = run_command(cross_perl, '-MExtUtils::Embed', '-e', 'ldopts', check : true)
res = run_command(
cross_perl,
'-MExtUtils::Embed',
'-e', 'ldopts',
check : true,
)
perl_ldopts = res.stdout().strip().split()
endif
skip_libs = ['-ldb', '-ldbm', '-lndbm', '-lgdbm', '-lc', '-lposix', '-rdynamic']
skip_libs = [ '-ldb', '-ldbm', '-lndbm', '-lgdbm', '-lc', '-lposix', '-rdynamic' ]
foreach fl : perl_ldopts
if not fl.startswith('-A') and not skip_libs.contains(fl)
if fl.startswith('-Wl,-rpath,')
@ -414,18 +547,26 @@ if want_perl
perl_version = meson.get_cross_property('perl_version', UNSET)
if perl_version == UNSET
perl_version = run_command(cross_perl, '-V::version:', check : true).stdout().split('\'')[1]
perl_version = run_command(
cross_perl,
'-V::version:',
check : true,
).stdout().split('\'')[1]
endif
# disable clang warning
if perl_version.version_compare('<5.35.2')
perl_cflags += cc.get_supported_arguments('-Wno-compound-token-split-by-macro')
endif
perl_dep = declare_dependency(compile_args : perl_cflags, link_args : perl_ldflags,
version : perl_version)
perl_dep = declare_dependency(
compile_args : perl_cflags,
link_args : perl_ldflags,
version : perl_version,
)
####
if not cc.links('''
if not cc.links(
'''
#include <EXTERN.h>
#include <perl.h>
int main()
@ -433,8 +574,10 @@ int main()
perl_alloc();
return 0;
}
''', args : perl_cflags + perl_ldflags + perl_rpath_flags,
name : 'working Perl support')
''',
args : perl_cflags + perl_ldflags + perl_rpath_flags,
name : 'working Perl support',
)
if require_perl
error('error linking with perl libraries')
else
@ -443,9 +586,15 @@ int main()
else
xsubpp_file_c = meson.get_cross_property('perl_xsubpp', UNSET)
if xsubpp_file_c == UNSET
xsubpp_file_c = run_command(build_perl, '-MExtUtils::ParseXS', '-e($r = $INC{"ExtUtils/ParseXS.pm"}) =~ s{ParseXS\\.pm$}{xsubpp}; print $r', check : true).stdout()
xsubpp_file_c = run_command(
build_perl,
'-MExtUtils::ParseXS',
'-e($r = $INC{"ExtUtils/ParseXS.pm"}) =~ s{ParseXS\\.pm$}{xsubpp}; print $r',
check : true,
).stdout()
endif
xsubpp = generator(build_perl,
xsubpp = generator(
build_perl,
output : '@BASENAME@.c',
capture : true,
arguments : [ xsubpp_file_c, '@EXTRA_ARGS@', '@INPUT@' ],
@ -453,31 +602,44 @@ int main()
xsubpp_file = files(xsubpp_file_c)
if with_perl_lib == 'module'
perl_install_base = run_command(build_perl, '-MText::ParseWords=shellwords', '-e', 'grep { s/^INSTALL_BASE=// && print && exit } shellwords $ENV{PERL_MM_OPT}', check : true).stdout()
perl_install_base = run_command(
build_perl,
'-MText::ParseWords=shellwords',
'-e', 'grep { s/^INSTALL_BASE=// && print && exit } shellwords $ENV{PERL_MM_OPT}',
check : true,
).stdout()
if perl_install_base == ''
with_perl_lib = ''
endif
endif
if with_perl_lib == ''
if get_option('prefix') in ['/usr/local', 'C:/']
if get_option('prefix') in [ '/usr/local', 'C:/' ]
with_perl_lib = 'site'
elif get_option('prefix') in ['/usr']
elif get_option('prefix') in [ '/usr' ]
with_perl_lib = 'vendor'
endif
endif
perlmoddir = ''
if with_perl_lib in ['site', 'vendor', 'module']
if with_perl_lib in [ 'site', 'vendor', 'module' ]
set_perl_use_lib = false
perl_library_dir = with_perl_lib + ' default'
if with_perl_lib in ['site', 'vendor']
if with_perl_lib in [ 'site', 'vendor' ]
perlmoddir = meson.get_cross_property('perl_install' + with_perl_lib + 'arch', UNSET)
if perlmoddir == UNSET
perlmoddir = run_command(cross_perl, '-V::install' + with_perl_lib + 'arch:', check : true).stdout().split('\'')[1]
perlmoddir = run_command(
cross_perl,
'-V::install' + with_perl_lib + 'arch:',
check : true,
).stdout().split('\'')[1]
endif
elif with_perl_lib == 'module'
perl_archname = meson.get_cross_property('perl_archname', UNSET)
if perl_archname == UNSET
perl_archname = run_command(cross_perl, '-V::archname:', check : true).stdout().split('\'')[1]
perl_archname = run_command(
cross_perl,
'-V::archname:',
check : true,
).stdout().split('\'')[1]
endif
perlmoddir = perl_install_base / 'lib' / 'perl5' / perl_archname
endif
@ -498,7 +660,12 @@ int main()
if set_perl_use_lib
perl_inc = meson.get_cross_property('perl_inc', UNSET_ARR)
if perl_inc == UNSET_ARR
set_perl_use_lib = run_command(cross_perl, '-e', 'exit ! grep $_ eq $ARGV[0], grep /^\\//, @INC', perl_use_lib, check : false).returncode() != 0
set_perl_use_lib = run_command(
cross_perl,
'-e', 'exit ! grep $_ eq $ARGV[0], grep /^\\//, @INC',
perl_use_lib,
check : false,
).returncode() != 0
else
set_perl_use_lib = not perl_inc.contains(perl_use_lib)
endif
@ -524,8 +691,20 @@ endif
have_otr = false
if want_otr
libgcrypt = dependency('libgcrypt', version : '>=1.2.0', required : require_otr, static : want_static_dependency, include_type : 'system')
libotr = dependency('libotr', version : '>=4.1.0', required : require_otr, static : want_static_dependency, include_type : 'system')
libgcrypt = dependency(
'libgcrypt',
version : '>=1.2.0',
required : require_otr,
static : want_static_dependency,
include_type : 'system',
)
libotr = dependency(
'libotr',
version : '>=4.1.0',
required : require_otr,
static : want_static_dependency,
include_type : 'system',
)
if libgcrypt.found() and libotr.found()
dep += libgcrypt
dep += libotr
@ -539,9 +718,19 @@ endif
have_capsicum = false
if want_capsicum
if cc.has_function('cap_enter', dependencies : cc.find_library('c'))
libnv = cc.find_library('nv', required : require_capsicum)
nvlist_create_found = libnv.found() and cc.has_function('nvlist_create', dependencies : libnv, prefix : '#include <sys/nv.h>')
if cc.has_function(
'cap_enter',
dependencies : cc.find_library('c'),
)
libnv = cc.find_library(
'nv',
required : require_capsicum,
)
nvlist_create_found = libnv.found() and cc.has_function(
'nvlist_create',
dependencies : libnv,
prefix : '#include <sys/nv.h>',
)
if nvlist_create_found
dep += libnv
have_capsicum = true
@ -558,11 +747,14 @@ if want_capsicum
endif
# dependency helper sets
dep_cflagsonly = []
dep_cflagsonly = [ ]
foreach d : dep
dep_cflagsonly += d.partial_dependency(includes : true, compile_args : true)
dep_cflagsonly += d.partial_dependency(
includes : true,
compile_args : true,
)
endforeach
dl_cross_dep = []
dl_cross_dep = [ ]
if need_dl_cross_link
dl_cross_dep = dep
endif
@ -573,11 +765,19 @@ endif
conf = configuration_data()
conf.set('HAVE_CAPSICUM', have_capsicum, description : 'Build with Capsicum support')
conf.set(
'HAVE_CAPSICUM',
have_capsicum,
description : 'Build with Capsicum support',
)
conf.set('HAVE_GMODULE', true)
conf.set('TERM_TRUECOLOR', true)
conf.set('USE_GREGEX', true)
conf.set10('_DARWIN_USE_64_BIT_INODE', true, description : 'Enable large inode numbers on Mac OS X 10.5.')
conf.set10(
'_DARWIN_USE_64_BIT_INODE',
true,
description : 'Enable large inode numbers on Mac OS X 10.5.',
)
conf.set_quoted('FHS_PREFIX', get_option('fhs-prefix'))
headers = [
@ -591,31 +791,50 @@ headers = [
]
foreach h : headers
if cc.has_header(h)
conf.set('HAVE_' + h.underscorify().to_upper(), 1, description : 'Define to 1 if you have the <' + h + '> header file.')
conf.set(
'HAVE_' + h.underscorify().to_upper(),
1,
description : 'Define to 1 if you have the <' + h + '> header file.',
)
endif
endforeach
if want_textui and conf.get('HAVE_TERM_H', 0) == 1
if cc.links('''
if cc.links(
'''
#include <stdio.h>
#include <term.h>
int main (void) {
return tputs("x", 1, putchar);
}
''', args : '-pedantic-errors', dependencies : textui_dep, name : 'Curses working')
''',
args : '-pedantic-errors',
dependencies : textui_dep,
name : 'Curses working',
)
# ok
else
has_curses_h = cc.has_header('curses.h')
if has_curses_h and cc.links('''
if has_curses_h and cc.links(
'''
#include <curses.h>
#include <term.h>
int main (void) {
return tputs("x", 1, putchar);
}
''', args : '-pedantic-errors', dependencies : textui_dep, name : 'Curses working with curses.h')
conf.set('NEED_CURSES_H', 1, description : 'tputs needs curses.h')
''',
args : '-pedantic-errors',
dependencies : textui_dep,
name : 'Curses working with curses.h',
)
conf.set(
'NEED_CURSES_H',
1,
description : 'tputs needs curses.h',
)
else
if has_curses_h and cc.links('''
if has_curses_h and cc.links(
'''
#include <curses.h>
#include <term.h>
int char_putchar (char c) {
@ -624,9 +843,21 @@ int char_putchar (char c) {
int main (void) {
return tputs("x", 1, char_putchar);
}
''', args : '-pedantic-errors', dependencies : textui_dep, name : 'Curses with tputs third argument arg char')
conf.set('NEED_CURSES_H', 1, description : 'tputs needs curses.h')
conf.set('TPUTS_SVR4', 1, description : 'third argument of tputs has the type int (*)(char)')
''',
args : '-pedantic-errors',
dependencies : textui_dep,
name : 'Curses with tputs third argument arg char',
)
conf.set(
'NEED_CURSES_H',
1,
description : 'tputs needs curses.h',
)
conf.set(
'TPUTS_SVR4',
1,
description : 'third argument of tputs has the type int (*)(char)',
)
else
error('could not link terminfo')
endif
@ -638,21 +869,32 @@ conf.set('HAVE_LIBUTF8PROC', have_libutf8proc)
conf.set_quoted('PACKAGE_VERSION', package_version)
conf.set_quoted('PACKAGE_TARNAME', meson.project_name())
configure_file(output : 'irssi-config.h',
configure_file(
output : 'irssi-config.h',
configuration : conf,
install_dir : includedir / incdir)
install_dir : includedir / incdir,
)
##########
# CFLAGS #
##########
#### warnings ####
add_project_arguments(cc.get_supported_arguments('-Werror=declaration-after-statement'), language : 'c')
add_project_arguments(
cc.get_supported_arguments('-Werror=declaration-after-statement'),
language : 'c',
)
#### personality ####
add_project_arguments(cc.get_supported_arguments('-fno-strict-aliasing'), language : 'c')
add_project_arguments(
cc.get_supported_arguments('-fno-strict-aliasing'),
language : 'c',
)
if get_option('buildtype').contains('debug')
add_project_arguments(cc.get_supported_arguments('-fno-omit-frame-pointer'), language : 'c')
add_project_arguments(
cc.get_supported_arguments('-fno-omit-frame-pointer'),
language : 'c',
)
endif
if want_fuzzer
@ -660,7 +902,10 @@ if want_fuzzer
if not cc.has_argument('-fsanitize=fuzzer-no-link')
error('compiler does not support -fsanitize=fuzzer-no-link, try clang?')
endif
add_project_arguments('-fsanitize=fuzzer-no-link', language : 'c')
add_project_arguments(
'-fsanitize=fuzzer-no-link',
language : 'c',
)
endif
if fuzzer_link_language != 'c'
add_languages(fuzzer_link_language)
@ -672,7 +917,7 @@ endif
##############
pc = import('pkgconfig')
pc_requires = []
pc_requires = [ ]
if not glib_internal
pc_requires += glib_dep
endif
@ -687,7 +932,8 @@ if signalsfile.startswith('/')
else
signalsfile = '${prefix}' / signalsfile
endif
pc.generate(filebase : 'irssi-1',
pc.generate(
filebase : 'irssi-1',
name : 'Irssi',
description : 'Irssi chat client',
version : package_version,