1
0
Fork 0

meson build support

This commit is contained in:
Ailin Nemui 2019-07-08 00:02:53 +02:00
parent fb85fdec5c
commit db16a0a853
57 changed files with 1787 additions and 46 deletions

4
.gitignore vendored
View File

@ -27,6 +27,7 @@ MYMETA.*
docs/help/Makefile.am
docs/help/[a-z]*
!docs/help/meson.build
!docs/help/in
docs/help/in/Makefile.am
@ -35,9 +36,6 @@ src/fe-fuzz/irssi-fuzz
src/fe-fuzz/irc/core/event-get-params-fuzz
src/fe-fuzz/fe-common/core/theme-load-fuzz
src/fe-common/irc/irc-modules.c
src/irc/irc.c
src/perl/perl-signals-list.h
src/perl/irssi-core.pl.h

View File

@ -243,22 +243,6 @@ else
offt_64bit=no
fi
if test x$ac_cv_sizeof_off_t = x$ac_cv_sizeof_long; then
# try to use unsigned long always first
AC_DEFINE_UNQUOTED(PRIuUOFF_T, "lu")
AC_DEFINE(UOFF_T_LONG)
elif test x$ac_cv_sizeof_off_t = x$ac_cv_sizeof_int; then
# next try int
AC_DEFINE_UNQUOTED(PRIuUOFF_T, "u")
AC_DEFINE(UOFF_T_INT)
elif test x$ac_cv_sizeof_off_t = x$ac_cv_sizeof_long_long; then
# and finally long long
AC_DEFINE_UNQUOTED(PRIuUOFF_T, "llu")
AC_DEFINE(UOFF_T_LONG_LONG)
else
AC_ERROR([Couldn't find integer type for off_t])
fi
dnl **
dnl ** check for socks
dnl **

1
docs/help/in/meson.build Normal file
View File

@ -0,0 +1 @@
# don't forget to add new help files to ../meson.build

121
docs/help/meson.build Normal file
View File

@ -0,0 +1,121 @@
install_data(
files(
'accept',
'action',
'admin',
'alias',
'away',
'ban',
'beep',
'bind',
'cat',
'cd',
'channel',
'clear',
'completion',
'connect',
'ctcp',
'cycle',
'dcc',
'dehilight',
'deop',
'devoice',
'die',
'disconnect',
'echo',
'eval',
'exec',
'flushbuffer',
'format',
'hash',
'help',
'hilight',
'ignore',
'info',
'invite',
'irssiproxy',
'ison',
'join',
'kick',
'kickban',
'kill',
'knock',
'knockout',
'lastlog',
'layout',
'levels',
'links',
'list',
'load',
'log',
'lusers',
'map',
'me',
'mircdcc',
'mode',
'motd',
'msg',
'names',
'nctcp',
'netsplit',
'network',
'nick',
'notice',
'notify',
'op',
'oper',
'otr',
'part',
'ping',
'query',
'quit',
'quote',
'rawlog',
'recode',
'reconnect',
'rehash',
'reload',
'restart',
'rmreconns',
'rmrejoins',
'save',
'sconnect',
'script',
'scrollback',
'server',
'servlist',
'set',
'silence',
'squery',
'squit',
'stats',
'statusbar',
'time',
'toggle',
'topic',
'trace',
'ts',
'unalias',
'unban',
'unignore',
'unload',
'unnotify',
'unquery',
'unsilence',
'upgrade',
'uptime',
'userhost',
'ver',
'version',
'voice',
'wait',
'wall',
'wallops',
'who',
'whois',
'whowas',
'window',
),
install_dir : helpdir)
# subdir('in')

18
docs/meson.build Normal file
View File

@ -0,0 +1,18 @@
install_data(
files(
'capsicum.txt',
'design.html',
'design.txt',
'faq.html',
'faq.txt',
'formats.txt',
'manual.txt',
'perl.txt',
'signals.txt',
'special_vars.txt',
'startup-HOWTO.html',
'startup-HOWTO.txt',
),
install_dir : docdir)
subdir('help')

454
meson.build Normal file
View File

@ -0,0 +1,454 @@
project('irssi', 'c',
version : '1.3-head',
meson_version : '>=0.49',
default_options : ['warning_level=1'])
############################
############################
cc = meson.get_compiler('c')
rootinc = include_directories('.')
dep = []
textui_dep = []
includedir = get_option('includedir')
incdir = 'irssi'
moduledir = get_option('libdir') / incdir / 'modules'
helpdir = get_option('datadir') / incdir / 'help'
themedir = get_option('datadir') / incdir / 'themes'
scriptdir = get_option('datadir') / incdir / 'scripts'
docdir = get_option('docdir') != '' ? get_option('docdir') : (get_option('datadir') / 'doc' / incdir)
want_textui = get_option('without-textui') != 'yes'
want_bot = get_option('with-bot') == 'yes'
want_fuzzer = get_option('with-fuzzer') == 'yes'
fuzzer_lib = get_option('with-fuzzer-lib')
want_proxy = get_option('with-proxy') == 'yes'
want_truecolor = get_option('enable-true-color') == 'yes'
want_gregex = get_option('disable-gregex') != 'yes'
require_capsicum = get_option('with-capsicum') == 'yes'
want_capsicum = get_option('with-capsicum') != 'no'
require_libutf8proc = get_option('disable-utf8proc') == 'no'
want_libutf8proc = get_option('disable-utf8proc') != 'yes'
require_perl = get_option('with-perl') == 'yes'
want_perl = get_option('with-perl') != 'no'
with_perl_lib = get_option('with-perl-lib')
require_otr = get_option('with-otr') == 'yes'
want_otr = get_option('with-otr') != 'no'
want_glib_internal = get_option('install-glib') == 'yes'
chat_modules = ['irc']
run_command('mkdir', meson.current_build_dir() / incdir)
run_command('ln', '-s', meson.current_source_dir() / 'src', meson.current_build_dir() / incdir)
run_command('ln', '-s', meson.current_build_dir() / 'irssi-config.h', meson.current_build_dir() / incdir)
run_command('ln', '-s', meson.current_build_dir() / 'irssi-version.h', meson.current_build_dir() / incdir)
def_moduledir = '-D' + 'MODULEDIR' + '="' + (get_option('prefix') / moduledir) + '"'
def_sysconfdir = '-D' + 'SYSCONFDIR' + '="' + (get_option('prefix') / get_option('sysconfdir')) + '"'
def_helpdir = '-D' + 'HELPDIR' + '="' + (get_option('prefix') / helpdir) + '"'
def_themesdir = '-D' + 'THEMESDIR' + '="' + (get_option('prefix') / themedir) + '"'
def_scriptdir = '-D' + 'SCRIPTDIR' + '="' + (get_option('prefix') / scriptdir) + '"'
def_suppress_printf_fallback = '-D' + 'SUPPRESS_PRINTF_FALLBACK'
##############
# Help files #
##############
perl = find_program('perl')
run_command(perl, files('utils/syntax.pl'))
###################
# irssi-version.h #
###################
env = find_program('env')
irssi_version_sh = find_program('utils/irssi-version.sh')
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()],
output : 'irssi-version.h',
install : true,
install_dir : includedir / incdir,
)
####################
# default-config.h #
####################
file2header = find_program('utils/file2header.sh')
default_config_h = custom_target('default-config.h',
input : files('irssi.conf'),
output : 'default-config.h',
capture : true,
command : [file2header, '@INPUT@', 'default_config'],
)
###################
# 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'],
)
################
# Dependencies #
################
#### inet_addr ####
inet_addr_found = false
foreach inet_addr_provider : ['', 'nsl']
prov_lib = inet_addr_provider != '' ? [cc.find_library(inet_addr_provider, required : false)] : []
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
endif
endforeach
if not inet_addr_found
error('inet_addr not found')
endif
#### socket ####
socket_found = false
foreach socket_provider : ['', 'socket', 'network']
prov_lib = socket_provider != '' ? [cc.find_library(socket_provider, required : false)] : []
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
endif
endforeach
if not socket_found
error('socket not found')
endif
glib_internal = false
message('*** If you don\'t have GLib, you can run meson ... -Dinstall-glib=yes')
message('*** to download and build it automatically')
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')
glib_dep = dependency('glib-2.0', version : '>=2.58', required : not want_glib_internal)
if not glib_dep.found()
glib_internal = true
glib_proj = subproject('glib', default_options : [
'libmount=false',
])
glib_dep = glib_proj.get_variable('libglib_dep')
gmodule_dep = glib_proj.get_variable('libgmodule_dep')
else
gmodule_dep = dependency('gmodule-2.0')
endif
dep += glib_dep
dep += gmodule_dep
openssl_dep = dependency('openssl')
dep += openssl_dep
############
# utf8proc #
############
have_libutf8proc = false
libutf8proc = []
if want_libutf8proc
libutf8proc = cc.find_library('utf8proc', required : require_libutf8proc)
have_libutf8proc = cc.has_function('utf8proc_version', dependencies : libutf8proc)
if have_libutf8proc
dep += libutf8proc
endif
endif
############################
############################
############
# terminfo #
############
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)
textui_dep += prov_lib
setupterm_found = true
break
endif
endforeach
if not setupterm_found
error('Terminfo not found')
endif
endif
########
# perl #
########
have_perl = false
if want_perl
perl_cflags = []
perl_ldflags = []
perl_rpath = ''
#### ccopts ####
res = run_command(perl, '-MExtUtils::Embed', '-e', 'ccopts')
foreach fl : res.stdout().strip().split()
if fl.startswith('-D') or fl.startswith('-U') or fl.startswith('-I') or fl.startswith('-i') or fl.startswith('-f') or fl.startswith('-m')
perl_cflags += fl
endif
endforeach
perl_cflags += cc.get_supported_arguments('-fPIC')
#### ldopts ####
res = run_command(perl, '-MExtUtils::Embed', '-e', 'ldopts')
skip_libs = ['-ldb', '-ldbm', '-lndbm', '-lgdbm', '-lc', '-lposix', '-rdynamic']
foreach fl : res.stdout().strip().split()
if not fl.startswith('-A') and not skip_libs.contains(fl)
if fl.startswith('-Wl,-rpath,')
perl_rpath = fl.split(',')[2]
else
perl_ldflags += fl
endif
endif
endforeach
perl_dep = declare_dependency(compile_args : perl_cflags, link_args : perl_ldflags,
version : run_command(perl, '-V::version:').stdout().split('\'')[1])
####
if not cc.run('''
#include <EXTERN.h>
#include <perl.h>
int main()
{
perl_alloc();
return 0;
}
''', args : perl_cflags + perl_ldflags, name : 'working Perl support').compiled()
if require_perl
error('error linking with perl libraries')
else
warning('error linking with perl libraries')
endif
else
xsubpp_file_c = run_command(perl, '-MExtUtils::ParseXS', '-Eprint $INC{"ExtUtils/ParseXS.pm"} =~ s{ParseXS\\.pm$}{xsubpp}r').stdout()
xsubpp = generator(perl,
output : '@BASENAME@.c',
capture : true,
arguments : [ xsubpp_file_c, '@EXTRA_ARGS@', '@INPUT@' ],
)
xsubpp_file = files(xsubpp_file_c)
if with_perl_lib == 'module'
perl_install_base = run_command(perl, '-MText::ParseWords=shellwords', '-e', 'grep { s/^INSTALL_BASE=// && print && exit } shellwords $ENV{PERL_MM_OPT}').stdout()
if perl_install_base == ''
with_perl_lib = ''
endif
endif
if with_perl_lib == ''
if get_option('prefix') in ['/usr/local', 'C:/']
with_perl_lib = 'site'
elif get_option('prefix') in ['/usr']
with_perl_lib = 'vendor'
endif
endif
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']
perlmoddir = run_command(perl, '-V::install' + with_perl_lib + 'arch:').stdout().split('\'')[1]
elif with_perl_lib == 'module'
perlmoddir = perl_install_base / 'lib' / 'perl5' / run_command(perl, '-V::archname:').stdout().split('\'')[1]
endif
elif with_perl_lib == ''
set_perl_use_lib = true
perl_library_dir = 'in prefix'
perlmoddir = get_option('libdir') / incdir / 'perl'
elif with_perl_lib.startswith('/')
set_perl_use_lib = true
perl_library_dir = 'custom'
perlmoddir = with_perl_lib
else
error('Unrecognised with-perl-lib value: ' + with_perl_lib)
endif
perl_use_lib = get_option('prefix') / perlmoddir
if set_perl_use_lib
set_perl_use_lib = run_command(perl, '-e', 'exit ! grep $_ eq $ARGV[0], grep /^\\//, @INC', perl_use_lib).returncode() != 0
if not set_perl_use_lib
perl_library_dir += ' - other path in @INC'
else
perl_library_dir += ' - prepends to @INC with /set perl_use_lib'
endif
endif
have_perl = true
endif
endif
#######
# OTR #
#######
have_otr = false
if want_otr
libgcrypt = dependency('libgcrypt', version : '>=1.2.0', required : require_otr)
libotr = dependency('libotr', version : '>=4.1.0', required : require_otr)
if libgcrypt.found() and libotr.found()
dep += libgcrypt
dep += libotr
have_otr = true
endif
endif
############
# capsicum #
############
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_found', dependencies : libnv)
if nvlist_create_found
dep += libnv
have_capsicum = true
else
if require_capsicum
error('nvlist_create not found')
endif
endif
else
if require_capsicum
error('cap_enter not found')
endif
endif
endif
##################
# irssi-config.h #
##################
conf = configuration_data()
conf.set('HAVE_CAPSICUM', have_capsicum, description : 'Build with Capsicum support')
conf.set('HAVE_GMODULE', true)
conf.set('HAVE_SOCKS', false, description : 'Build with socks support')
conf.set('TERM_TRUECOLOR', want_truecolor, description : 'true color support in terminal')
conf.set('USE_GREGEX', want_gregex, description : 'use GRegex for regular expressions')
conf.set10('_DARWIN_USE_64_BIT_INODE', true, description : 'Enable large inode numbers on Mac OS X 10.5.')
headers = [
'sys/ioctl.h',
'sys/resource.h',
'sys/time.h',
'sys/utsname.h',
'dirent.h',
'unistd.h',
]
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.')
endif
endforeach
conf.set('HAVE_LIBUTF8PROC', have_libutf8proc)
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
conf.set_quoted('PACKAGE_TARNAME', meson.project_name())
configure_file(output : 'irssi-config.h',
configuration : conf,
install_dir : includedir / incdir)
##########
# CFLAGS #
##########
#### warnings ####
add_project_arguments('-Wall', 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')
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_link_arguments('-fsanitize=fuzzer-no-link', language : 'c')
endif
##############
# irssi-1.pc #
##############
pc = import('pkgconfig')
pc.generate(filebase : 'irssi-1', name : 'Irssi', description : 'Irssi chat client', requires : glib_internal ? [] : glib_dep)
###########
# irssi.1 #
###########
install_man('docs/irssi.1')
###########
# subdirs #
###########
subdir('src')
subdir('tests')
subdir('docs')
subdir('scripts')
subdir('themes')
# subdir('utils')
############################
############################
message('*** Irssi configured ***')
message('')
message('Building text frontend ........... : ' + want_textui.to_string('yes', 'no'))
message('Building irssi bot ............... : ' + want_bot.to_string('yes', 'no'))
message('Building irssi proxy ............. : ' + want_proxy.to_string('yes', 'no'))
if want_perl and not have_perl
message('Building with Perl support ....... : NO!')
message(' - Try: sudo apt-get install libperl-dev')
message(' - Or: dnf install perl-devel')
else
message('Building with Perl support ....... : ' + have_perl.to_string('yes', 'no'))
endif
if have_perl
message('Perl library directory ........... : ' + perl_use_lib)
message(' ' + perl_library_dir)
endif
message('Install prefix ................... : ' + get_option('prefix'))
message('')
message('Building with true color support.. : ' + want_truecolor.to_string('yes', 'no'))
message('Building with GRegex ............. : ' + want_gregex.to_string('yes', 'no'))
message('Building with Capsicum ........... : ' + have_capsicum.to_string('yes', 'no'))
message('Building with utf8proc ........... : ' + have_libutf8proc.to_string('yes', 'no'))
message('Building with OTR support ........ : ' + have_otr.to_string('yes', 'no'))
message('')
message('If there are any problems, read the INSTALL file.')
message('Now type ninja -C ' + meson.current_build_dir() + ' to build Irssi')
message('')
############################
############################

14
meson_options.txt Normal file
View File

@ -0,0 +1,14 @@
option('without-textui', type : 'combo', description : 'Build without text frontend', choices : ['no', 'yes'])
option('with-bot', type : 'combo', description : 'Build irssi-bot', choices : ['no', 'yes'])
option('with-fuzzer', type : 'combo', description : 'Build irssi-fuzzer', choices : ['no', 'yes'])
option('with-fuzzer-lib', type : 'string', description : 'Specify path to fuzzer library', value : '-fsanitize=fuzzer')
option('with-proxy', type : 'combo', description : 'Build irssi-proxy', choices : ['no', 'yes'])
option('with-perl-lib', type : 'string', description : 'Specify where to install the Perl libraries for Irssi')
option('with-perl', type : 'combo', description : 'Build with Perl support', choices : ['auto', 'yes', 'no'])
option('with-otr', type : 'combo', description : 'Build with OTR support', choices : ['auto', 'yes', 'no'])
option('enable-true-color', type : 'combo', description : 'Build with true color support in terminal', choices : ['no', 'yes'])
option('disable-gregex', type : 'combo', description : 'Build without GRegex (fall back to regex.h)', choices : ['no', 'yes'])
option('disable-utf8proc', type : 'combo', description : 'Build without Julia\'s utf8proc', choices : ['auto', 'yes', 'no'])
option('with-capsicum', type : 'combo', description : 'Build with Capsicum support', choices : ['auto', 'yes', 'no'])
option('install-glib', type : 'combo', description : 'Download and install GLib for you', choices : ['no', 'yes'])
option('docdir', type : 'string', description : 'Documentation directory')

14
scripts/meson.build Normal file
View File

@ -0,0 +1,14 @@
install_data(
files(
'autoop.pl',
'autorejoin.pl',
'buf.pl',
'dns.pl',
'kills.pl',
'mail.pl',
'mlock.pl',
'quitmsg.pl',
'scriptassist.pl',
'usercount.pl',
),
install_dir : scriptdir)

View File

@ -41,15 +41,8 @@
# include <gmodule.h>
#endif
#if defined (UOFF_T_INT)
typedef unsigned int uoff_t;
#elif defined (UOFF_T_LONG)
typedef unsigned long uoff_t;
#elif defined (UOFF_T_LONG_LONG)
typedef unsigned long long uoff_t;
#else
# error uoff_t size not set
#endif
typedef guint64 uoff_t;
#define PRIuUOFF_T G_GUINT64_FORMAT
/* input functions */
#define G_INPUT_READ (1 << 0)

129
src/core/meson.build Normal file
View File

@ -0,0 +1,129 @@
# this file is part of irssi
if want_gregex
regex_impl = files('iregex-gregex.c')
else
regex_impl = files('iregex-regexh.c')
endif
if have_capsicum
core_capsicum_source = files('fe-capsicum.c')
else
core_capsicum_source = []
endif
libcore_a = static_library('core',
files(
'args.c',
'channels-setup.c',
'channels.c',
'chat-commands.c',
'chat-protocols.c',
'chatnets.c',
'commands.c',
'core.c',
'expandos.c',
'ignore.c',
'levels.c',
'line-split.c',
'log-away.c',
'log.c',
'masks.c',
'misc.c',
'modules-load.c',
'modules.c',
'net-disconnect.c',
'net-nonblock.c',
'net-sendbuffer.c',
'network-openssl.c',
'network.c',
'nicklist.c',
'nickmatch-cache.c',
'pidwait.c',
'queries.c',
'rawlog.c',
'recode.c',
'servers-reconnect.c',
'servers-setup.c',
'servers.c',
'session.c',
'settings.c',
'signals.c',
'special-vars.c',
'tls.c',
'utf8.c',
'wcwidth-wrapper.c',
'wcwidth.c',
'write-buffer.c',
)
+ core_capsicum_source
+ regex_impl
+ [
default_config_h,
irssi_version_h,
],
include_directories : rootinc,
implicit_include_directories : false,
c_args : [
def_moduledir,
def_sysconfdir,
],
dependencies : dep)
install_headers(
files(
#### structure_headers ####
'channel-rec.h',
'channel-setup-rec.h',
'chatnet-rec.h',
'query-rec.h',
'server-connect-rec.h',
'server-rec.h',
'server-setup-rec.h',
'window-item-rec.h',
####
'args.h',
'capsicum.h',
'channels-setup.h',
'channels.h',
'chat-protocols.h',
'chatnets.h',
'commands.h',
'core.h',
'expandos.h',
'ignore.h',
'iregex.h',
'levels.h',
'line-split.h',
'log.h',
'masks.h',
'misc.h',
'module.h',
'modules-load.h',
'modules.h',
'net-disconnect.h',
'net-nonblock.h',
'net-sendbuffer.h',
'network-openssl.h',
'network.h',
'nick-rec.h',
'nicklist.h',
'nickmatch-cache.h',
'pidwait.h',
'queries.h',
'rawlog.h',
'recode.h',
'servers-reconnect.h',
'servers-setup.h',
'servers.h',
'session.h',
'settings.h',
'signals.h',
'special-vars.h',
'tls.h',
'utf8.h',
'window-item-def.h',
'write-buffer.h',
),
subdir : incdir / 'src' / 'core')

View File

@ -0,0 +1,99 @@
# this file is part of irssi
if have_capsicum
fe_common_core_capsicum_source = files('fe-capsicum.c')
else
fe_common_core_capsicum_source = []
endif
fe_common_core_sources = [
files(
'chat-completion.c',
'command-history.c',
'completion.c',
'fe-channels.c',
'fe-common-core.c',
'fe-core-commands.c',
'fe-exec.c',
'fe-expandos.c',
'fe-help.c',
'fe-ignore-messages.c',
'fe-ignore.c',
'fe-log.c',
'fe-messages.c',
'fe-modules.c',
'fe-queries.c',
'fe-recode.c',
'fe-server.c',
'fe-settings.c',
'fe-tls.c',
'fe-windows.c',
'formats.c',
'hilight-text.c',
'keyboard.c',
'module-formats.c',
'printtext.c',
'themes.c',
'window-activity.c',
'window-commands.c',
'window-items.c',
'windows-layout.c',
)
+ fe_common_core_capsicum_source
+ [
default_theme_h,
irssi_version_h,
]
]
libfe_common_core_a = static_library('fe_common_core',
fe_common_core_sources,
include_directories : rootinc,
implicit_include_directories : false,
c_args : [
def_helpdir,
def_themesdir,
],
dependencies : dep)
if want_fuzzer
libfuzzer_fe_common_core_a = static_library('fuzzer_fe_common_core',
fe_common_core_sources,
include_directories : rootinc,
implicit_include_directories : false,
c_args : [
def_helpdir,
def_themesdir,
def_suppress_printf_fallback,
],
dependencies : dep)
endif
install_headers(
files(
'chat-completion.h',
'command-history.h',
'completion.h',
'fe-capsicum.h',
'fe-channels.h',
'fe-common-core.h',
'fe-core-commands.h',
'fe-exec.h',
'fe-messages.h',
'fe-queries.h',
'fe-recode.h',
'fe-settings.h',
'fe-tls.h',
'fe-windows.h',
'formats.h',
'hilight-text.h',
'keyboard.h',
'module-formats.h',
'module.h',
'printtext.h',
'themes.h',
'window-activity.h',
'window-items.h',
'windows-layout.h',
),
subdir : incdir / 'src' / 'fe-common' / 'core')

View File

@ -447,7 +447,7 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text)
if (dest->window == NULL) {
str = strip_codes(text);
#ifndef SUPPRESS_PRINTF_FALLBACK
printf("NO WINDOWS: %s\n", str);
printf("## NO WINDOWS: %s\n", str);
#endif
g_free(str);
return;

View File

@ -0,0 +1,27 @@
# this file is part of irssi
libfe_irc_dcc_a = static_library('fe_irc_dcc',
files(
'fe-dcc-chat-messages.c',
'fe-dcc-chat.c',
'fe-dcc-get.c',
'fe-dcc-send.c',
'fe-dcc-server.c',
'fe-dcc.c',
'module-formats.c',
),
include_directories : rootinc,
implicit_include_directories : false,
c_args : [
def_helpdir,
def_sysconfdir,
],
dependencies : dep)
install_headers(
files(
'fe-dcc.h',
'module-formats.h',
'module.h',
),
subdir : incdir / 'src' / 'fe-common' / 'irc' / 'dcc')

View File

@ -0,0 +1,4 @@
void fe_irc_dcc_init(void);void fe_irc_notifylist_init(void);
void fe_irc_notifylist_deinit(void);void fe_irc_dcc_deinit(void);
void fe_irc_modules_init(void) { fe_irc_dcc_init(); fe_irc_notifylist_init(); }
void fe_irc_modules_deinit(void) { fe_irc_notifylist_deinit(); fe_irc_dcc_deinit(); }

View File

@ -0,0 +1,44 @@
# this file is part of irssi
libfe_common_irc_a = static_library('fe_common_irc',
files(
'fe-cap.c',
'fe-common-irc.c',
'fe-ctcp.c',
'fe-events-numeric.c',
'fe-events.c',
'fe-irc-channels.c',
'fe-irc-commands.c',
'fe-irc-messages.c',
'fe-irc-queries.c',
'fe-irc-server.c',
'fe-ircnet.c',
'fe-modes.c',
'fe-netjoin.c',
'fe-netsplit.c',
'fe-sasl.c',
'fe-whois.c',
'irc-completion.c',
'module-formats.c',
'irc-modules.c',
),
include_directories : rootinc,
implicit_include_directories : false,
c_args : [
def_helpdir,
def_themesdir,
],
dependencies : dep)
install_headers(
files(
'fe-irc-channels.h',
'fe-irc-server.h',
'module-formats.h',
'module.h',
),
subdir : incdir / 'src' / 'fe-common' / 'irc')
subdir('dcc')
subdir('notifylist')

View File

@ -0,0 +1,21 @@
# this file is part of irssi
libfe_irc_notifylist_a = static_library('fe_irc_notifylist',
files(
'fe-notifylist.c',
'module-formats.c',
),
include_directories : rootinc,
implicit_include_directories : false,
c_args : [
def_helpdir,
def_sysconfdir,
],
dependencies : dep)
install_headers(
files(
'module-formats.h',
'module.h',
),
subdir : incdir / 'src' / 'fe-common' / 'irc' / 'notifylist')

View File

@ -0,0 +1,6 @@
# this file is part of irssi
subdir('core')
foreach s : chat_modules
subdir(s)
endforeach

View File

@ -0,0 +1,21 @@
# this file is part of irssi
executable('theme-load-fuzz',
files(
'theme-load.c',
'../../../fe-text/module-formats.c',
),
link_with : [
libconfig_a,
libcore_a,
libfuzzer_fe_common_core_a,
],
link_args : [fuzzer_lib],
include_directories : rootinc,
implicit_include_directories : false,
install : true,
dependencies : dep
)
# noinst_headers = files(
# '../../../fe-text/module-formats.h',
# )

View File

@ -36,10 +36,10 @@
#include <string.h>
int LLVMFuzzerInitialize(int *argc, char ***argv) {
core_register_options();
fe_common_core_register_options();
char *irssi_argv[] = {*argv[0], "--home", "/tmp/irssi", NULL};
int irssi_argc = sizeof(irssi_argv) / sizeof(char *) - 1;
core_register_options();
fe_common_core_register_options();
args_execute(irssi_argc, irssi_argv);
core_preinit((*argv)[0]);
core_init();
@ -50,6 +50,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv) {
}
int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
THEME_REC *theme;
gchar *copy = g_strndup((const gchar *)data, size);
FILE *fp = fopen("/tmp/irssi/fuzz.theme", "wb");
@ -58,7 +59,7 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
fclose(fp);
}
THEME_REC *theme = theme_load("fuzz");
theme = theme_load("fuzz");
theme_destroy(theme);
g_free(copy);

