anastasis-gtk

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

meson.build (9653B)


      1 project(
      2     'anastasis-gtk',
      3     'c',
      4     license: 'AGPLv3',
      5     meson_version: '>=1.1.0',
      6     version: run_command('sh', 'scripts/get_version.sh', check: true).stdout().strip(),
      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 pkgdatadir = get_option('datadir') / 'anastasis-gtk'
     17 docdir = get_option('datadir') / 'doc' / 'anastasis-gtk'
     18 desktopdir = get_option('datadir') / 'applications'
     19 
     20 if get_option('install-rpath')
     21     rpath_option = get_option('prefix') / get_option('libdir')
     22 else
     23     rpath_option = ''
     24 endif
     25 
     26 install_emptydir(docdir)
     27 install_data('README', 'COPYING', install_dir: docdir)
     28 
     29 # The .desktop file has no substitutions; it is installed verbatim
     30 # (autotools generated it via AC_CONFIG_FILES and installed it to
     31 # $(datadir)/applications).
     32 configure_file(
     33     input: 'anastasis-gtk.desktop.in',
     34     output: 'anastasis-gtk.desktop',
     35     copy: true,
     36     install: true,
     37     install_dir: desktopdir,
     38 )
     39 
     40 dpkg_architecture_bin = find_program(
     41     'dpkg-architecture',
     42     '/usr/bin/dpkg-architecture',
     43     required: false,
     44 )
     45 if dpkg_architecture_bin.found()
     46     private_config.set(
     47         'MULTIARCH',
     48         dpkg_architecture_bin.full_path() + ' -qDEB_HOST_MULTIARCH',
     49     )
     50 endif
     51 
     52 if not get_option('only-doc')
     53     add_project_arguments(
     54         '-Wall',
     55         '-Wno-address-of-packed-member',
     56         language: 'c',
     57     )
     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     # The autotools build tested for the header (AC_CHECK_HEADERS(hpdf.h)) and
     93     # the UI still asks for HAVE_HPDF_H to decide whether to offer the "Save as
     94     # PDF" button, so the define and the source set have to be decided together:
     95     # without the define the button stays hidden even though the code is built.
     96     have_hpdf = haru_dep.found() and cc.has_header('hpdf.h')
     97     if have_hpdf
     98         private_config.set('HAVE_HPDF_H', 1)
     99     else
    100         message('libharu not found, PDF support disabled')
    101     endif
    102 
    103     qrencode_dep = dependency('qrencode', required: false)
    104     if not qrencode_dep.found()
    105         qrencode_dep = cc.find_library('qrencode', required: true)
    106     endif
    107  
    108     mhd_dep = dependency('libmicrohttpd', required: false)
    109     if not mhd_dep.found()
    110         mhd_dep = cc.find_library('microhttpd', required: true)
    111     endif
    112 
    113     json_dep = dependency('jansson', required: false)
    114     if not json_dep.found()
    115         json_dep = cc.find_library('jansson', required: true)
    116     endif
    117 
    118     gcrypt_dep = dependency('libgcrypt', required: false)
    119     if not gcrypt_dep.found()
    120         gcrypt_dep = cc.find_library('gcrypt', required: true)
    121     endif
    122 
    123     private_config.set_quoted('NEED_LIBGCRYPT_VERSION', '1.6.1')
    124 
    125     anastasis_dep = dependency('anastasis', required: false)
    126     if not anastasis_dep.found()
    127         anastasis_dep = cc.find_library('anastasis', required: true)
    128     endif
    129 
    130     cc.has_header_symbol(
    131         'anastasis/anastasis_service.h',
    132         'ANASTASIS_get_config',
    133         dependencies: [anastasis_dep],
    134         required: true,
    135     )
    136 
    137     anastasisrest_dep = dependency('anastasisrest', required: false)
    138     if not anastasisrest_dep.found()
    139         anastasisrest_dep = cc.find_library('anastasisrest', required: true)
    140     endif
    141 
    142     anastasisredux_dep = dependency('anastasisredux', required: false)
    143     if not anastasisredux_dep.found()
    144         anastasisredux_dep = cc.find_library('anastasisredux', required: true)
    145     endif
    146 
    147     anastasisutil_dep = dependency('anastasisutil', required: false)
    148     if not anastasisutil_dep.found()
    149         anastasisutil_dep = cc.find_library('anastasisutil', required: true)
    150     endif
    151 
    152 
    153 
    154 
    155     gnunetutil_dep = dependency('gnunetutil', required: false)
    156     if not gnunetutil_dep.found()
    157         gnunetutil_dep = cc.find_library('gnunetutil', required: true)
    158     endif
    159 
    160     cc.has_header_symbol(
    161         'gnunet/gnunet_util_lib.h',
    162         'GNUNET_TIME_round_up',
    163         dependencies: [gnunetutil_dep],
    164         required: true,
    165     )
    166     gnunetjson_dep = dependency('gnunetjson', required: false)
    167     if not gnunetjson_dep.found()
    168         gnunetjson_dep = cc.find_library('gnunetjson', required: true)
    169     endif
    170     gnunetcurl_dep = dependency('gnunetcurl', required: false)
    171     if not gnunetcurl_dep.found()
    172         gnunetcurl_dep = cc.find_library('gnunetcurl', required: true)
    173     endif
    174     talerjson_dep = dependency('talerjson', required: false)
    175     if not talerjson_dep.found()
    176         talerjson_dep = cc.find_library('talerjson', required: true)
    177     endif
    178     cc.has_header_symbol(
    179         'taler/taler_json_lib.h',
    180         'TALER_JSON_currency_specs_to_json',
    181         required: true,
    182         dependencies: [talerjson_dep],
    183     )
    184     private_config.set10('HAVE_TALERJSON', talerjson_dep.found())
    185 
    186     talerutil_dep = dependency('talerutil', required: false)
    187     if not talerutil_dep.found()
    188         talerutil_dep = cc.find_library('talerutil', required: true)
    189     endif
    190     cc.has_header_symbol(
    191         'taler/taler_util.h',
    192         'TALER_merchant_instance_auth_hash_with_salt',
    193         required: true,
    194         dependencies: [talerutil_dep],
    195     )
    196     private_config.set10('HAVE_TALERUTIL', talerutil_dep.found())
    197 
    198 
    199     gtk_dep = dependency('gtk4', version: '>=4.10', required: false)
    200     if not gtk_dep.found()
    201         gtk_dep = cc.find_library('gtk-4', required: true)
    202     endif
    203 
    204     curl_dep = dependency('libcurl', version: '>=7.34.0', required: false)
    205     if not curl_dep.found()
    206         curl_dep = cc.find_library('curl', required: true)
    207         curl_version_check = '''#include <curl/curl.h>
    208   int main(int argc, char **argv) {
    209     #if LIBCURL_VERSION_NUM < 0x073400
    210       #error "cURL version >= 7.34.0 required"
    211     #endif
    212     return 0;
    213     }
    214   '''
    215         if not cc.compiles(
    216             curl_version_check,
    217             name: 'cURL version check',
    218             dependencies: curl_dep,
    219         )
    220             error('cURL version >=7.34.0 required')
    221         endif
    222     endif
    223 
    224     logging_opt = get_option('logging')
    225     logging_verbosity = 0
    226 
    227     if logging_opt == 'yes'
    228         logging_verbosity = 1
    229     endif
    230     if logging_opt == 'no'
    231         add_project_arguments('-DGNUNET_CULL_LOGGING=1', language: 'c')
    232     endif
    233     if logging_opt == 'verbose'
    234         logging_verbosity = 2
    235     endif
    236     if logging_opt == 'veryverbose'
    237         logging_verbosity = 3
    238     endif
    239 
    240     #add_project_arguments('-DGNUNET_EXTRA_LOGGING=@0@'.format(logging_verbosity), language: 'c')
    241 
    242 
    243     # todo gcov has meson builtin
    244 
    245     # Used to populate configuration file and script templates
    246 
    247 
    248     libltversions = [
    249         ['libanastasisgtkutil', '0:0:0'],
    250     ]
    251 
    252     solibversions = {}
    253 
    254     foreach libversion : libltversions
    255         ltversion = libversion[1].split(':')
    256         current = ltversion[0].to_int()
    257         revision = ltversion[1].to_int()
    258         age = ltversion[2].to_int()
    259         soversion_str = '@0@'.format(current - age)
    260         ltversion_str = '@0@.@1@.@2@'.format(current - age, age, revision)
    261         solibversions = solibversions + {
    262             libversion[0]: {
    263                 'soversion': soversion_str,
    264                 'version': ltversion_str,
    265             },
    266         }
    267     endforeach
    268 
    269     #private_config.set_quoted('PACKAGE', meson.project_name())
    270     add_project_arguments('-DPACKAGE="@0@"'.format(meson.project_name()), language: 'c')
    271     add_project_arguments('-DPACKAGE_NAME="@0@"'.format(meson.project_name()), language: 'c')
    272     private_config.set_quoted('PACKAGE_VERSION', meson.project_version())
    273     # Compatibility. Used in source.
    274     private_config.set_quoted('VERSION', meson.project_version())
    275     private_config.set_quoted('PACKAGE_BUGREPORT', 'taler@gnu.org')
    276     configure_file(output: 'anastasis_gtk_config.h', configuration: private_config)
    277     configuration_inc = include_directories('.')
    278 
    279     add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
    280 
    281     pkg = import('pkgconfig')
    282     subdir('contrib')
    283     subdir('src')
    284     subdir('po')
    285     if not get_option('disable-doc')
    286         subdir('doc')
    287     endif
    288 
    289     taler_prefix = get_option('prefix') / get_option('libdir')
    290 
    291     add_test_setup(
    292         'default',
    293         env: ['ANASTASIS_PREFIX=' + taler_prefix],
    294         exclude_suites: ['perf', 'installcheck', 'integrationtests'],
    295         is_default: true,
    296     )
    297 else
    298     subdir('contrib')
    299     if not get_option('disable-doc')
    300         subdir('doc')
    301     endif
    302 endif
    303 
    304 run_target(
    305     'doxygen',
    306     command: 'scripts/doxygen.meson.sh',
    307     env: {'PACKAGE_VERSION': meson.project_version()},
    308 )
    309 meson.add_dist_script('meson-dist-script')
    310