# This file is in the public domain
install_data('authorization-email.conf', install_dir: pkgcfgdir)

subdir('libanastasiseufin')

install_data(
    'authorization-email-messages.json',
    'authorization-iban-messages.json',
    'authorization-post-messages.json',
    'authorization-sms-messages.json',
    install_dir: pkgdatadir,
)

install_data(
    'anastasis-authorization-email.sh',
    'anastasis-authorization-sms.sh',
    'anastasis-authorization-sms-clicksend.sh',
    'anastasis-authorization-sms-telesign.sh',
    'anastasis-authorization-post.sh',
    install_dir: get_option('bindir'),
)

executable(
    'anastasis-helper-authorization-iban',
    ['anastasis-helper-authorization-iban.c'],
    dependencies: [
        libanastasisutil_dep,
        libanastasisdb_dep,
        libanastasiseufin_dep,
        gnunetutil_dep,
        gnunetcurl_dep,
        json_dep,
        mhd_dep,
        talerutil_dep,
        talermhd_dep,
    ],
    include_directories: [incdir, configuration_inc],
    install: true,
)


libanastasisauthorization_SOURCES = ['anastasis_authorization_plugin.c']

libanastasisauthorization = library(
    'anastasisauthorization',
    libanastasisauthorization_SOURCES,
    soversion: solibversions['libanastasisauthorization']['soversion'],
    version: solibversions['libanastasisauthorization']['soversion'],
    install_rpath: rpath_option,
    dependencies: [
        libanastasisutil_dep,
        gnunetutil_dep,
        gnunetcurl_dep,
        talerutil_dep,
        mhd_dep,
    ],
    include_directories: [incdir, configuration_inc],
    install: true,
    install_dir: get_option('libdir'),
)

libanastasisauthorization_dep = declare_dependency(
    link_with: libanastasisauthorization,
)
pkg.generate(
    libanastasisauthorization,
    url: 'https://taler.net',
    description: 'GNU Taler anastasis authorization library',
)


shared_module(
    'anastasis_plugin_authorization_file',
    ['anastasis_authorization_plugin_file.c'],
    dependencies: [
        libanastasisdb_dep,
        gnunetutil_dep,
        talerjson_dep,
        talermhd_dep,
        talerutil_dep,
        gnunetjson_dep,
        mhd_dep,
        json_dep,
    ],
    include_directories: [incdir, configuration_inc],
    install: true,
    install_dir: plugindir,
)

shared_module(
    'anastasis_plugin_authorization_email',
    ['anastasis_authorization_plugin_email.c'],
    dependencies: [
        libanastasisutil_dep,
        libanastasisdb_dep,
        gnunetutil_dep,
        talerjson_dep,
        talermhd_dep,
        talerutil_dep,
        gnunetjson_dep,
        mhd_dep,
        json_dep,
    ],
    include_directories: [incdir, configuration_inc],
    install: true,
    install_dir: plugindir,
)

shared_module(
    'anastasis_plugin_authorization_iban',
    ['anastasis_authorization_plugin_iban.c'],
    dependencies: [
        libanastasisutil_dep,
        libanastasisdb_dep,
        gnunetutil_dep,
        talerjson_dep,
        talermhd_dep,
        talerutil_dep,
        gnunetjson_dep,
        mhd_dep,
        json_dep,
    ],
    include_directories: [incdir, configuration_inc],
    install: true,
    install_dir: plugindir,
)


shared_module(
    'anastasis_plugin_authorization_post',
    ['anastasis_authorization_plugin_post.c'],
    dependencies: [
        libanastasisutil_dep,
        libanastasisdb_dep,
        gnunetutil_dep,
        talerjson_dep,
        talermhd_dep,
        talerutil_dep,
        gnunetjson_dep,
        mhd_dep,
        json_dep,
    ],
    include_directories: [incdir, configuration_inc],
    install: true,
    install_dir: plugindir,
)


shared_module(
    'anastasis_plugin_authorization_sms',
    ['anastasis_authorization_plugin_sms.c'],
    dependencies: [
        libanastasisutil_dep,
        libanastasisdb_dep,
        gnunetutil_dep,
        talerjson_dep,
        talermhd_dep,
        talerutil_dep,
        gnunetjson_dep,
        mhd_dep,
        json_dep,
    ],
    include_directories: [incdir, configuration_inc],
    install: true,
    install_dir: plugindir,
)

shared_module(
    'anastasis_plugin_authorization_totp',
    ['anastasis_authorization_plugin_totp.c'],
    dependencies: [
        libanastasisutil_dep,
        libanastasisdb_dep,
        gnunetutil_dep,
        talerjson_dep,
        talermhd_dep,
        talerutil_dep,
        gnunetjson_dep,
        mhd_dep,
        json_dep,
        gcrypt_dep,
    ],
    include_directories: [incdir, configuration_inc],
    install: true,
    install_dir: plugindir,
)