View File

@ -0,0 +1,3 @@
# this file is part of irssi
subdir('core')

View File

@ -48,17 +48,21 @@ int LLVMFuzzerInitialize(int *argc, char ***argv) {
}
int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (size < 1) {
return 0;
}
uint8_t count = *data;
gchar *copy = g_strndup((const gchar *)data+1, size-1);
gchar *copy;
char *output0;
char *output1;
char *output2;
char *output3;
char *params;
if (size < 1) {
return 0;
}
copy = g_strndup((const gchar *)data+1, size-1);
if (count % 8 == 0) {
params = event_get_params(copy, 1 | PARAM_FLAG_GETREST, &output0);
} else if (count % 8 == 1) {

View File

@ -0,0 +1,23 @@
# this file is part of irssi
executable('event-get-params-fuzz',
files(
'event-get-params.c',
'../../../fe-text/module-formats.c',
),
link_with : [
libconfig_a,
libcore_a,
libirc_a,
libfuzzer_fe_common_core_a,
],
link_args : [fuzzer_lib],
include_directories : rootinc,
implicit_include_directories : false,
install : true,
dependencies : dep
)
# noinst_headers = files(
# '../../../fe-text/module-formats.h',
# )

View File

@ -0,0 +1,3 @@
# this file is part of irssi
subdir('core')

46
src/fe-fuzz/meson.build Normal file
View File

@ -0,0 +1,46 @@
# this file is part of irssi
subdir('irc')
subdir('fe-common')
executable('irssi-fuzz',
files(
'irssi.c',
'../fe-text/module-formats.c',
),
link_with : [
libconfig_a,
libcore_a,
libfuzzer_fe_common_core_a,
],
link_args : [fuzzer_lib],
include_directories : rootinc,
implicit_include_directories : false,
install : true,
dependencies : dep
)
executable('server-fuzz',
files(
'server.c',
'../fe-text/module-formats.c',
),
link_with : [
libconfig_a,
libcore_a,
libfuzzer_fe_common_core_a,
libirc_a,
libfe_common_irc_a,
libfe_irc_dcc_a,
libfe_irc_notifylist_a,
],
link_args : [fuzzer_lib],
include_directories : rootinc,
implicit_include_directories : false,
install : true,
dependencies : dep
)
# noinst_headers = files(
# '../fe-text/module-formats.h',
# )

View File

@ -150,13 +150,18 @@ int LLVMFuzzerInitialize(int *argc, char ***argv) {
}
int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
gboolean prefixedChoice = (gboolean)*data;
gchar *copy;
gchar **lines;
gchar **head;
if (size < 1) return 0;
test_server();
gboolean prefixedChoice = (gboolean)*data;
gchar *copy = g_strndup((const gchar *)data+1, size-1);
gchar **lines = g_strsplit(copy, "\r\n", -1);
gchar **head = lines;
copy = g_strndup((const gchar *)data+1, size-1);
lines = g_strsplit(copy, "\r\n", -1);
head = lines;
for (; *lines != NULL; lines++) {
gchar *prefixedLine;

21
src/fe-none/meson.build Normal file
View File

@ -0,0 +1,21 @@
# this file is part of irssi
executable('botti',
files(
'irssi.c',
),
include_directories : rootinc,
implicit_include_directories : false,
export_dynamic : true,
link_with : [
libconfig_a,
libcore_a,
libirc_a,
],
install : true,
dependencies : dep
)
# noinst_headers = files(
# 'module.h',
# )

68
src/fe-text/meson.build Normal file
View File

@ -0,0 +1,68 @@
# this file is part of irssi
executable('irssi',
files(
#### terminfo_sources ####
'term-terminfo.c',
'terminfo-core.c',
#### irssi sources ####
'gui-entry.c',
'gui-expandos.c',
'gui-printtext.c',
'gui-readline.c',
'gui-windows.c',
'irssi.c',
'lastlog.c',
'mainwindow-activity.c',
'mainwindows-layout.c',
'mainwindows.c',
'module-formats.c',
'statusbar-config.c',
'statusbar-items.c',
'statusbar.c',
'term.c',
'textbuffer-commands.c',
'textbuffer-view.c',
'textbuffer.c',
)
+ [ irssi_version_h ],
include_directories : rootinc,
implicit_include_directories : false,
export_dynamic : true,
link_with : [
libconfig_a,
libcore_a,
libfe_common_core_a,
libirc_a,
libfe_common_irc_a,
libfe_irc_dcc_a,
libfe_irc_notifylist_a,
],
install : true,
install_rpath : get_option('prefix') / get_option('libdir'),
dependencies : dep
+ textui_dep
)
install_headers(
files(
'gui-printtext.h',
'gui-windows.h',
'mainwindows.h',
'statusbar-item.h',
'statusbar.h',
'term.h',
'textbuffer-view.h',
'textbuffer.h',
),
subdir : incdir / 'src' / 'fe-text')
# noinst_headers = files(
# 'gui-entry.h',
# 'gui-readline.h',
# 'module-formats.h'
# 'module.h',
# 'statusbar-config.h',
# 'terminfo-core.h',
# )

66
src/irc/core/meson.build Normal file
View File

@ -0,0 +1,66 @@
# this file is part of irssi
libirc_core_a = static_library('irc_core',
files(
'bans.c',
'channel-events.c',
'channel-rejoin.c',
'channels-query.c',
'ctcp.c',
'irc-cap.c',
'irc-channels-setup.c',
'irc-channels.c',
'irc-chatnets.c',
'irc-commands.c',
'irc-core.c',
'irc-expandos.c',
'irc-masks.c',
'irc-nicklist.c',
'irc-queries.c',
'irc-servers-reconnect.c',
'irc-servers-setup.c',
'irc-servers.c',
'irc-session.c',
'irc.c',
'lag.c',
'massjoin.c',
'mode-lists.c',
'modes.c',
'netsplit.c',
'sasl.c',
'servers-idle.c',
'servers-redirect.c',
),
include_directories : rootinc,
implicit_include_directories : false,
c_args : [
def_moduledir,
def_sysconfdir,
],
dependencies : dep)
install_headers(
files(
'bans.h',
'channel-events.h',
'channel-rejoin.h',
'ctcp.h',
'irc-cap.h',
'irc-channels.h',
'irc-chatnets.h',
'irc-commands.h',
'irc-masks.h',
'irc-nicklist.h',
'irc-queries.h',
'irc-servers-setup.h',
'irc-servers.h',
'irc.h',
'mode-lists.h',
'modes.h',
'module.h',
'netsplit.h',
'sasl.h',
'servers-idle.h',
'servers-redirect.h',
),
subdir : incdir / 'src' / 'irc' / 'core')

31
src/irc/dcc/meson.build Normal file
View File

@ -0,0 +1,31 @@
# this file is part of irssi
libirc_dcc_a = static_library('irc_dcc',
files(
'dcc-autoget.c',
'dcc-chat.c',
'dcc-get.c',
'dcc-queue.c',
'dcc-resume.c',
'dcc-send.c',
'dcc-server.c',
'dcc.c',
),
include_directories : rootinc,
implicit_include_directories : false,
dependencies : dep)
install_headers(
files(
'dcc-chat.h',
'dcc-file-rec.h',
'dcc-file.h',
'dcc-get.h',
'dcc-queue.h',
'dcc-rec.h',
'dcc-send.h',
'dcc-server.h',
'dcc.h',
'module.h',
),
subdir : incdir / 'src' / 'irc' / 'dcc')

14
src/irc/flood/meson.build Normal file
View File

@ -0,0 +1,14 @@
# this file is part of irssi