diff --git a/.gitignore b/.gitignore index ee1480cb..f42839eb 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/.travis.yml b/.travis.yml index 30f9cc35..a09b7271 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,9 @@ sudo: false -dist: trusty +dist: xenial language: perl perl: # ~stretch - "5.24-shrplib" - # ~xenial - # - "5.22-shrplib" - # ~jessie - # - "5.20-shrplib" - # ~trusty - # - "5.18-shrplib" - "system-perl" env: - CC=clang UNITTESTS=false @@ -28,22 +22,23 @@ addons: - libperl-dev - elinks - libgcrypt11-dev + - libotr5-dev before_install: - perl -V - - wget https://github.com/irssi-import/libotr/releases/download/4.1.1/travis-trusty-libotr-4.1.1.tar.gz - - tar zxf travis-trusty-libotr*.tar.gz -C $HOME - - ./autogen.sh --with-proxy --with-bot --with-perl=module --with-otr=yes --with-libotr-prefix=$HOME/otr-build/lib --with-libotr-inc-prefix=$HOME/otr-build/include - - make dist - - cd .. - - tar xaf */irssi-*.tar.* - - cd irssi-* + - pushd ~ + - curl -sSLf https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip | funzip > bin/ninja + - chmod +x bin/ninja + - curl -sSLf https://github.com/mesonbuild/meson/releases/download/0.51.1/meson-0.51.1.tar.gz | tar xz + - ( cd bin ; ln -s ../meson-*/meson.py meson ) + - curl -sSLf https://github.com/irssi-import/glib-travis-build/releases/download/2.58.3/travis-xenial-glib-2.58.3.tar.xz | tar xJ + - export PKG_CONFIG_PATH=$HOME/glib-build/lib/x86_64-linux-gnu/pkgconfig + - popd install: - - ./configure --with-proxy --with-bot --with-perl=module --with-otr=yes --with-libotr-prefix=$HOME/otr-build/lib --with-libotr-inc-prefix=$HOME/otr-build/include --prefix=$HOME/irssi-build - $( $UNITTESTS && echo --enable-always-build-tests ) - - make CFLAGS="-Wall -Werror -Werror=declaration-after-statement" - - make install + - meson Build -Dwith-proxy=yes -Dwith-bot=yes -Dwith-perl=yes -Dwith-otr=yes --prefix=$HOME/irssi-build + - ninja -C Build + - ninja -C Build install before_script: - pushd ~ @@ -62,8 +57,8 @@ before_script: script: - irssi-build/bin/irssi --home irssi-test - popd - - if $UNITTESTS; then make -C tests -sk check; fi + - if $UNITTESTS; then ninja -C Build test; fi after_script: - cat ~/irc.log.* - - find -name test-suite.log -exec cat {} + + - find -name testlog.txt -exec sed -i -e '/Inherited environment:.* TRAVIS/d' {} + -exec cat {} + diff --git a/configure.ac b/configure.ac index 9c0243f7..7d35aefa 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ** diff --git a/docs/help/in/meson.build b/docs/help/in/meson.build new file mode 100644 index 00000000..aa459b7d --- /dev/null +++ b/docs/help/in/meson.build @@ -0,0 +1 @@ +# don't forget to add new help files to ../meson.build diff --git a/docs/help/meson.build b/docs/help/meson.build new file mode 100644 index 00000000..7fe95d43 --- /dev/null +++ b/docs/help/meson.build @@ -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') diff --git a/docs/meson.build b/docs/meson.build new file mode 100644 index 00000000..a58faed3 --- /dev/null +++ b/docs/meson.build @@ -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') diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..f1e23169 --- /dev/null +++ b/meson.build @@ -0,0 +1,497 @@ +project('irssi', 'c', + version : '1.3-head', + meson_version : '>=0.49', + default_options : ['warning_level=1']) + +############################ +############################ + +glib_internal_version = 'glib-2.58.3' # keep this in sync with subprojects/glib.wrap +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 + meson_cmd = find_program('meson') + ninja = find_program('ninja') + 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'], + ) + glib_internal_configure_t = custom_target('glib-internal-configure', + command : [ meson_cmd, 'setup', '--prefix=/irssi-glib-internal', + '--buildtype=' + get_option('buildtype'), + '-Dlibmount=false', '-Dselinux=false', '-Ddefault_library=static', '-Dinternal_pcre=true', + (meson.current_build_dir() / 'build-subprojects' / 'glib'), + (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', + 'glib' / 'libglib-2.0.a', + 'gmodule' / 'libgmodule-2.0.a'], + console : true, + output : ['glib-internal-build'], + depends : glib_internal_configure_t,) + glib_dep = declare_dependency( + dependencies : [ + dependency('threads'), + ], + sources : glib_internal_build_t, + compile_args : [ + '-I' + (meson.current_source_dir() / 'subprojects' / glib_internal_version / 'glib'), + '-I' + (meson.current_source_dir() / 'subprojects' / glib_internal_version), + '-I' + (meson.current_build_dir() / 'build-subprojects' / 'glib' / 'glib'), + ], + link_args : [ meson.current_build_dir() / 'build-subprojects' / 'glib' / 'glib' / 'libglib-2.0.a' ], + ) + 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, + dependencies : libdl_dep, + compile_args : [ + '-I' + (meson.current_source_dir() / 'subprojects' / glib_internal_version / 'gmodule'), + ], + link_args : [ meson.current_build_dir() / 'build-subprojects' / 'glib' / 'gmodule' / 'libgmodule-2.0.a' ], + ) +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 +#include +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('') + +############################ +############################ diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 00000000..579b9cda --- /dev/null +++ b/meson_options.txt @@ -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') diff --git a/scripts/meson.build b/scripts/meson.build new file mode 100644 index 00000000..072ac3ea --- /dev/null +++ b/scripts/meson.build @@ -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) diff --git a/src/common.h b/src/common.h index ef4b0c15..d7eaac45 100644 --- a/src/common.h +++ b/src/common.h @@ -41,15 +41,8 @@ # include #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) diff --git a/src/core/meson.build b/src/core/meson.build new file mode 100644 index 00000000..dd5a4d49 --- /dev/null +++ b/src/core/meson.build @@ -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') diff --git a/src/fe-common/core/meson.build b/src/fe-common/core/meson.build new file mode 100644 index 00000000..73cb156a --- /dev/null +++ b/src/fe-common/core/meson.build @@ -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') diff --git a/src/fe-common/core/printtext.c b/src/fe-common/core/printtext.c index 3e215d72..1826c754 100644 --- a/src/fe-common/core/printtext.c +++ b/src/fe-common/core/printtext.c @@ -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; diff --git a/src/fe-common/irc/dcc/meson.build b/src/fe-common/irc/dcc/meson.build new file mode 100644 index 00000000..296b1d61 --- /dev/null +++ b/src/fe-common/irc/dcc/meson.build @@ -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') diff --git a/src/fe-common/irc/irc-modules.c b/src/fe-common/irc/irc-modules.c new file mode 100644 index 00000000..3bf1f327 --- /dev/null +++ b/src/fe-common/irc/irc-modules.c @@ -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(); } diff --git a/src/fe-common/irc/meson.build b/src/fe-common/irc/meson.build new file mode 100644 index 00000000..1789133c --- /dev/null +++ b/src/fe-common/irc/meson.build @@ -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') diff --git a/src/fe-common/irc/notifylist/meson.build b/src/fe-common/irc/notifylist/meson.build new file mode 100644 index 00000000..2e66c786 --- /dev/null +++ b/src/fe-common/irc/notifylist/meson.build @@ -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') diff --git a/src/fe-common/meson.build b/src/fe-common/meson.build new file mode 100644 index 00000000..05ab38a1 --- /dev/null +++ b/src/fe-common/meson.build @@ -0,0 +1,6 @@ +# this file is part of irssi + +subdir('core') +foreach s : chat_modules + subdir(s) +endforeach diff --git a/src/fe-fuzz/fe-common/core/meson.build b/src/fe-fuzz/fe-common/core/meson.build new file mode 100644 index 00000000..679c19ce --- /dev/null +++ b/src/fe-fuzz/fe-common/core/meson.build @@ -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', +# ) diff --git a/src/fe-fuzz/fe-common/core/theme-load.c b/src/fe-fuzz/fe-common/core/theme-load.c index 87429ac4..fbb35684 100644 --- a/src/fe-fuzz/fe-common/core/theme-load.c +++ b/src/fe-fuzz/fe-common/core/theme-load.c @@ -36,10 +36,10 @@ #include 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); diff --git a/src/fe-fuzz/fe-common/meson.build b/src/fe-fuzz/fe-common/meson.build new file mode 100644 index 00000000..da02f2cf --- /dev/null +++ b/src/fe-fuzz/fe-common/meson.build @@ -0,0 +1,3 @@ +# this file is part of irssi + +subdir('core') diff --git a/src/fe-fuzz/irc/core/event-get-params.c b/src/fe-fuzz/irc/core/event-get-params.c index 36aeacf7..740602d1 100644 --- a/src/fe-fuzz/irc/core/event-get-params.c +++ b/src/fe-fuzz/irc/core/event-get-params.c @@ -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) { diff --git a/src/fe-fuzz/irc/core/meson.build b/src/fe-fuzz/irc/core/meson.build new file mode 100644 index 00000000..23d1271f --- /dev/null +++ b/src/fe-fuzz/irc/core/meson.build @@ -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', +# ) diff --git a/src/fe-fuzz/irc/meson.build b/src/fe-fuzz/irc/meson.build new file mode 100644 index 00000000..da02f2cf --- /dev/null +++ b/src/fe-fuzz/irc/meson.build @@ -0,0 +1,3 @@ +# this file is part of irssi + +subdir('core') diff --git a/src/fe-fuzz/meson.build b/src/fe-fuzz/meson.build new file mode 100644 index 00000000..5dccd38d --- /dev/null +++ b/src/fe-fuzz/meson.build @@ -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', +# ) diff --git a/src/fe-fuzz/server.c b/src/fe-fuzz/server.c index 2e8cd3d2..cde03b89 100644 --- a/src/fe-fuzz/server.c +++ b/src/fe-fuzz/server.c @@ -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; diff --git a/src/fe-none/meson.build b/src/fe-none/meson.build new file mode 100644 index 00000000..58df15f6 --- /dev/null +++ b/src/fe-none/meson.build @@ -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', +# ) diff --git a/src/fe-text/meson.build b/src/fe-text/meson.build new file mode 100644 index 00000000..9070011e --- /dev/null +++ b/src/fe-text/meson.build @@ -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', +# ) diff --git a/src/irc/core/meson.build b/src/irc/core/meson.build new file mode 100644 index 00000000..e6cc89c7 --- /dev/null +++ b/src/irc/core/meson.build @@ -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') diff --git a/src/irc/dcc/meson.build b/src/irc/dcc/meson.build new file mode 100644 index 00000000..0c3d706a --- /dev/null +++ b/src/irc/dcc/meson.build @@ -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') diff --git a/src/irc/flood/meson.build b/src/irc/flood/meson.build new file mode 100644 index 00000000..75107db1 --- /dev/null +++ b/src/irc/flood/meson.build @@ -0,0 +1,14 @@ +# this file is part of irssi + +libirc_flood_a = static_library('irc_flood', + files( + 'autoignore.c', + 'flood.c', + ), + include_directories : rootinc, + implicit_include_directories : false, + dependencies : dep) + +install_headers( + files('module.h'), + subdir : incdir / 'src' / 'irc' / 'flood') diff --git a/src/irc/irc.c b/src/irc/irc.c new file mode 100644 index 00000000..250a6fb4 --- /dev/null +++ b/src/irc/irc.c @@ -0,0 +1,5 @@ +void irc_core_init(void); void irc_core_deinit(void); +void irc_dcc_init(void);void irc_flood_init(void);void irc_notifylist_init(void); +void irc_notifylist_deinit(void);void irc_flood_deinit(void);void irc_dcc_deinit(void); +void irc_init(void) { irc_core_init(); irc_dcc_init(); irc_flood_init(); irc_notifylist_init(); } +void irc_deinit(void) { irc_notifylist_deinit(); irc_flood_deinit(); irc_dcc_deinit(); irc_core_deinit(); } diff --git a/src/irc/meson.build b/src/irc/meson.build new file mode 100644 index 00000000..72abc3ce --- /dev/null +++ b/src/irc/meson.build @@ -0,0 +1,24 @@ +# this file is part of irssi + +subdir('core') +subdir('dcc') +subdir('flood') +subdir('notifylist') + +libirc_a = static_library('irc', + files( + 'irc.c', + ), + link_with : [ + libirc_core_a, + libirc_dcc_a, + libirc_flood_a, + libirc_notifylist_a, + ], + include_directories : rootinc, + implicit_include_directories : false, +) + +if want_proxy + subdir('proxy') +endif diff --git a/src/irc/notifylist/meson.build b/src/irc/notifylist/meson.build new file mode 100644 index 00000000..f00ea321 --- /dev/null +++ b/src/irc/notifylist/meson.build @@ -0,0 +1,21 @@ +# this file is part of irssi + +libirc_notifylist_a = static_library('irc_notifylist', + files( + 'notify-commands.c', + 'notify-ison.c', + 'notify-setup.c', + 'notify-whois.c', + 'notifylist.c', + ), + include_directories : rootinc, + implicit_include_directories : false, + dependencies : dep) + +install_headers( + files( + 'module.h', + 'notify-setup.h', + 'notifylist.h', + ), + subdir : incdir / 'src' / 'irc' / 'notifylist') diff --git a/src/irc/proxy/meson.build b/src/irc/proxy/meson.build new file mode 100644 index 00000000..be91c7d5 --- /dev/null +++ b/src/irc/proxy/meson.build @@ -0,0 +1,20 @@ +# this file is part of irssi + +shared_module('irc_proxy', + files( + 'dump.c', + 'listen.c', + 'proxy.c', + ) + + [ irssi_version_h ], + include_directories : rootinc, + implicit_include_directories : false, + install : true, + install_dir : moduledir, + dependencies : dep, +) + +# noinst_headers = files( +# 'module.h', +# 'proxy.h', +# ) diff --git a/src/lib-config/meson.build b/src/lib-config/meson.build new file mode 100644 index 00000000..2bc094dd --- /dev/null +++ b/src/lib-config/meson.build @@ -0,0 +1,19 @@ +# this file is part of irssi + +libconfig_a = static_library('irssi_config', + files( + 'get.c', + 'parse.c', + 'set.c', + 'write.c', + ), + include_directories : rootinc, + implicit_include_directories : false, + dependencies : dep) + +install_headers( + files( + 'iconfig.h', + 'module.h', + ), + subdir : incdir / 'src' / 'lib-config') diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 00000000..dee8dc3c --- /dev/null +++ b/src/meson.build @@ -0,0 +1,29 @@ +# this file is part of irssi + +subdir('lib-config') +subdir('core') +foreach s : chat_modules + subdir(s) +endforeach +subdir('fe-common') +if have_perl + subdir('perl') +endif +if have_otr + subdir('otr') +endif +if want_bot + subdir('fe-none') +endif +if want_textui + subdir('fe-text') +endif +if want_fuzzer + subdir('fe-fuzz') +endif + +install_headers( + files( + 'common.h' + ), + subdir : incdir / 'src') diff --git a/src/otr/meson.build b/src/otr/meson.build new file mode 100644 index 00000000..10b9fa55 --- /dev/null +++ b/src/otr/meson.build @@ -0,0 +1,26 @@ +# this file is part of irssi + +shared_module('otr_core', + files( + 'key.c', + 'otr-fe.c', + 'otr-formats.c', + 'otr-module.c', + 'otr-ops.c', + 'otr.c', + ), + include_directories : rootinc, + implicit_include_directories : false, + install : true, + install_dir : moduledir, + dependencies : dep, +) + +# noinst_headers = files( +# 'irssi-otr.h', +# 'key.h', +# 'module.h', +# 'otr-fe.h', +# 'otr-formats.h', +# 'otr.h', +# ) diff --git a/src/perl/common/meson.build b/src/perl/common/meson.build new file mode 100644 index 00000000..2cbf7f4c --- /dev/null +++ b/src/perl/common/meson.build @@ -0,0 +1,37 @@ +libperl_common_a = shared_module('Irssi', + [ xsubpp.process( + files( + 'Channel.xs', + 'Core.xs', + 'Expando.xs', + 'Ignore.xs', + 'Irssi.xs', + 'Log.xs', + 'Masks.xs', + 'Query.xs', + 'Rawlog.xs', + 'Server.xs', + 'Settings.xs', + ) + ) ] + + files( + 'module.h', + ) + + [ irssi_version_h ], + name_prefix : '', + install : true, + install_dir : perlmoddir / 'auto' / 'Irssi', + include_directories : rootinc, + implicit_include_directories : true, + dependencies : dep + [ perl_dep ], +) + +install_headers( + files( + 'Irssi.pm', + ), + install_dir : perlmoddir, +) + +# 'Makefile.PL.in', +# 'typemap', diff --git a/src/perl/get-signals.pl b/src/perl/get-signals.pl index 806bcafa..275be157 100755 --- a/src/perl/get-signals.pl +++ b/src/perl/get-signals.pl @@ -6,7 +6,7 @@ print " * do not edit.\n"; print " */\n\n"; print "static PERL_SIGNAL_ARGS_REC perl_signal_args[] =\n{\n"; -while () { +while (<>) { chomp; next if (!/^ "([^"]*)"(<.*>)?(?:,\s*(.*))?/); diff --git a/src/perl/irc/meson.build b/src/perl/irc/meson.build new file mode 100644 index 00000000..7d77e0c1 --- /dev/null +++ b/src/perl/irc/meson.build @@ -0,0 +1,39 @@ +libperl_irc_a = shared_module('Irc', + [ xsubpp.process( + files( + 'Channel.xs', + 'Client.xs', + 'Ctcp.xs', + 'Dcc.xs', + 'Irc.xs', + 'Modes.xs', + 'Netsplit.xs', + 'Notifylist.xs', + 'Query.xs', + 'Server.xs', + ), + extra_args : [ + '-typemap', + '../common/typemap', + ], + ) ] + + files( + 'module.h', + ), + name_prefix : '', + install : true, + install_dir : perlmoddir / 'auto' / 'Irssi' / 'Irc', + include_directories : rootinc, + implicit_include_directories : true, + dependencies : dep + [ perl_dep ], +) + +install_headers( + files( + 'Irc.pm', + ), + install_dir : perlmoddir / 'Irssi', +) + +# 'Makefile.PL.in', +# 'typemap', diff --git a/src/perl/meson.build b/src/perl/meson.build new file mode 100644 index 00000000..e3935814 --- /dev/null +++ b/src/perl/meson.build @@ -0,0 +1,73 @@ + +perl_signals_list_h = custom_target('perl-signals-list.h', + input : files('../../docs/signals.txt'), + output : 'perl-signals-list.h', + capture : true, + depend_files : files('get-signals.pl'), + command : [perl, files('get-signals.pl'), '@INPUT@'], +) + +irssi_core_pl_h = custom_target('irssi-core.pl.h', + input : files('irssi-core.pl'), + output : 'irssi-core.pl.h', + capture : true, + command : [file2header, '@INPUT@', 'irssi_core_code'], +) + +shared_module('perl_core', + files( + 'perl-common.c', + 'perl-core.c', + 'perl-signals.c', + 'perl-sources.c', + ) + [ + irssi_core_pl_h, + perl_signals_list_h, + ], + c_args : [ + def_scriptdir, + '-D' + 'PERL_USE_LIB' + '="' + (set_perl_use_lib ? perl_use_lib : '') + '"', + '-D' + 'PERL_STATIC_LIBS' + '=' + 0.to_string(), + ], + include_directories : rootinc, + implicit_include_directories : false, + install : true, + install_dir : moduledir, + install_rpath : perl_rpath, + build_rpath : perl_rpath, + dependencies : dep + [ perl_dep ], +) + +shared_module('fe_perl', + files( + 'module-formats.c', + 'perl-fe.c', + ), + c_args : [ + def_scriptdir, + ], + include_directories : rootinc, + implicit_include_directories : false, + install : true, + install_dir : moduledir, + dependencies : dep, +) + +subdir('common') +foreach s : chat_modules + subdir(s) +endforeach +subdir('ui') +if want_textui + subdir('textui') +endif + +# noinst_headers = files( +# 'module-fe.h', +# 'module-formats.h', +# 'module.h', +# 'perl-common.h', +# 'perl-core.h', +# 'perl-signals.h', +# 'perl-sources.h', +# ) diff --git a/src/perl/textui/meson.build b/src/perl/textui/meson.build new file mode 100644 index 00000000..61362d52 --- /dev/null +++ b/src/perl/textui/meson.build @@ -0,0 +1,35 @@ +libperl_textui_a = shared_module('TextUI', + [ xsubpp.process( + files( + 'Statusbar.xs', + 'TextBufferView.xs', + 'TextBuffer.xs', + 'TextUI.xs', + ), + extra_args : [ + '-typemap', + '../common/typemap', + '-typemap', + '../ui/typemap', + ], + ) ] + + files( + 'module.h', + ), + name_prefix : '', + install : true, + install_dir : perlmoddir / 'auto' / 'Irssi' / 'TextUI', + include_directories : rootinc, + implicit_include_directories : true, + dependencies : dep + [ perl_dep ], +) + +install_headers( + files( + 'TextUI.pm', + ), + install_dir : perlmoddir / 'Irssi', +) + +# 'Makefile.PL.in', +# 'typemap', diff --git a/src/perl/ui/meson.build b/src/perl/ui/meson.build new file mode 100644 index 00000000..eca864dd --- /dev/null +++ b/src/perl/ui/meson.build @@ -0,0 +1,33 @@ +libperl_ui_a = shared_module('UI', + [ xsubpp.process( + files( + 'Formats.xs', + 'Themes.xs', + 'UI.xs', + 'Window.xs', + ), + extra_args : [ + '-typemap', + '../common/typemap', + ], + ) ] + + files( + 'module.h', + ), + name_prefix : '', + install : true, + install_dir : perlmoddir / 'auto' / 'Irssi' / 'UI', + include_directories : rootinc, + implicit_include_directories : true, + dependencies : dep + [ perl_dep ], +) + +install_headers( + files( + 'UI.pm', + ), + install_dir : perlmoddir / 'Irssi', +) + +# 'Makefile.PL.in', +# 'typemap', diff --git a/subprojects/glib.wrap b/subprojects/glib.wrap new file mode 100644 index 00000000..5cb40b0e --- /dev/null +++ b/subprojects/glib.wrap @@ -0,0 +1,6 @@ +[wrap-file] +# make sure to update the glib_internal_version in meson.build +directory = glib-2.58.3 +source_url = https://download.gnome.org/sources/glib/2.58/glib-2.58.3.tar.xz +source_filename = glib-2.58.3.tar.xz +source_hash = 8f43c31767e88a25da72b52a40f3301fefc49a665b56dc10ee7cc9565cbe7481 diff --git a/tests/fe-common/core/meson.build b/tests/fe-common/core/meson.build new file mode 100644 index 00000000..44b11222 --- /dev/null +++ b/tests/fe-common/core/meson.build @@ -0,0 +1,19 @@ +test_test_formats = executable('test-formats', + files( + 'test-formats.c', + ), + link_with : [ + libconfig_a, + libcore_a, + libfe_common_core_a, + ], + c_args : [ + '-D' + 'PACKAGE_STRING' + '="' + 'fe-common/core' + '"', + ], + include_directories : rootinc, + implicit_include_directories : false, + dependencies : dep +) +test('test-formats test', test_test_formats, + args : ['--tap'], + protocol : 'tap') diff --git a/tests/fe-common/meson.build b/tests/fe-common/meson.build new file mode 100644 index 00000000..dd52d8a4 --- /dev/null +++ b/tests/fe-common/meson.build @@ -0,0 +1 @@ +subdir('core') diff --git a/tests/fe-text/meson.build b/tests/fe-text/meson.build new file mode 100644 index 00000000..ea6ec620 --- /dev/null +++ b/tests/fe-text/meson.build @@ -0,0 +1,30 @@ +test_test_paste_join_multiline = executable('test-paste-join-multiline', + files( + '../../src/fe-text/gui-entry.c', + '../../src/fe-text/gui-printtext.c', + '../../src/fe-text/gui-windows.c', + '../../src/fe-text/mainwindows.c', + '../../src/fe-text/term-terminfo.c', + '../../src/fe-text/term.c', + '../../src/fe-text/terminfo-core.c', + '../../src/fe-text/textbuffer-view.c', + '../../src/fe-text/textbuffer.c', + 'mock-irssi.c', + 'test-paste-join-multiline.c', + ), + link_with : [ + libconfig_a, + libcore_a, + libfe_common_core_a, + ], + c_args : [ + '-D' + 'PACKAGE_STRING' + '="' + 'fe-text' + '"', + ], + include_directories : rootinc, + implicit_include_directories : false, + dependencies : dep + textui_dep, +) +test('test-paste-join-multiline test', test_test_paste_join_multiline, + args : ['--tap'], + protocol : 'tap') + diff --git a/tests/irc/core/meson.build b/tests/irc/core/meson.build new file mode 100644 index 00000000..f63f4fa8 --- /dev/null +++ b/tests/irc/core/meson.build @@ -0,0 +1,45 @@ +test_test_irc = executable('test-irc', + files( + 'test-irc.c', + ), + link_with : [ + libconfig_a, + libcore_a, + libfe_common_core_a, + libirc_core_a, + ], + c_args : [ + '-D' + 'PACKAGE_STRING' + '="' + 'irc/core' + '"', + ], + include_directories : rootinc, + implicit_include_directories : false, + dependencies : dep +) +test('test-irc test', test_test_irc, + args : [ + '--tap', + ], + protocol : 'tap') + +test_test_channel_events = executable('test-channel-events', + files( + 'test-channel-events.c', + ), + link_with : [ + libconfig_a, + libcore_a, + libfe_common_core_a, + libirc_core_a, + ], + c_args : [ + '-D' + 'PACKAGE_STRING' + '="' + 'irc/core' + '"', + ], + include_directories : rootinc, + implicit_include_directories : false, + dependencies : dep +) +test('test-channel-events test', test_test_channel_events, + args : [ + '--tap', + ], + protocol : 'tap') diff --git a/tests/irc/flood/meson.build b/tests/irc/flood/meson.build new file mode 100644 index 00000000..e9d0a2bc --- /dev/null +++ b/tests/irc/flood/meson.build @@ -0,0 +1,25 @@ +test_test_796 = executable('test-796', + files( + 'test-796.c', + ), + link_with : [ + libconfig_a, + libcore_a, + libfe_common_core_a, + libirc_a, + libfe_common_irc_a, + libfe_irc_dcc_a, + libfe_irc_notifylist_a, + ], + c_args : [ + '-D' + 'PACKAGE_STRING' + '="' + 'irc/flood' + '"', + ], + include_directories : rootinc, + implicit_include_directories : false, + dependencies : dep +) +test('test-796 test', test_test_796, + args : [ + '--tap', + ], + protocol : 'tap') diff --git a/tests/irc/meson.build b/tests/irc/meson.build new file mode 100644 index 00000000..1a10ce0a --- /dev/null +++ b/tests/irc/meson.build @@ -0,0 +1,2 @@ +subdir('core') +subdir('flood') diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 00000000..6cfb3706 --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,5 @@ +subdir('fe-common') +subdir('irc') +if want_textui + subdir('fe-text') +endif diff --git a/themes/meson.build b/themes/meson.build new file mode 100644 index 00000000..d58dddf4 --- /dev/null +++ b/themes/meson.build @@ -0,0 +1,6 @@ +install_data( + files( + 'default.theme', + 'colorless.theme', + ), + install_dir : themedir) diff --git a/utils/irssi-version.sh b/utils/irssi-version.sh index 6b3a46e4..466a29fd 100755 --- a/utils/irssi-version.sh +++ b/utils/irssi-version.sh @@ -1,14 +1,20 @@ #!/bin/sh -DATE=`GIT_DIR=$1/.git git log -1 --pretty=format:%ai HEAD` +DATE=`GIT_DIR=$1/.git git log -1 --pretty=format:%ai HEAD 2>/dev/null` VERSION_DATE=`echo $DATE | cut -f 1 -d ' ' | tr -d -` VERSION_TIME=`echo $DATE | cut -f 2 -d ' ' | awk -F: '{printf "%d", $1$2}'` if test -z "$VERSION_DATE"; then - exec>&2 - echo "**Error**: `basename "$0"` must be run in a git clone, cannot proceed." - exit 1 + DATE=`grep '^v' $1/NEWS | head -1` + VERSION_DATE=`echo "$DATE" | cut -f 2 -d ' ' | tr -d -` + case $VERSION_DATE in + *xx) + VERSION_DATE=`date +%Y%m%d` + ;; + esac + VERSION_TIME=`echo "$DATE" | cut -f 1 -d ' ' | tr -d v | tr .- ' '` + VERSION_TIME=`printf %d%d%02d $VERSION_TIME 2>/dev/null` fi echo "#define IRSSI_VERSION_DATE $VERSION_DATE" @@ -16,7 +22,7 @@ echo "#define IRSSI_VERSION_TIME $VERSION_TIME" if echo "${VERSION}" | grep -q -- -head; then # -head version, get extra details from git if we can - git_version=$(GIT_DIR=$1/.git git describe --dirty --long --always --tags) + git_version=$(GIT_DIR=$1/.git git describe --dirty --long --always --tags 2>/dev/null) if [ $? = 0 ]; then echo "#undef PACKAGE_VERSION" echo "#define PACKAGE_VERSION \"${git_version}\"" diff --git a/utils/syntax.pl b/utils/syntax.pl index 33bd12b4..42a4accb 100755 --- a/utils/syntax.pl +++ b/utils/syntax.pl @@ -39,6 +39,7 @@ foreach $file (@files) { } while () { next if (/Makefile/); + next if (/meson\.build/); open (FILE, "$_"); @data = ;