-
Notifications
You must be signed in to change notification settings - Fork 34
/
meson.build
98 lines (86 loc) · 3.11 KB
/
meson.build
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
project(
'zck', 'c',
version : '1.5.1',
meson_version : '>=0.53.0',
default_options : ['c_std=gnu11']
)
so_version = '1'
common_cflags = [
'-Wunused-result',
]
fs = import('fs')
cc = meson.get_compiler('c')
add_project_arguments(cc.get_supported_arguments(common_cflags), language : 'c')
if build_machine.system() == 'freebsd' or build_machine.system() == 'midnightbsd'
add_project_arguments('-DFREEBSD', language : 'c')
endif
# zstd dependency
if build_machine.system() == 'windows'
zstd_dep = dependency('zstd', modules: 'zstd::libzstd_shared', required : get_option('with-zstd'), fallback: ['zstd', 'libzstd_dep'])
else
zstd_dep = dependency('libzstd', required : get_option('with-zstd'), fallback: ['zstd', 'libzstd_dep'],
default_options: ['bin_programs=false', 'zlib=disabled', 'lzma=disabled', 'lz4=disabled'])
endif
if zstd_dep.found()
add_project_arguments('-DZCHUNK_ZSTD', language : 'c')
if zstd_dep.version().version_compare('<=1.4.9')
add_project_arguments('-DOLD_ZSTD', language : 'c')
endif
endif
# curl dependency
if build_machine.system() == 'windows'
curl_dep = dependency('curl', modules : 'CURL::libcurl', required : get_option('with-curl'), disabler : true)
else
curl_dep = dependency('libcurl', required : get_option('with-curl'), disabler : true)
endif
# openssl dependency
if build_machine.system() == 'windows'
openssl_dep = dependency('openssl', modules : ['OpenSSL::SSL', 'OpenSSL::Crypto'], required : get_option('with-openssl'))
else
openssl_dep = dependency('openssl', required : get_option('with-openssl'))
endif
if openssl_dep.found()
add_project_arguments('-DZCHUNK_OPENSSL', language : 'c')
if openssl_dep.version().version_compare('<3.0.0')
add_project_arguments('-DZCHUNK_OPENSSL_DEPRECATED', language : 'c')
endif
endif
# includes
inc = []
inc += include_directories('include')
if host_machine.system() == 'windows'
inc += include_directories('src/lib/win32')
endif
# argp-standalone dependency (if required)
if build_machine.system() == 'windows' or build_machine.system() == 'darwin' or build_machine.system() == 'freebsd' or not cc.links('#include <argp.h>\nerror_t parse_opt (int key, char *arg, struct argp_state *state) { argp_usage(state); return 0; }; void main() {}')
argplib = cc.find_library('argp', has_headers : ['argp.h'], required: false)
if not argplib.found()
argplib = dependency('argp-standalone')
endif
else
argplib = dependency('', required : false)
endif
subdir('include')
subdir('src')
if not get_option('coverity') and get_option('tests')
subdir('test')
endif
pkg_mod = import('pkgconfig')
pkg_mod.generate(
zcklib,
version : meson.project_version(),
name : 'libzck',
filebase : 'zck',
description : 'A library for generating easy-to-delta files.'
)
if get_option('docs')
install_man([
'doc/unzck.1',
'doc/zck.1',
'doc/zck_delta_size.1',
'doc/zck_gen_zdict.1',
'doc/zck_read_header.1',
'doc/zckdl.1',
])
endif
libzck_dep = declare_dependency(link_with: zcklib, include_directories: 'include')