-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeson.build
More file actions
106 lines (89 loc) · 3.01 KB
/
meson.build
File metadata and controls
106 lines (89 loc) · 3.01 KB
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
project('ppm',
['c'],
license : 'PPM',
version : '1.2.0',
meson_version : '>= 0.56',
)
cc = meson.get_compiler('c')
wrap_mode = get_option('wrap_mode')
force_all_fallbacks = wrap_mode == 'forcefallback'
use_static_deps = force_all_fallbacks
zlib_dep = dependency('zlib', static: use_static_deps, fallback: ['zlib', 'zlib_dep'])
lzma_dep = dependency('liblzma', static: use_static_deps, fallback: ['liblzma', 'lzma_dep'])
lua_dep = dependency('lua', static: use_static_deps, fallback: ['lua', 'lua_dep'])
mbedtls_dep = [
dependency('mbedtls', static: use_static_deps, fallback: ['mbedtls', 'mbedtls_dep']),
dependency('mbedx509', static: use_static_deps, fallback: ['mbedtls', 'mbedx509_dep']),
dependency('mbedcrypto', static: use_static_deps, fallback: ['mbedtls', 'tfpsacrypto_dep']),
]
libgit2_dep = dependency('libgit2', static: use_static_deps, fallback: ['libgit2', 'libgit2_dep'])
libzip_dep = dependency('libzip', static: use_static_deps, fallback: ['libzip', 'zip_dep'])
microtar_lib = static_library('microtar', files('lib/microtar/src/microtar.c'))
microtar_dep = declare_dependency(
link_whole: [microtar_lib],
include_directories: ['lib/microtar/src']
)
ppm_source = files('src/ppm.c')
cflags = []
link_args = []
ppm_release_version = get_option('release_version')
ppm_full_version = get_option('full_version')
ppm_target_arch = get_option('target_arch')
ppm_binary_name = get_option('binary_name')
if ppm_release_version == ''
ppm_release_version = meson.project_version()
endif
if ppm_full_version == ''
ppm_full_version = ppm_release_version
endif
ppm_version = ppm_full_version
if ppm_target_arch != ''
ppm_version += '-' + ppm_target_arch
endif
if ppm_binary_name == ''
ppm_binary_name = 'ppm'
endif
cflags += '-DPPM_VERSION="@0@"'.format(ppm_version)
pragtical_datadir = get_option('pragtical_datadir')
if pragtical_datadir == ''
# No path given, assume a default
pragtical_datadir = get_option('datadir') / 'pragtical'
endif
if get_option('static')
python = import('python').find_installation()
ppm_source += configure_file(
capture: false,
command: [
python,
files('tools/embed_lua_source.py'),
'@INPUT0@',
'@OUTPUT0@'
],
input: files('src/ppm.lua'),
output: 'ppm.lua.c'
)
cflags += '-DPPM_STATIC'
endif
if get_option('fully_static')
link_args += '-static'
endif
ppm_exe = executable(ppm_binary_name,
ppm_source,
dependencies: [
zlib_dep,
lzma_dep,
mbedtls_dep,
libgit2_dep,
libzip_dep,
lua_dep,
microtar_dep
],
c_args: cflags,
link_args: link_args,
install: true,
install_dir: get_option('install_plugin') ? pragtical_datadir / 'plugins/plugin_manager' : get_option('bindir'),
)
if (get_option('install_plugin'))
install_subdir('plugins/plugin_manager', install_dir : pragtical_datadir / 'plugins')
install_data('libraries/json.lua', install_dir : pragtical_datadir / 'libraries')
endif