1From 51d66c1c257f7487497f562033ac32ac75f648cb Mon Sep 17 00:00:00 2001 2From: Martin Jansa <Martin.Jansa@gmail.com> 3Date: Mon, 8 Feb 2021 12:27:51 +0100 4Subject: [PATCH] meson: import changes from 3.0.* version 5 6* we need to use the meson option to disable introspection and docs 7 8Upstream-Status: Backport 9Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> 10--- 11 meson.build | 139 ++++++++++++++++++++++++++++------------------ 12 meson_options.txt | 5 ++ 13 2 files changed, 90 insertions(+), 54 deletions(-) 14 create mode 100644 meson_options.txt 15 16diff --git a/meson.build b/meson.build 17index 1084c82..ed040b4 100644 18--- a/meson.build 19+++ b/meson.build 20@@ -53,9 +53,9 @@ compiler = meson.get_compiler('c') 21 pkgconfig = import('pkgconfig') 22 23 # ####################################################################### 24-# # Check for GLib 2.16 25+# # Check for GLib 2.44 26 # ####################################################################### 27-glib = dependency('glib-2.0', version : '>= 2.16.0') 28+glib = dependency('glib-2.0', version : '>= 2.44.0') 29 gobject = dependency('gobject-2.0') 30 gmodule = dependency('gmodule-2.0') 31 gnome = import('gnome') 32@@ -63,74 +63,88 @@ gnome = import('gnome') 33 ####################################################################### 34 # Check for LibXML2 35 ####################################################################### 36-libxml = dependency('libxml-2.0', version : '>= 2.6.0', required : false) 37-gnt_config.set('NO_LIBXML', not libxml.found()) 38+libxml = dependency('libxml-2.0', version : '>= 2.6.0') 39 40 ####################################################################### 41 # Check for ncurses and other things used by it 42 ####################################################################### 43 ncurses_available = true 44-ncurses_inc = [] 45-# The order of this list is important to the condition that follows. 46-ncurses_libs = [ 47- compiler.find_library('ncursesw', required : false), 48- compiler.find_library('panelw', required : false), 49- compiler.find_library('tinfow', required : false), 50-] 51-if not ncurses_libs[0].found() or not ncurses_libs[1].found() 52- ncurses_available = false 53-endif 54+ncurses_widechar = true 55+ncurses_header = 'ncurses.h' 56+# Some distros put the headers in ncursesw/, some don't. These are ordered to 57+# pick the last available as most-specific version. 58+ncursesw_header_paths = ['', 'ncursesw/'] 59 60-if host_machine.system() == 'windows' 61- # FIXME: $host ? 62- ncurses_sys_prefix = '/usr/$host/sys-root/mingw' 63+ncurses = [ 64+ dependency('ncursesw', required : false), 65+ dependency('panelw', required : false), 66+] 67+if ncurses[0].found() and ncurses[1].found() 68+ foreach location : ncursesw_header_paths 69+ f = location + 'ncurses.h' 70+ if compiler.has_header_symbol(f, 'get_wch', 71+ prefix : '#define _XOPEN_SOURCE_EXTENDED') 72+ ncurses_header = f 73+ endif 74+ endforeach 75 else 76- ncurses_sys_prefix = '/usr' 77-endif 78- 79-ncurses_sys_dirs = [ncurses_sys_prefix + '/include/ncursesw', 80- ncurses_sys_prefix + '/include'] 81- 82-if ncurses_available 83- # Some distros put the headers in ncursesw/, some don't 84- found_ncurses_h = false 85- foreach location : ncurses_sys_dirs 86- f = location + '/ncurses.h' 87- if not found_ncurses_h 88+ ncurses_available = false 89+ ncurses_inc = [] 90+ ncurses_libs = [ 91+ compiler.find_library('ncursesw', required : false), 92+ compiler.find_library('panelw', required : false) 93+ ] 94+ if ncurses_libs[0].found() and ncurses_libs[1].found() 95+ foreach location : ncursesw_header_paths 96+ f = location + 'ncurses.h' 97 if compiler.has_header_symbol(f, 'get_wch', 98 prefix : '#define _XOPEN_SOURCE_EXTENDED') 99- if location != '.' 100- ncurses_inc += [include_directories(location)] 101- endif 102- found_ncurses_h = true 103+ ncurses_available = true 104+ ncurses_header = f 105 endif 106- endif 107- endforeach 108+ endforeach 109 110- if not found_ncurses_h 111- ncurses_inc = [] 112- ncurses_libs = [] 113- ncurses_available = false 114+ if ncurses_available 115+ ncurses = declare_dependency( 116+ include_directories : ncurses_inc, 117+ dependencies : ncurses_libs 118+ ) 119+ endif 120 endif 121-else 122+endif 123+ 124+if not ncurses_available 125 # ncursesw was not found. Look for plain old ncurses 126- # The order of this list is important to the condition that follows. 127- ncurses_libs = [ 128- compiler.find_library('ncurses', required : false), 129- compiler.find_library('panel', required : false), 130- compiler.find_library('tinfo', required : false), 131+ ncurses = [ 132+ dependency('ncurses', required : false), 133+ dependency('panel', required : false), 134 ] 135- ncurses_available = ncurses_libs[0].found() and ncurses_libs[1].found() 136- gnt_config.set('NO_WIDECHAR', true) 137+ if ncurses[0].found() and ncurses_libs[1].found() 138+ ncurses_available = true 139+ else 140+ ncurses_libs = [ 141+ compiler.find_library('ncurses', required : false), 142+ compiler.find_library('panel', required : false), 143+ ] 144+ ncurses_available = ncurses_libs[0].found() and ncurses_libs[1].found() 145+ ncurses = declare_dependency(dependencies : ncurses_libs) 146+ endif 147+ ncurses_widechar = false 148 endif 149+ 150+if not ncurses_available and host_machine.system() == 'windows' 151+ # Try pdcurses too. 152+ ncurses_header = 'curses.h' 153+ ncurses_libs = compiler.find_library('pdcurses', required : false) 154+ ncurses_available = compiler.has_header(ncurses_header) and ncurses_libs.found() 155+ ncurses = declare_dependency(dependencies : ncurses_libs) 156+endif 157+ 158 if not ncurses_available 159 error('ncurses could not be found!') 160 endif 161- 162-ncurses = declare_dependency( 163- include_directories : ncurses_inc, 164- dependencies : ncurses_libs 165-) 166+gnt_config.set('NCURSES_HEADER', ncurses_header) 167+gnt_config.set10('NCURSES_WIDECHAR', ncurses_widechar) 168 169 libgnt_SOURCES = [ 170 'gntwidget.c', 171@@ -191,7 +205,10 @@ libgnt_headers = [ 172 ] 173 174 # Check for Python headers 175-python_dep = dependency('python2', required : false) 176+python_dep = dependency('python3-embed', required: false) 177+if not python_dep.found() 178+ python_dep = dependency('python3', required : false) 179+endif 180 gnt_config.set('USE_PYTHON', python_dep.found()) 181 182 configure_file(output : 'gntconfig.h', 183@@ -233,6 +250,20 @@ pkgconfig.generate( 184 variables : ['plugindir = ${libdir}/gnt'], 185 ) 186 187+if get_option('introspection') 188+ libgnt_gir = gnome.generate_gir(libgnt, 189+ sources : libgnt_headers + [gnt_h], 190+ includes : 'GObject-2.0', 191+ namespace : 'Gnt', 192+ symbol_prefix : 'gnt', 193+ identifier_prefix : 'Gnt', 194+ nsversion : '@0@.@1@'.format(gnt_major_version, gnt_minor_version), 195+ install : true, 196+ extra_args : ['-DGNT_COMPILATION', '--quiet']) 197+endif 198+ 199 subdir('wms') 200 subdir('test') 201-subdir('doc') 202+if get_option('doc') 203+ subdir('doc') 204+endif 205diff --git a/meson_options.txt b/meson_options.txt 206new file mode 100644 207index 0000000..f2414e2 208--- /dev/null 209+++ b/meson_options.txt 210@@ -0,0 +1,5 @@ 211+option('doc', type : 'boolean', value : true, yield : true, 212+ description : 'build documentation with gtk-doc') 213+ 214+option('introspection', type : 'boolean', value : true, yield : true, 215+ description : 'build introspection data') 216