Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/VibeDevelopers/Comet.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281project('comet', 'c', version: '1.3-dev', default_options: ['c_std=c99', 'warning_level=0'], meson_version: '>=0.62.0', # dependency('dl') license: 'GPLv2')
cc = meson.get_compiler('c')
# Required dependenciesflex = find_program('flex', 'lex', required: true)bison = find_program('bison', 'yacc', 'byacc', required: true)socket_dep = cc.find_library('socket', required: false)sqlite3_dep = dependency('sqlite3', required: true)dl_dep = dependency('dl', required: false)ltdl_dep = cc.find_library('ltdl', required: true)crypt_dep = cc.find_library('crypt', required: false)if not crypt_dep.found() crypt_dep = cc.find_library('descrypt', required: false)endif
# Optional dependencieshyperscan_dep = dependency('libhs', version: '>=4', required: get_option('hyperscan'))have_hyperscan = hyperscan_dep.found()
sctp_dep = cc.find_library('sctp', has_headers: ['netinet/sctp.h'], required: get_option('sctp'))have_sctp = sctp_dep.found()
# Priority: mbedTLS > OpenSSL > GnuTLStls_backend = 'none'tls_deps = []have_openssl = falsehave_mbedtls = falsehave_gnutls = false
# TLS librariesmbedtls_lib = cc.find_library('mbedtls', required: get_option('mbedtls'))mbedx509_lib = cc.find_library('mbedx509', required: get_option('mbedtls'))mbedcrypto_lib = cc.find_library('mbedcrypto', required: get_option('mbedtls'))openssl_dep = dependency('openssl', version: '>=1.1.0', required: get_option('openssl'))gnutls_dep = dependency('gnutls', required: get_option('gnutls'))
if mbedtls_lib.found() and mbedx509_lib.found() and mbedcrypto_lib.found() tls_backend = 'mbedtls' tls_deps = [mbedtls_lib, mbedx509_lib, mbedcrypto_lib] have_mbedtls = trueelif openssl_dep.found() tls_backend = 'openssl' tls_deps = [openssl_dep] have_openssl = trueelif gnutls_dep.found() tls_backend = 'gnutls' tls_deps = [gnutls_dep] have_gnutls = trueendif
message('TLS backend: ' + tls_backend)
fhs_paths = get_option('fhs_paths')prefix = get_option('prefix')
# Convert standard Meson directories to absolute pathslibdir = prefix / get_option('libdir')bindir = prefix / get_option('bindir')libexecdir = prefix / get_option('libexecdir')datadir = prefix / get_option('datadir')localstatedir = prefix / get_option('localstatedir')sysconfdir_base = prefix / get_option('sysconfdir')
if fhs_paths pkglibexecdir = libexecdir / meson.project_name() pkgrundir = prefix / 'run' / meson.project_name() pkglocalstatedir = localstatedir / 'lib' / meson.project_name()
default_logdir = localstatedir / 'log' / meson.project_name() default_helpdir = datadir / meson.project_name() / 'help' default_moduledir = libdir / meson.project_name() / 'modules'else pkglibexecdir = bindir pkgrundir = sysconfdir_base pkglocalstatedir = localstatedir
default_logdir = prefix / 'logs' default_helpdir = prefix / 'help' default_moduledir = prefix / 'modules'endif
# User-overridable options with dynamic defaultsoption_defaults = { 'logdir': default_logdir, 'helpdir': default_helpdir, 'moduledir': default_moduledir, 'confdir': sysconfdir_base, 'custom_branding': meson.project_name(), 'custom_version': meson.project_version(),}foreach varname, default : option_defaults opt = get_option(varname) set_variable(varname, opt == '' ? default : opt)endforeach
# rundir default depends on fhs_paths and confdirdefault_rundir = fhs_paths ? prefix / 'run' : confdirrundir_opt = get_option('rundir')rundir = rundir_opt == '' ? default_rundir : rundir_opt
conf_data = configuration_data()
# Basic definesconf_data.set_quoted('PACKAGE_NAME', meson.project_name())conf_data.set_quoted('PACKAGE_VERSION', meson.project_version())
# Path definesconf_data.set_quoted('IRCD_PREFIX', prefix)conf_data.set_quoted('ETC_DIR', confdir)conf_data.set_quoted('LOG_DIR', logdir)conf_data.set_quoted('HELP_DIR', helpdir)conf_data.set_quoted('MODULE_DIR', moduledir)conf_data.set_quoted('PKGLIBEXECDIR', pkglibexecdir)conf_data.set_quoted('PKGLOCALSTATEDIR', pkglocalstatedir)conf_data.set_quoted('PKGRUNDIR', rundir)
# FHS pathsif fhs_paths conf_data.set('ENABLE_FHS_PATHS', 1)endif
# Protocol limitsconf_data.set('NICKLEN', get_option('nicklen') + 1)conf_data.set('TOPICLEN', get_option('topiclen'))
# Brandingconf_data.set_quoted('BRANDING_NAME', custom_branding)conf_data.set_quoted('BRANDING_VERSION', custom_version)
if get_option('custom_branding') != '' conf_data.set('CUSTOM_BRANDING', 1)endif
# Program prefixprogram_prefix = get_option('program_prefix')conf_data.set_quoted('PROGRAM_PREFIX', program_prefix)
# Featuresif get_option('oper_chghost') conf_data.set('ENABLE_OPER_CHGHOST', 1)endifif have_sctp conf_data.set('HAVE_LIBSCTP', 1)endifif have_hyperscan conf_data.set('HAVE_HYPERSCAN', 1)endif
# Performanceif get_option('profile') conf_data.set('SOLANUM_PROFILE', 1)endif
# Heap sizesconf_data.set('NICKNAMEHISTORYLENGTH', 15000) # Size of the WHOWAS array.conf_data.set('CHANNEL_HEAP_SIZE', 8192)conf_data.set('BAN_HEAP_SIZE', 4096)conf_data.set('CLIENT_HEAP_SIZE', 8192)conf_data.set('LCLIENT_HEAP_SIZE', 1024)conf_data.set('PCLIENT_HEAP_SIZE', 256)conf_data.set('USER_HEAP_SIZE', 8192)conf_data.set('DNODE_HEAP_SIZE', 8192)conf_data.set('TOPIC_HEAP_SIZE', 4096)conf_data.set('LINEBUF_HEAP_SIZE', 2048)conf_data.set('MEMBER_HEAP_SIZE', 32768)conf_data.set('ND_HEAP_SIZE', 512)conf_data.set('CONFITEM_HEAP_SIZE', 256)conf_data.set('MONITOR_HEAP_SIZE', 1024)conf_data.set('FD_HEAP_SIZE', 1024)conf_data.set('AWAY_HEAP_SIZE', 512)
# System checkssystem_checks = { 'HAVE_STRINGS_H': cc.check_header('strings.h'), 'HAVE_SYS_PARAM_H': cc.check_header('sys/param.h'),}foreach define, found : system_checks if found conf_data.set(define, 1) endifendforeach
if not cc.check_header('stdarg.h') error('stdarg.h is required')endif
if not cc.check_header('stdbool.h') error('stdbool.h is required')endif
conf_data.set_quoted('PATH_DEVNULL', '/dev/null')
if cc.has_type('uintptr_t', prefix: '#include <stdint.h>') conf_data.set('HAVE_UINTPTR_T', 1)endif
# For compat with autotools. See https://www.gnu.org/software/libtool/manual/html_node/Autoconf-macros.html#index-LT_005fSYS_005fMODULE_005fEXT# We only support Linux, thoughconf_data.set_quoted('LT_MODULE_EXT', '.so')
if get_option('b_ndebug') == 'true' assertions_enabled = falseelif get_option('b_ndebug') == 'if-release' and get_option('buildtype') == 'release' assertions_enabled = falseelse assertions_enabled = trueendif
c_args = []link_args = []
if get_option('profile') if cc.has_argument('-pg') c_args += ['-pg'] link_args += ['-pg'] endifendif
rpath = prefix / get_option('libdir')
add_project_arguments(c_args, language: 'c')add_project_arguments('-D_GNU_SOURCE', language: 'c')
subdir('include')subdir('librb')subdir('ircd')subdir('ssld')subdir('authd')subdir('bandb')subdir('tools')subdir('modules')subdir('extensions')subdir('help')subdir('doc')
subdir('tests')
install_emptydir(logdir)install_emptydir(pkglocalstatedir) # needed for FHS paths
summary({ 'prefix': prefix, 'confdir': confdir, 'logdir': logdir, 'helpdir': helpdir, 'moduledir': moduledir, 'pkglocalstatedir': pkglocalstatedir, 'FHS paths': fhs_paths,}, section: 'Directories')
summary({ 'TLS backend': tls_backend, 'SCTP': have_sctp, 'Hyperscan': have_hyperscan, 'OPER CHGHOST': get_option('oper_chghost'),}, section: 'Features')
summary({ 'Assertions': assertions_enabled, 'Profile': get_option('profile'), 'Warnings': get_option('warning_level'),}, section: 'Debug Options')
summary({ 'Nickname length': get_option('nicklen'), 'Topic length': get_option('topiclen'),}, section: 'Protocol Limits')
summary({ 'Branding name': custom_branding, 'Branding version': custom_version, 'Program prefix': program_prefix,}, section: 'Branding')