]> git.proxmox.com Git - ceph.git/blob - ceph/src/zstd/build/meson/programs/meson.build
import 15.2.0 Octopus source
[ceph.git] / ceph / src / zstd / build / meson / programs / meson.build
1 # #############################################################################
2 # Copyright (c) 2018-present Dima Krasner <dima@dimakrasner.com>
3 # lzutao <taolzu(at)gmail.com>
4 # All rights reserved.
5 #
6 # This source code is licensed under both the BSD-style license (found in the
7 # LICENSE file in the root directory of this source tree) and the GPLv2 (found
8 # in the COPYING file in the root directory of this source tree).
9 # #############################################################################
10
11 zstd_rootdir = '../../..'
12
13 zstd_programs_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'),
14 join_paths(zstd_rootdir, 'programs/util.c'),
15 join_paths(zstd_rootdir, 'programs/timefn.c'),
16 join_paths(zstd_rootdir, 'programs/fileio.c'),
17 join_paths(zstd_rootdir, 'programs/benchfn.c'),
18 join_paths(zstd_rootdir, 'programs/benchzstd.c'),
19 join_paths(zstd_rootdir, 'programs/datagen.c'),
20 join_paths(zstd_rootdir, 'programs/dibio.c')]
21
22 zstd_c_args = libzstd_debug_cflags
23 if use_multi_thread
24 zstd_c_args += [ '-DZSTD_MULTITHREAD' ]
25 endif
26
27 zstd_deps = [ libzstd_dep ]
28 if use_zlib
29 zstd_deps += [ zlib_dep ]
30 zstd_c_args += [ '-DZSTD_GZCOMPRESS', '-DZSTD_GZDECOMPRESS' ]
31 endif
32
33 if use_lzma
34 zstd_deps += [ lzma_dep ]
35 zstd_c_args += [ '-DZSTD_LZMACOMPRESS', '-DZSTD_LZMADECOMPRESS' ]
36 endif
37
38 if use_lz4
39 zstd_deps += [ lz4_dep ]
40 zstd_c_args += [ '-DZSTD_LZ4COMPRESS', '-DZSTD_LZ4DECOMPRESS' ]
41 endif
42
43 export_dynamic_on_windows = false
44 # explicit backtrace enable/disable for Linux & Darwin
45 if not use_backtrace
46 zstd_c_args += '-DBACKTRACE_ENABLE=0'
47 elif use_debug and host_machine_os == os_windows # MinGW target
48 zstd_c_args += '-DBACKTRACE_ENABLE=1'
49 export_dynamic_on_windows = true
50 endif
51
52 if cc_id == compiler_msvc
53 if default_library_type != 'static'
54 zstd_programs_sources += [windows_mod.compile_resources(
55 join_paths(zstd_rootdir, 'build/VS2010/zstd/zstd.rc'))]
56 endif
57 endif
58
59 zstd = executable('zstd',
60 zstd_programs_sources,
61 c_args: zstd_c_args,
62 dependencies: zstd_deps,
63 export_dynamic: export_dynamic_on_windows, # Since Meson 0.45.0
64 install: true)
65
66 zstd_frugal_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'),
67 join_paths(zstd_rootdir, 'programs/timefn.c'),
68 join_paths(zstd_rootdir, 'programs/util.c'),
69 join_paths(zstd_rootdir, 'programs/fileio.c')]
70
71 # Minimal target, with only zstd compression and decompression.
72 # No bench. No legacy.
73 executable('zstd-frugal',
74 zstd_frugal_sources,
75 dependencies: libzstd_dep,
76 c_args: [ '-DZSTD_NOBENCH', '-DZSTD_NODICT' ],
77 install: true)
78
79 install_data(join_paths(zstd_rootdir, 'programs/zstdgrep'),
80 join_paths(zstd_rootdir, 'programs/zstdless'),
81 install_dir: zstd_bindir)
82
83 # =============================================================================
84 # Programs and manpages installing
85 # =============================================================================
86
87 install_man(join_paths(zstd_rootdir, 'programs/zstd.1'),
88 join_paths(zstd_rootdir, 'programs/zstdgrep.1'),
89 join_paths(zstd_rootdir, 'programs/zstdless.1'))
90
91 InstallSymlink_py = '../InstallSymlink.py'
92 zstd_man1_dir = join_paths(zstd_mandir, 'man1')
93 bin_EXT = host_machine_os == os_windows ? '.exe' : ''
94 man1_EXT = meson.version().version_compare('>=0.49.0') ? '.1' : '.1.gz'
95
96 foreach f : ['zstdcat', 'unzstd']
97 meson.add_install_script(InstallSymlink_py, 'zstd' + bin_EXT, f + bin_EXT, zstd_bindir)
98 meson.add_install_script(InstallSymlink_py, 'zstd' + man1_EXT, f + man1_EXT, zstd_man1_dir)
99 endforeach
100
101 if use_multi_thread
102 meson.add_install_script(InstallSymlink_py, 'zstd' + bin_EXT, 'zstdmt' + bin_EXT, zstd_bindir)
103 meson.add_install_script(InstallSymlink_py, 'zstd' + man1_EXT, 'zstdmt' + man1_EXT, zstd_man1_dir)
104 endif