meson.build (8725B)
1 project( 2 'taler-mdb', 3 'c', 4 license: 'AGPLv3', 5 meson_version: '>=1.1.0', 6 version: '1.5.1', 7 ) 8 9 cc = meson.get_compiler('c') 10 incdir = include_directories('src/') 11 12 # Used to populate gnunet_private_config.h 13 private_config = configuration_data() 14 15 16 plugindir = get_option('libdir') / 'taler-mdb' 17 pkgdatadir = get_option('datadir') / 'taler-mdb' 18 pkgcfgdir = pkgdatadir / 'config.d' 19 docdir = get_option('datadir') / 'doc' / 'taler-mdb' 20 21 if get_option('install-rpath') 22 rpath_option = get_option('prefix') / get_option('libdir') 23 else 24 rpath_option = '' 25 endif 26 27 install_emptydir(docdir) 28 install_data('README', 'COPYING', install_dir: docdir) 29 30 gnunet_user = false 31 dpkg_architecture_bin = find_program( 32 'dpkg-architecture', 33 '/usr/bin/dpkg-architecture', 34 required: false, 35 ) 36 if dpkg_architecture_bin.found() 37 private_config.set( 38 'MULTIARCH', 39 dpkg_architecture_bin.full_path() + ' -qDEB_HOST_MULTIARCH', 40 ) 41 endif 42 43 TALER_PLUGIN_LDFLAGS = [ 44 '-export-dynamic', 45 '-avoid-version', 46 '-module', 47 '--no-undefined', 48 ] 49 50 cdata = configuration_data() 51 if not get_option('only-doc') 52 add_project_arguments( 53 '-Wall', 54 '-Wno-address-of-packed-member', 55 language: 'c', 56 ) 57 taler_lib_ldflags = '-export-dynamic -no-undefined' 58 59 check_headers = ['stdint.h', 'stdlib.h', 'string.h', 'unistd.h'] 60 61 foreach h : check_headers 62 if cc.check_header(h) 63 define = 'HAVE_' + h.underscorify().to_upper() 64 message(define) 65 private_config.set(define, 1) 66 endif 67 endforeach 68 69 zlib_dep = dependency('zlib', required: false) 70 if not zlib_dep.found() 71 zlib_dep = cc.find_library('zlib', required: true) 72 endif 73 m_dep = cc.find_library('m', required: false) 74 if m_dep.found() 75 private_config.set('HAVE_LIBM', 1) 76 endif 77 78 79 mhd_dep = dependency('libmicrohttpd', required: false) 80 if not mhd_dep.found() 81 mhd_dep = cc.find_library('microhttpd', required: true) 82 endif 83 84 json_dep = dependency('jansson', required: false) 85 if not json_dep.found() 86 json_dep = cc.find_library('jansson', required: true) 87 endif 88 89 gcrypt_dep = dependency('libgcrypt', required: false) 90 if not gcrypt_dep.found() 91 gcrypt_dep = cc.find_library('gcrypt', required: true) 92 endif 93 94 private_config.set_quoted('NEED_LIBGCRYPT_VERSION', '1.6.1') 95 96 gnunetutil_dep = dependency('gnunetutil', required: false) 97 if not gnunetutil_dep.found() 98 gnunetutil_dep = cc.find_library('gnunetutil', required: true) 99 endif 100 101 cc.has_header_symbol( 102 'gnunet/gnunet_util_lib.h', 103 'GNUNET_TIME_round_up', 104 dependencies: [gnunetutil_dep], 105 required: true, 106 ) 107 108 gnunetjson_dep = dependency('gnunetjson', required: false) 109 if not gnunetjson_dep.found() 110 gnunetjson_dep = cc.find_library('gnunetjson', required: true) 111 endif 112 113 curl_dep = dependency('libcurl', version: '>=7.34.0', required: false) 114 if not curl_dep.found() 115 curl_dep = cc.find_library('curl', required: true) 116 curl_version_check = '''#include <curl/curl.h> 117 int main(int argc, char **argv) { 118 #if LIBCURL_VERSION_NUM < 0x073400 119 #error "cURL version >= 7.34.0 required" 120 #endif 121 return 0; 122 } 123 ''' 124 if not cc.compiles( 125 curl_version_check, 126 name: 'cURL version check', 127 dependencies: curl_dep, 128 ) 129 error('cURL version >=7.34.0 required') 130 endif 131 endif 132 133 gnunetcurl_dep = dependency('gnunetcurl', required: false) 134 if not gnunetcurl_dep.found() 135 gnunetcurl_dep = cc.find_library('gnunetcurl', required: true) 136 endif 137 cc.has_header_symbol( 138 'gnunet/gnunet_curl_lib.h', 139 'GNUNET_CURL_get_select_info', 140 dependencies: [gnunetcurl_dep], 141 required: true, 142 ) 143 144 talerutil_dep = dependency('talerutil', required: false) 145 if not talerutil_dep.found() 146 talerutil_dep = cc.find_library('talerutil', required: true) 147 endif 148 cc.has_header_symbol( 149 'taler/taler_util.h', 150 'TALER_merchant_instance_auth_hash_with_salt', 151 required: true, 152 dependencies: [talerutil_dep], 153 ) 154 private_config.set10('HAVE_TALERUTIL', talerutil_dep.found()) 155 talertemplating_dep = dependency('talertemplating', required: false) 156 if not talertemplating_dep.found() 157 talertemplating_dep = cc.find_library('talertemplating', required: true) 158 endif 159 talerjson_dep = dependency('talerjson', required: false) 160 if not talerjson_dep.found() 161 talerjson_dep = cc.find_library('talerjson', required: true) 162 endif 163 talermhd_dep = dependency('talermhd', required: false) 164 if not talermhd_dep.found() 165 talermhd_dep = cc.find_library('talermhd', required: true) 166 endif 167 cc.has_header_symbol( 168 'taler/taler_mhd_lib.h', 169 'TALER_MHD_parse_request_arg_rel_time', 170 required: true, 171 dependencies: [talermhd_dep], 172 ) 173 private_config.set10('HAVE_TALERMHD', talermhd_dep.found()) 174 qrencode_dep = dependency('qrencode', required: false) 175 if not qrencode_dep.found() 176 qrencode_dep = cc.find_library('qrencode', required: false) 177 endif 178 private_config.set10('HAVE_QR', qrencode_dep.found()) 179 180 181 talerexchange_dep = dependency('talerexchange', required: false) 182 if not talerexchange_dep.found() 183 talerexchange_dep = cc.find_library('talerexchange', required: true) 184 endif 185 private_config.set10('HAVE_TALEREXCHANGE', talerexchange_dep.found()) 186 187 talermerchant_dep = dependency('talermerchant', required: false) 188 if not talermerchant_dep.found() 189 talermerchant_dep = cc.find_library('talermerchant', required: true) 190 endif 191 cc.has_header_symbol( 192 'taler/taler_merchant_service.h', 193 'TALER_MERCHANT_parse_pay_uri', 194 required: true, 195 dependencies: [talermerchant_dep], 196 ) 197 private_config.set10('HAVE_TALERMERCHANT', talermerchant_dep.found()) 198 talermerchanttesting_dep = dependency( 199 'talermerchanttesting', 200 required: false, 201 ) 202 203 nfc_dep = dependency('nfc', required: false) 204 if not nfc_dep.found() 205 nfc_dep = cc.find_library('nfc', required: true) 206 endif 207 cc.has_header_symbol( 208 'nfc/nfc.h', 209 'nfc_open', 210 required: true, 211 dependencies: [nfc_dep], 212 ) 213 214 logging_opt = get_option('logging') 215 logging_verbosity = 0 216 217 if logging_opt == 'yes' 218 logging_verbosity = 1 219 endif 220 if logging_opt == 'no' 221 add_project_arguments('-DGNUNET_CULL_LOGGING=1', language: 'c') 222 endif 223 if logging_opt == 'verbose' 224 logging_verbosity = 2 225 endif 226 if logging_opt == 'veryverbose' 227 logging_verbosity = 3 228 endif 229 230 #add_project_arguments('-DGNUNET_EXTRA_LOGGING=@0@'.format(logging_verbosity), language: 'c') 231 232 233 # todo gcov has meson builtin 234 235 # Used to populate configuration file and script templates 236 237 238 libltversions = [['libtalermdb', '0:0:0']] 239 240 solibversions = {} 241 242 foreach libversion : libltversions 243 ltversion = libversion[1].split(':') 244 current = ltversion[0].to_int() 245 revision = ltversion[1].to_int() 246 age = ltversion[2].to_int() 247 soversion_str = '@0@'.format(current - age) 248 ltversion_str = '@0@.@1@.@2@'.format(current - age, age, revision) 249 solibversions = solibversions + { 250 libversion[0]: { 251 'soversion': soversion_str, 252 'version': ltversion_str, 253 }, 254 } 255 endforeach 256 257 private_config.set_quoted('PACKAGE', meson.project_name()) 258 private_config.set_quoted('PACKAGE_VERSION', meson.project_version()) 259 # Compatibility. Used in source. 260 private_config.set_quoted('VERSION', meson.project_version()) 261 private_config.set_quoted('VCS_VERSION', 'mesonbuild') 262 private_config.set_quoted('PACKAGE_BUGREPORT', 'taler@gnu.org') 263 configure_file(output: 'config.h', configuration: private_config) 264 configuration_inc = include_directories('.') 265 266 cdata.merge_from(private_config) 267 add_project_arguments('-DHAVE_CONFIG_H', language: 'c') 268 269 pkg = import('pkgconfig') 270 subdir('contrib') 271 subdir('src') 272 if not get_option('disable-doc') 273 subdir('doc') 274 endif 275 276 taler_prefix = get_option('prefix') / get_option('libdir') 277 278 add_test_setup( 279 'default', 280 env: ['TALER_MDB_PREFIX=' + taler_prefix], 281 exclude_suites: ['perf', 'installcheck', 'integrationtests'], 282 is_default: true, 283 ) 284 else 285 subdir('contrib') 286 if not get_option('disable-doc') 287 subdir('doc') 288 endif 289 endif 290 291 #meson.add_dist_script('meson-dist-script') 292