forked from 007/afpfs-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
150 lines (126 loc) · 3.79 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
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
142
143
144
145
146
147
148
149
150
project(
'afpfs-ng',
'c',
version: '0.9.0',
license: 'GPLv2',
default_options: ['warning_level=3', 'c_std=c11'],
meson_version: '>=0.61',
)
cc = meson.get_compiler('c')
host_os = host_machine.system()
build_type = get_option('buildtype')
afpfsng_version = meson.project_version()
install_prefix = get_option('prefix')
bindir = install_prefix / get_option('bindir')
libdir = install_prefix / get_option('libdir')
mandir = install_prefix / get_option('mandir')
datadir = install_prefix / get_option('datadir')
root_dependencies = []
libsearch_dirs = []
include_dirs = []
cflags = [
'-DAFPFS_VERSION="' + afpfsng_version + '"',
'-DBINDIR=' + bindir,
'-D_FILE_OFFSET_BITS=64',
'-D_GNU_SOURCE',
]
if build_type == 'debug'
cflags += '-DDEBUG'
endif
if host_os in ['dragonfly', 'freebsd', 'openbsd']
libsearch_dirs += '/usr/local/lib'
include_dirs += ['/usr/local/include']
cflags += '-DLIBICONV_PLUG'
elif host_os == 'netbsd'
libsearch_dirs += '/usr/pkg/lib'
include_dirs += ['/usr/pkg/include']
endif
ncurses_dep = cc.find_library('ncurses', dirs: libsearch_dirs, required: false)
readline_dep = cc.find_library('readline', dirs: libsearch_dirs, required: false)
pthread_dep = cc.find_library('pthread', dirs: libsearch_dirs, required: true)
libiconv_dep = cc.find_library('iconv', dirs: libsearch_dirs, required: false)
libbsd_dep = cc.find_library('bsd', dirs: libsearch_dirs, required: false)
if libbsd_dep.found()
root_dependencies += libbsd_dep
cflags += '-DHAVE_LIBBSD'
endif
gcrypt_dep = dependency('libgcrypt', version: '>=1.2.3', required: false)
libgmp_dep = dependency('gmp', required: false)
fuse_dep = cc.find_library('fuse', dirs: libsearch_dirs, required: false)
cmark = find_program('cmark', required: false)
cmarkgfm = find_program('cmark-gfm', required: false)
if cmark.found()
cmark_man = cmark
else
cmark_man = cmarkgfm
endif
with_afpcmd = ncurses_dep.found() and readline_dep.found()
with_fuse = get_option('enable-fuse') and fuse_dep.found()
with_crypt = gcrypt_dep.found() and libgmp_dep.found()
if with_fuse
cflags += [
'-DHAVE_LIBFUSE',
'-DFUSE_USE_VERSION=29',
]
endif
incdir = include_directories(['.', 'include', include_dirs])
if with_crypt
add_project_arguments('-DHAVE_LIBGCRYPT', language: 'c')
endif
subdir('lib')
if with_afpcmd
subdir('cmdline')
endif
if with_fuse
subdir('fuse')
endif
install_data(
['AUTHORS', 'BUGS', 'COPYING', 'NEWS', 'TODO'],
install_dir: datadir / 'doc' / 'afpfs-ng',
)
if cmarkgfm.found()
foreach file : ['INSTALL', 'README']
custom_target(
'readmes_' + file,
input: file + '.md',
output: file + '.txt',
command: [
cmarkgfm,
'--width', '80',
'--to', 'plaintext',
'@INPUT@',
],
capture: true,
install: true,
install_dir: datadir / 'doc' / 'afpfs-ng',
)
endforeach
endif
subdir('docs')
summary_info = {
'Build directory': meson.current_build_dir(),
'Source path': meson.current_source_dir(),
}
summary(summary_info, bool_yn: true, section: 'Build environment:')
summary_info = {
'Installation prefix': install_prefix,
'Executable directory': bindir,
'Library directory': libdir,
'Manual page directory': mandir,
}
summary(summary_info, bool_yn: true, section: 'Directories:')
summary_info = {
'Host CPU': host_machine.cpu_family(),
'Host endianness': build_machine.endian(),
'C compiler': cc.get_id(),
'Build stype': build_type,
'Shared or static libraries': get_option('default_library'),
}
summary(summary_info, bool_yn: true, section: 'Compilation:')
summary_info = {
'AFP CLI client': with_afpcmd,
'AFP FUSE client': with_fuse,
'DHX2 / DHX UAM support': with_crypt,
'man pages': cmark_man.found(),
}
summary(summary_info, bool_yn: true, section: 'Options:')