diff options
author | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2022-10-23 22:21:46 -0500 |
---|---|---|
committer | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2022-10-23 22:21:46 -0500 |
commit | a70091a69ecd46f94b9ba484ff8fd351c4cae8fb (patch) | |
tree | d857e7a220ca68fbdfd7e315d902e99fec88934c /finch | |
parent | 0d3d6b4e10aa1049a0d0eb663dc48bcca03a2f28 (diff) | |
download | pidgin-a70091a69ecd46f94b9ba484ff8fd351c4cae8fb.tar.gz |
Flatten Meson build files
We use a new enough version that we can take advantage of a few shortcuts so that entire files don't need to be wrapped in a huge if.
Also, passing the dependency object directly to summary prints `YES`+the version, instead of just `YES`. Unfortunately, there's a bug with using a disabler, so some of them can't do that ([yet](https://github.com/mesonbuild/meson/pull/10949)).
Testing Done:
Configured with defaults and configured with
```
$ meson setup \
-Davahi=disabled \
-Dconsoleui=false \
-Dgtkui=false \
-Dintrospection=false \
-Dkwallet=disabled \
-Dlibgadu=disabled \
-Dlibsecret=disabled \
-Dmeanwhile=disabled \
-Dsilc=disabled \
-Dx=false \
-Dzephyr=disabled \
-Dunity-integration=disabled \
-Dgplugin:lua=false \
-Dgplugin:python3=false \
-Dgplugin:vapi=false \
-Ddynamic-prpls=bonjour
```
to disable almost everything.
Reviewed at https://reviews.imfreedom.org/r/1953/
Diffstat (limited to 'finch')
-rw-r--r-- | finch/meson.build | 300 |
1 files changed, 146 insertions, 154 deletions
diff --git a/finch/meson.build b/finch/meson.build index b2e44d69b9..e6b7bcca12 100644 --- a/finch/meson.build +++ b/finch/meson.build @@ -1,87 +1,81 @@ enable_consoleui = false -if get_option('consoleui') - libgnt_dep = dependency('gnt3', - version : '>= 3.0.0', - fallback : ['libgnt', 'libgnt_dep']) - - ####################################################################### - # Check for ncurses and other things used by it - # FIXME: This should be temporary until libgnt wraps the functionality. - ####################################################################### - ncurses_available = true - ncurses_header = 'ncurses.h' - # Some distros put the headers in ncursesw/, some don't. These are ordered to - # pick the last available as most-specific version. - ncursesw_header_paths = ['', 'ncursesw/'] - - ncurses = dependency('ncursesw', required : false) - if ncurses.found() +if not get_option('consoleui') + subdir_done() +endif + +libgnt_dep = dependency('gnt3', + version : '>= 3.0.0', + fallback : ['libgnt', 'libgnt_dep']) + +####################################################################### +# Check for ncurses and other things used by it +# FIXME: This should be temporary until libgnt wraps the functionality. +####################################################################### +ncurses_available = true +ncurses_header = 'ncurses.h' +# Some distros put the headers in ncursesw/, some don't. These are ordered to +# pick the last available as most-specific version. +ncursesw_header_paths = ['', 'ncursesw/'] + +ncurses = dependency('ncursesw', required : false) +if ncurses.found() + foreach location : ncursesw_header_paths + f = location / 'ncurses.h' + if compiler.has_header_symbol(f, 'get_wch', + prefix : '#define _XOPEN_SOURCE_EXTENDED') + ncurses_header = f + endif + endforeach +else + ncurses_available = false + ncurses_inc = [] + ncurses_libs = compiler.find_library('ncursesw', required : false) + if ncurses_libs.found() foreach location : ncursesw_header_paths f = location / 'ncurses.h' if compiler.has_header_symbol(f, 'get_wch', prefix : '#define _XOPEN_SOURCE_EXTENDED') + ncurses_available = true ncurses_header = f endif endforeach - else - ncurses_available = false - ncurses_inc = [] - ncurses_libs = compiler.find_library('ncursesw', required : false) - if ncurses_libs.found() - foreach location : ncursesw_header_paths - f = location / 'ncurses.h' - if compiler.has_header_symbol(f, 'get_wch', - prefix : '#define _XOPEN_SOURCE_EXTENDED') - ncurses_available = true - ncurses_header = f - endif - endforeach - - if ncurses_available - ncurses = declare_dependency( - include_directories : ncurses_inc, - dependencies : ncurses_libs - ) - endif - endif - endif - if not ncurses_available - # ncursesw was not found. Look for plain old ncurses - ncurses = dependency('ncurses', required : false) - if ncurses.found() - ncurses_available = true - else - ncurses_libs = compiler.find_library('ncurses', required : false) - ncurses_available = ncurses_libs.found() - ncurses = declare_dependency(dependencies : ncurses_libs) + if ncurses_available + ncurses = declare_dependency( + include_directories : ncurses_inc, + dependencies : ncurses_libs + ) endif endif +endif - if not ncurses_available and host_machine.system() == 'windows' - # Try pdcurses too. - ncurses_header = 'curses.h' - ncurses_libs = compiler.find_library('pdcurses', required : false) - ncurses_available = compiler.has_header(ncurses_header) and ncurses_libs.found() +if not ncurses_available + # ncursesw was not found. Look for plain old ncurses + ncurses = dependency('ncurses', required : false) + if ncurses.found() + ncurses_available = true + else + ncurses_libs = compiler.find_library('ncurses', required : false) + ncurses_available = ncurses_libs.found() ncurses = declare_dependency(dependencies : ncurses_libs) endif +endif - if not ncurses_available - error('ncurses could not be found!') - endif - - if libgnt_dep.found() and ncurses_available - ncurses_header = '-DNCURSES_HEADER="@0@"'.format(ncurses_header) - enable_consoleui = true - else - error(''' - -Finch will not be built. You need to install libgnt (or its requirements) and its development headers. +if not ncurses_available and host_machine.system() == 'windows' + # Try pdcurses too. + ncurses_header = 'curses.h' + ncurses_libs = compiler.find_library('pdcurses', required : false) + ncurses_available = compiler.has_header(ncurses_header) and ncurses_libs.found() + ncurses = declare_dependency(dependencies : ncurses_libs) +endif -''') - endif +if not ncurses_available + error('ncurses could not be found!') endif +ncurses_header = '-DNCURSES_HEADER="@0@"'.format(ncurses_header) +enable_consoleui = true + libfinch_SOURCES = [ 'finchnotifications.c', @@ -156,92 +150,90 @@ else winmm = [] endif -if enable_consoleui - libfinch_enums = gnome.mkenums_simple('finchenums', - sources: libfinch_enum_headers) - libfinch_built_sources += libfinch_enums[0] - libfinch_built_headers += libfinch_enums[1] - - FINCH_H_INCLUDES = [] - foreach header : libfinch_headers + ['finchenums.h'] - FINCH_H_INCLUDES += '#include <finch/@0@>'.format(header) - endforeach - finch_h_conf = configuration_data() - finch_h_conf.set('FINCH_H_INCLUDES', '\n'.join(FINCH_H_INCLUDES)) - - finch_h = configure_file(input : 'finch.h.in', - output : 'finch.h', - configuration : finch_h_conf, - install : true, - install_dir : get_option('includedir') / 'finch-3') - libfinch_built_headers += finch_h - - install_headers(libfinch_headers, subdir : 'finch-3') - - libfinch_inc = include_directories('.') - libfinch = shared_library('finch3', - libfinch_SOURCES + libfinch_built_headers + libfinch_built_sources, - c_args : [ - '-DSTANDALONE', - '-DGNTSEAL_ENABLE', - '-DFINCH_COMPILATION', - ncurses_header, - '-DG_LOG_USE_STRUCTURED', - '-DG_LOG_DOMAIN="Finch"', - ], - include_directories : [toplevel_inc], - version : PURPLE_LIB_VERSION, - dependencies : [libpurple_dep, libgnt_dep, ncurses, glib, winmm], - install : true) - - if enable_introspection - introspection_sources = libfinch_headers - - libfinch_gir = gnome.generate_gir(libfinch, - sources : introspection_sources, - header : 'finch.h', - includes : ['GLib-2.0', 'GModule-2.0', 'GObject-2.0', libpurple_gir[0], 'Gnt-3.0'], - namespace : 'Finch', - symbol_prefix : 'finch', - identifier_prefix : 'Finch', - export_packages : 'finch-3', - nsversion : '@0@.@1@'.format(purple_major_version, - purple_minor_version), - dependencies: [libgnt_dep, gplugin_dep, libpurple_dep], - install : true, - extra_args : ['-DFINCH_COMPILATION', '--quiet']) - libfinch_generated_sources += libfinch_gir - endif +libfinch_enums = gnome.mkenums_simple('finchenums', + sources: libfinch_enum_headers) +libfinch_built_sources += libfinch_enums[0] +libfinch_built_headers += libfinch_enums[1] + +FINCH_H_INCLUDES = [] +foreach header : libfinch_headers + ['finchenums.h'] + FINCH_H_INCLUDES += '#include <finch/@0@>'.format(header) +endforeach +finch_h_conf = configuration_data() +finch_h_conf.set('FINCH_H_INCLUDES', '\n'.join(FINCH_H_INCLUDES)) + +finch_h = configure_file(input : 'finch.h.in', + output : 'finch.h', + configuration : finch_h_conf, + install : true, + install_dir : get_option('includedir') / 'finch-3') +libfinch_built_headers += finch_h + +install_headers(libfinch_headers, subdir : 'finch-3') + +libfinch_inc = include_directories('.') +libfinch = shared_library('finch3', + libfinch_SOURCES + libfinch_built_headers + libfinch_built_sources, + c_args : [ + '-DSTANDALONE', + '-DGNTSEAL_ENABLE', + '-DFINCH_COMPILATION', + ncurses_header, + '-DG_LOG_USE_STRUCTURED', + '-DG_LOG_DOMAIN="Finch"', + ], + include_directories : [toplevel_inc], + version : PURPLE_LIB_VERSION, + dependencies : [libpurple_dep, libgnt_dep, ncurses, glib, winmm], + install : true) + +if enable_introspection + introspection_sources = libfinch_headers + + libfinch_gir = gnome.generate_gir(libfinch, + sources : introspection_sources, + header : 'finch.h', + includes : ['GLib-2.0', 'GModule-2.0', 'GObject-2.0', libpurple_gir[0], 'Gnt-3.0'], + namespace : 'Finch', + symbol_prefix : 'finch', + identifier_prefix : 'Finch', + export_packages : 'finch-3', + nsversion : '@0@.@1@'.format(purple_major_version, + purple_minor_version), + dependencies: [libgnt_dep, gplugin_dep, libpurple_dep], + install : true, + extra_args : ['-DFINCH_COMPILATION', '--quiet']) + libfinch_generated_sources += libfinch_gir +endif - libfinch_dep = declare_dependency( - include_directories : [toplevel_inc, libfinch_inc], - link_with : libfinch, - sources: libfinch_built_headers + libfinch_generated_sources, - dependencies : [libpurple_dep, libgnt_dep, glib]) - - finch = executable('finch3', - finch_SOURCES, - c_args : [ - '-DSTANDALONE', - '-DGNTSEAL_ENABLE', - '-DG_LOG_USE_STRUCTURED', - '-DG_LOG_DOMAIN="Finch"', - ], - dependencies : [libpurple_dep, libgnt_dep, libfinch_dep], - install : true) - - meson.override_dependency('finch-3', libfinch_dep) - - pkgconfig.generate( - libfinch, - name : 'Finch', - description : 'Finch is an instant messenger application that uses libpurple for protocol support and ncurses (libgnt) for the UI.', - version : meson.project_version(), - filebase : 'finch-3', - subdirs : 'finch-3', - # NOTE: Don't use gnt from pkgconfig, as it might be a subproject. - requires : ['gnt', libpurple], - variables : ['plugindir=${libdir}/finch-@0@'.format(purple_major_version)]) - - subdir('plugins') -endif # enable_consoleui +libfinch_dep = declare_dependency( + include_directories : [toplevel_inc, libfinch_inc], + link_with : libfinch, + sources: libfinch_built_headers + libfinch_generated_sources, + dependencies : [libpurple_dep, libgnt_dep, glib]) + +finch = executable('finch3', + finch_SOURCES, + c_args : [ + '-DSTANDALONE', + '-DGNTSEAL_ENABLE', + '-DG_LOG_USE_STRUCTURED', + '-DG_LOG_DOMAIN="Finch"', + ], + dependencies : [libpurple_dep, libgnt_dep, libfinch_dep], + install : true) + +meson.override_dependency('finch-3', libfinch_dep) + +pkgconfig.generate( + libfinch, + name : 'Finch', + description : 'Finch is an instant messenger application that uses libpurple for protocol support and ncurses (libgnt) for the UI.', + version : meson.project_version(), + filebase : 'finch-3', + subdirs : 'finch-3', + # NOTE: Don't use gnt from pkgconfig, as it might be a subproject. + requires : ['gnt', libpurple], + variables : ['plugindir=${libdir}/finch-@0@'.format(purple_major_version)]) + +subdir('plugins') |