anastasis-gtk

Demonstrator GUI for Anastasis
Log | Files | Refs | README | LICENSE

meson.build (9229B)


      1 project(
      2     'anastasis-gtk',
      3     'c',
      4     license: 'AGPLv3',
      5     meson_version: '>=1.1.0',
      6     version: '0.7.0',
      7 )
      8 
      9 cc = meson.get_compiler('c')
     10 incdir = include_directories('.', 'src/include')
     11 
     12 # Used to populate gnunet_private_config.h
     13 private_config = configuration_data()
     14 
     15 
     16 plugindir = get_option('libdir') / 'anastasis-gtk'
     17 pkgdatadir = get_option('datadir') / 'anastasis-gtk'
     18 pkgcfgdir = pkgdatadir / 'config.d'
     19 docdir = get_option('datadir') / 'doc' / 'anastasis-gtk'
     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 = ['errno.h', 'stdio.h', 'unistd.h', 'locale.h', 'sys/stat.h', 'sys/types.h', 'langinfo.h', 'libintl.h', 'stddef.h', 'argz.h', 'sys/socket.h', 'netinet/in.h', 'stdarg.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     if cc.has_function('getpwnam')
     70       private_config.set('HAVE_GETPWNAM', 1)
     71     endif
     72     if cc.has_header_symbol('_stati64', 'sys/stat.h')
     73       private_config.set('HAVE_DECL__STATI64', 1)
     74     endif
     75 
     76 
     77     # Gettext
     78     i18n = import('i18n')
     79 
     80     gettext_package = 'anastasis-gtk'
     81     add_project_arguments('-DGETTEXT_PACKAGE=' + gettext_package, language: 'c')
     82     add_project_arguments('-DENABLE_NLS=1', language: 'c')
     83 
     84     magic_dep = dependency('magic', required: false)
     85     if not magic_dep.found()
     86         magic_dep = cc.find_library('magic', required: true)
     87     endif
     88     haru_dep = dependency('hpdf', required: false)
     89     if not haru_dep.found()
     90         haru_dep = cc.find_library('hpdf', required: false)
     91     endif
     92 
     93     qrencode_dep = dependency('qrencode', required: false)
     94     if not qrencode_dep.found()
     95         qrencode_dep = cc.find_library('qrencode', required: true)
     96     endif
     97  
     98     mhd_dep = dependency('libmicrohttpd', required: false)
     99     if not mhd_dep.found()
    100         mhd_dep = cc.find_library('microhttpd', required: true)
    101     endif
    102 
    103     json_dep = dependency('jansson', required: false)
    104     if not json_dep.found()
    105         json_dep = cc.find_library('jansson', required: true)
    106     endif
    107 
    108     gcrypt_dep = dependency('libgcrypt', required: false)
    109     if not gcrypt_dep.found()
    110         gcrypt_dep = cc.find_library('gcrypt', required: true)
    111     endif
    112 
    113     private_config.set_quoted('NEED_LIBGCRYPT_VERSION', '1.6.1')
    114 
    115     anastasis_dep = dependency('anastasis', required: false)
    116     if not anastasis_dep.found()
    117         anastasis_dep = cc.find_library('anastasis', required: true)
    118     endif
    119 
    120     cc.has_header_symbol(
    121         'anastasis/anastasis_service.h',
    122         'ANASTASIS_get_config',
    123         dependencies: [anastasis_dep],
    124         required: true,
    125     )
    126 
    127     anastasisrest_dep = dependency('anastasisrest', required: false)
    128     if not anastasisrest_dep.found()
    129         anastasisrest_dep = cc.find_library('anastasisrest', required: true)
    130     endif
    131 
    132     anastasisredux_dep = dependency('anastasisredux', required: false)
    133     if not anastasisredux_dep.found()
    134         anastasisredux_dep = cc.find_library('anastasisredux', required: true)
    135     endif
    136 
    137     anastasisutil_dep = dependency('anastasisutil', required: false)
    138     if not anastasisutil_dep.found()
    139         anastasisutil_dep = cc.find_library('anastasisutil', required: true)
    140     endif
    141 
    142 
    143 
    144 
    145     gnunetutil_dep = dependency('gnunetutil', required: false)
    146     if not gnunetutil_dep.found()
    147         gnunetutil_dep = cc.find_library('gnunetutil', required: true)
    148     endif
    149 
    150     cc.has_header_symbol(
    151         'gnunet/gnunet_util_lib.h',
    152         'GNUNET_TIME_round_up',
    153         dependencies: [gnunetutil_dep],
    154         required: true,
    155     )
    156     gnunetjson_dep = dependency('gnunetjson', required: false)
    157     if not gnunetjson_dep.found()
    158         gnunetjson_dep = cc.find_library('gnunetjson', required: true)
    159     endif
    160     gnunetcurl_dep = dependency('gnunetcurl', required: false)
    161     if not gnunetcurl_dep.found()
    162         gnunetcurl_dep = cc.find_library('gnunetcurl', required: true)
    163     endif
    164     talerjson_dep = dependency('talerjson', required: false)
    165     if not talerjson_dep.found()
    166         talerjson_dep = cc.find_library('talerjson', required: true)
    167     endif
    168     cc.has_header_symbol(
    169         'taler/taler_json_lib.h',
    170         'TALER_JSON_currency_specs_to_json',
    171         required: true,
    172         dependencies: [talerjson_dep],
    173     )
    174     private_config.set10('HAVE_TALERJSON', talerjson_dep.found())
    175 
    176     talerutil_dep = dependency('talerutil', required: false)
    177     if not talerutil_dep.found()
    178         talerutil_dep = cc.find_library('talerutil', required: true)
    179     endif
    180     cc.has_header_symbol(
    181         'taler/taler_util.h',
    182         'TALER_merchant_instance_auth_hash_with_salt',
    183         required: true,
    184         dependencies: [talerutil_dep],
    185     )
    186     private_config.set10('HAVE_TALERUTIL', talerutil_dep.found())
    187 
    188 
    189     gtk_dep = dependency('gtk+-3.0', required: false)
    190     if not gtk_dep.found()
    191         gtk_dep = cc.find_library('gtk+-3.0', required: true)
    192     endif
    193 
    194     glade_dep = dependency('gladeui-2.0', required: false)
    195     if not glade_dep.found()
    196         glade_dep = cc.find_library('glade-2.0', required: true)
    197     endif
    198 
    199     curl_dep = dependency('libcurl', version: '>=7.34.0', required: false)
    200     if not curl_dep.found()
    201         curl_dep = cc.find_library('curl', required: true)
    202         curl_version_check = '''#include <curl/curl.h>
    203   int main(int argc, char **argv) {
    204     #if LIBCURL_VERSION_NUM < 0x073400
    205       #error "cURL version >= 7.34.0 required"
    206     #endif
    207     return 0;
    208     }
    209   '''
    210         if not cc.compiles(
    211             curl_version_check,
    212             name: 'cURL version check',
    213             dependencies: curl_dep,
    214         )
    215             error('cURL version >=7.34.0 required')
    216         endif
    217     endif
    218 
    219     logging_opt = get_option('logging')
    220     logging_verbosity = 0
    221 
    222     if logging_opt == 'yes'
    223         logging_verbosity = 1
    224     endif
    225     if logging_opt == 'no'
    226         add_project_arguments('-DGNUNET_CULL_LOGGING=1', language: 'c')
    227     endif
    228     if logging_opt == 'verbose'
    229         logging_verbosity = 2
    230     endif
    231     if logging_opt == 'veryverbose'
    232         logging_verbosity = 3
    233     endif
    234 
    235     #add_project_arguments('-DGNUNET_EXTRA_LOGGING=@0@'.format(logging_verbosity), language: 'c')
    236 
    237 
    238     # todo gcov has meson builtin
    239 
    240     # Used to populate configuration file and script templates
    241 
    242 
    243     libltversions = [
    244         ['libanastasisgtkutil', '0:0:0'],
    245     ]
    246 
    247     solibversions = {}
    248 
    249     foreach libversion : libltversions
    250         ltversion = libversion[1].split(':')
    251         current = ltversion[0].to_int()
    252         revision = ltversion[1].to_int()
    253         age = ltversion[2].to_int()
    254         soversion_str = '@0@'.format(current - age)
    255         ltversion_str = '@0@.@1@.@2@'.format(current - age, age, revision)
    256         solibversions = solibversions + {
    257             libversion[0]: {
    258                 'soversion': soversion_str,
    259                 'version': ltversion_str,
    260             },
    261         }
    262     endforeach
    263 
    264     #private_config.set_quoted('PACKAGE', meson.project_name())
    265     add_project_arguments('-DPACKAGE="@0@"'.format(meson.project_name()), language: 'c')
    266     add_project_arguments('-DPACKAGE_NAME="@0@"'.format(meson.project_name()), language: 'c')
    267     private_config.set_quoted('PACKAGE_VERSION', meson.project_version())
    268     # Compatibility. Used in source.
    269     private_config.set_quoted('VERSION', meson.project_version())
    270     private_config.set_quoted('VCS_VERSION', 'mesonbuild')
    271     private_config.set_quoted('PACKAGE_BUGREPORT', 'taler@gnu.org')
    272     configure_file(output: 'anastasis_gtk_config.h', configuration: private_config)
    273     configuration_inc = include_directories('.')
    274 
    275     cdata.merge_from(private_config)
    276     add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
    277 
    278     pkg = import('pkgconfig')
    279     subdir('contrib')
    280     subdir('src')
    281     if not get_option('disable-doc')
    282         subdir('doc')
    283     endif
    284 
    285     taler_prefix = get_option('prefix') / get_option('libdir')
    286 
    287     add_test_setup(
    288         'default',
    289         env: ['ANASTASIS_PREFIX=' + taler_prefix],
    290         exclude_suites: ['perf', 'installcheck', 'integrationtests'],
    291         is_default: true,
    292     )
    293 else
    294     subdir('contrib')
    295     if not get_option('disable-doc')
    296         subdir('doc')
    297     endif
    298 endif
    299 
    300 run_target(
    301     'doxygen',
    302     command: 'scripts/doxygen.meson.sh',
    303     env: {'PACKAGE_VERSION': meson.project_version()},
    304 )
    305 
    306 #meson.add_dist_script('meson-dist-script')
    307