1# UPDATING VERSION NUMBERS FOR RELEASES 2# 3# The version number is: 4# <major>.<minor>.<micro><suffix> 5# 6# If any code has changed in libgnt: 7# micro += 1 8# 9# If any functions have been added to libgnt: 10# micro = 0 11# minor += 1 12# 13# If backwards compatibility has been broken in libgnt: 14# micro = 0 15# minor = 0 16# major += 1 17# gnt_soversion += 1 18# 19# suffix should be similar to one of the following: 20# For beta releases: '-beta2' 21# For code under development: '-devel' 22# For production releases: '' 23# 24 25# the last version for Finch 2 was 2.14.2, 26# the first version for Finch 3 was 3.0.0 27 28project('libgnt', 'c', 29 version : '2.14.3', 30 meson_version : '>=0.44.0') 31gnt_soversion = 0 32 33parts = meson.project_version().split('-') 34if parts.length() > 1 35 gnt_extra_version = parts[1] 36else 37 gnt_extra_version = '' 38endif 39 40parts = parts[0].split('.') 41gnt_major_version = parts[0] 42gnt_minor_version = parts[1] 43gnt_micro_version = parts[2] 44 45gnt_config = configuration_data() 46gnt_config.set('GNT_MAJOR_VERSION', gnt_major_version) 47gnt_config.set('GNT_MINOR_VERSION', gnt_minor_version) 48gnt_config.set('GNT_MICRO_VERSION', gnt_micro_version) 49gnt_config.set_quoted('GNT_EXTRA_VERSION', gnt_extra_version) 50gnt_config.set_quoted('GNT_VERSION', meson.project_version()) 51 52compiler = meson.get_compiler('c') 53pkgconfig = import('pkgconfig') 54 55# ####################################################################### 56# # Check for GLib 2.16 57# ####################################################################### 58glib = dependency('glib-2.0', version : '>= 2.16.0') 59gobject = dependency('gobject-2.0') 60gmodule = dependency('gmodule-2.0') 61gnome = import('gnome') 62 63####################################################################### 64# Check for LibXML2 65####################################################################### 66libxml = dependency('libxml-2.0', version : '>= 2.6.0', required : false) 67gnt_config.set('NO_LIBXML', not libxml.found()) 68 69####################################################################### 70# Check for ncurses and other things used by it 71####################################################################### 72ncurses_available = true 73ncurses_inc = [] 74# The order of this list is important to the condition that follows. 75ncurses_libs = [ 76 compiler.find_library('ncursesw', required : false), 77 compiler.find_library('panelw', required : false), 78 compiler.find_library('tinfow', required : false), 79] 80if not ncurses_libs[0].found() or not ncurses_libs[1].found() 81 ncurses_available = false 82endif 83 84if host_machine.system() == 'windows' 85 # FIXME: $host ? 86 ncurses_sys_prefix = '/usr/$host/sys-root/mingw' 87else 88 ncurses_sys_prefix = '/usr/local' 89endif 90 91ncurses_sys_dirs = [ncurses_sys_prefix + '/include/ncurses', 92 ncurses_sys_prefix + '/include'] 93 94if ncurses_available 95 # Some distros put the headers in ncursesw/, some don't 96 found_ncurses_h = false 97 foreach location : ncurses_sys_dirs 98 f = location + '/ncurses.h' 99 if not found_ncurses_h 100 if compiler.has_header_symbol(f, 'get_wch', 101 prefix : '#define _XOPEN_SOURCE_EXTENDED') 102 if location != '.' 103 ncurses_inc += [include_directories(location)] 104 endif 105 found_ncurses_h = true 106 endif 107 endif 108 endforeach 109 110 if not found_ncurses_h 111 ncurses_inc = [] 112 ncurses_libs = [] 113 ncurses_available = false 114 endif 115else 116 # ncursesw was not found. Look for plain old ncurses 117 # The order of this list is important to the condition that follows. 118 ncurses_libs = [ 119 compiler.find_library('ncurses', required : false), 120 compiler.find_library('panel', required : false), 121 compiler.find_library('tinfo', required : false), 122 ] 123 ncurses_available = ncurses_libs[0].found() and ncurses_libs[1].found() 124 gnt_config.set('NO_WIDECHAR', true) 125endif 126if not ncurses_available 127 error('ncurses could not be found!') 128endif 129 130ncurses = declare_dependency( 131 include_directories : ncurses_inc, 132 dependencies : ncurses_libs 133) 134 135libgnt_SOURCES = [ 136 'gntwidget.c', 137 'gntbindable.c', 138 'gntbox.c', 139 'gntbutton.c', 140 'gntcheckbox.c', 141 'gntclipboard.c', 142 'gntcolors.c', 143 'gntcombobox.c', 144 'gntentry.c', 145 'gntfilesel.c', 146 'gntkeys.c', 147 'gntlabel.c', 148 'gntline.c', 149 'gntmenu.c', 150 'gntmenuitem.c', 151 'gntmenuitemcheck.c', 152 'gntprogressbar.c', 153 'gntslider.c', 154 'gntstyle.c', 155 'gnttextview.c', 156 'gnttree.c', 157 'gntutils.c', 158 'gntwindow.c', 159 'gntwm.c', 160 'gntws.c', 161 'gntmain.c' 162] 163 164libgnt_headers = [ 165 'gntwidget.h', 166 'gntbindable.h', 167 'gntbox.h', 168 'gntbutton.h', 169 'gntcheckbox.h', 170 'gntclipboard.h', 171 'gntcolors.h', 172 'gntcombobox.h', 173 'gntentry.h', 174 'gntfilesel.h', 175 'gntkeys.h', 176 'gntlabel.h', 177 'gntline.h', 178 'gntmenu.h', 179 'gntmenuitem.h', 180 'gntmenuitemcheck.h', 181 'gntprogressbar.h', 182 'gntslider.h', 183 'gntstyle.h', 184 'gnttextview.h', 185 'gnttree.h', 186 'gntutils.h', 187 'gntwindow.h', 188 'gntwm.h', 189 'gntws.h', 190 'gnt.h' 191] 192 193# Check for Python headers 194python_dep = disabler() 195if get_option('python2') 196 python_dep = dependency('python2', required : false) 197 if not python_dep.found() 198 python_dep = dependency('python-2.7', required : false) 199 endif 200 201 if not python_dep.found() 202 error('failed to find python') 203 endif 204endif 205gnt_config.set('USE_PYTHON', get_option('python2')) 206 207configure_file(output : 'gntconfig.h', 208 configuration : gnt_config) 209 210install_headers(libgnt_headers, subdir : 'gnt') 211 212if host_machine.system() == 'windows' 213 libgnt_SOURCES += windows.compile_resources('libgnt_winres.rc') 214endif 215 216gntmarshal = gnome.genmarshal('gntmarshal', 217 sources : 'genmarshal', 218 prefix : 'gnt_closure_marshal', 219 install_header : true, 220 install_dir : join_paths(get_option('includedir'), 'gnt')) 221 222libgnt_inc = include_directories('.') 223libgnt_dependencies= [ncurses, libxml, glib, gobject, gmodule] 224if get_option('python2') 225 libgnt_dependencies += python_dep 226endif 227libgnt = library('gnt', 228 libgnt_SOURCES + gntmarshal, 229 install : true, 230 version : '@0@.@1@.@2@'.format(gnt_soversion, 231 gnt_minor_version, 232 gnt_micro_version), 233 dependencies : libgnt_dependencies) 234libgnt_dep = declare_dependency( 235 include_directories : libgnt_inc, 236 link_with : libgnt, 237 dependencies : [ncurses, glib]) 238 239if meson.version().version_compare('>=0.54.0') 240 meson.override_dependency('gnt', libgnt_dep) 241endif 242 243pkgconfig.generate( 244 name : 'LibGNT', 245 description : 'Glib Ncurses Toolkit is a collection of curses-widgets.', 246 version : meson.project_version(), 247 filebase : 'gnt', 248 subdirs : 'gnt', 249 libraries : [libgnt], 250 requires : ['glib-2.0'], 251 variables : ['plugindir = ${libdir}/gnt'], 252 ) 253 254subdir('wms') 255subdir('test') 256subdir('doc') 257