summaryrefslogtreecommitdiff
path: root/src/meson.build
blob: 233d38330f37fd52d94c1f6c5101850c4e68b828 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
libapk_src = [
    'atom.c',
    'blob.c',
    'commit.c',
    'common.c',
    'database.c',
    'hash.c',
    'io.c',
    'io_archive.c',
    'io_url.c',
    'io_gunzip.c',
    'package.c',
    'print.c',
    'solver.c',
    'version.c',
]

libapk_headers = [
    'apk_applet.h',
    'apk_atom.h',
    'apk_archive.h',
    'apk_blob.h',
    'apk_database.h',
    'apk_defines.h',
    'apk_hash.h',
    'apk_io.h',
    'apk_openssl.h',
    'apk_package.h',
    'apk_print.h',
    'apk_provider_data.h',
    'apk_solver_data.h',
    'apk_solver.h',
    'apk_version.h',
]

apk_src = [
    'apk.c',
    'app_add.c',
    'app_audit.c',
    'app_cache.c',
    'app_del.c',
    'app_dot.c',
    'app_fetch.c',
    'app_fix.c',
    'app_index.c',
    'app_info.c',
    'app_list.c',
    'app_manifest.c',
    'app_policy.c',
    'app_update.c',
    'app_upgrade.c',
    'app_search.c',
    'app_stats.c',
    'app_verify.c',
    'app_version.c',
    'help.c',
]

if lua_bin.found()
    genhelp_script = find_program('genhelp.lua')

    generated_help = custom_target(
        'help.h',
        capture: true,
        output: 'help.h',
        input: man_files,
        command: [genhelp_script, '@INPUT@'],
    )
else
    generated_help = custom_target(
        'help.h',
        capture: true,
        output: 'help.h',
        command: ['echo', '#define NO_HELP'],
    )
endif

apk_src += [ generated_help ]

apk_cargs = [
    '-DAPK_VERSION="' + meson.project_version() + '"',
    '-D_ATFILE_SOURCE',
]

libapk = library(
    'apk',
    libapk_src,
    version: meson.project_version(),
    install: true,
    dependencies: [
        libfetch_dep,
        zlib_dep,
        openssl_dep,
    ],
    c_args: apk_cargs,
)

libapk_dep = declare_dependency(
    link_with: libapk,
)

if not subproject
    pkgc.generate(
        libapk,
        name: 'apk',
        version: meson.project_version(),
    )

    install_headers(
        libapk_headers,
        subdir: 'apk',
    )
endif

if(lua_dep.found())
    luaapk_src = [
        'lua-apk.c',
    ]

    libluaapk = library(
        'luaapk',
        luaapk_src,
        dependencies: [lua_dep, libapk_dep],
        install: true,
        install_dir: lua_dep.get_pkgconfig_variable('libdir'),
        c_args: apk_cargs,
    )
endif

apk_exe = executable(
    'apk',
    apk_src,
    install: not subproject,
    dependencies: [
        libapk_dep,
        zlib_dep,
        openssl_dep,
        libfetch_dep.partial_dependency(includes: true),
    ],
    c_args: apk_cargs,
)