summaryrefslogtreecommitdiffstats
path: root/contrib/meson/programs
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/meson/programs')
-rw-r--r--contrib/meson/programs/meson.build51
1 files changed, 51 insertions, 0 deletions
diff --git a/contrib/meson/programs/meson.build b/contrib/meson/programs/meson.build
new file mode 100644
index 0000000..b5c3228
--- /dev/null
+++ b/contrib/meson/programs/meson.build
@@ -0,0 +1,51 @@
+# #############################################################################
+# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com>
+# All rights reserved.
+#
+# This source code is licensed under both the BSD-style license (found in the
+# LICENSE file in the root directory of this source tree) and the GPLv2 (found
+# in the COPYING file in the root directory of this source tree).
+# #############################################################################
+
+lz4_root_dir = '../../..'
+
+lz4_includes = include_directories(join_paths(lz4_root_dir, 'programs'))
+lz4_sources = [join_paths(lz4_root_dir, 'programs/bench.c'),
+ join_paths(lz4_root_dir, 'programs/datagen.c'),
+ join_paths(lz4_root_dir, 'programs/lz4cli.c'),
+ join_paths(lz4_root_dir, 'programs/lz4io.c')]
+lz4_c_args = []
+
+export_dynamic_on_windows = false
+# explicit backtrace enable/disable for Linux & Darwin
+if not use_backtrace
+ lz4_c_args += '-DBACKTRACE_ENABLE=0'
+elif use_debug and host_machine_os == os_windows # MinGW target
+ lz4_c_args += '-DBACKTRACE_ENABLE=1'
+ export_dynamic_on_windows = true
+endif
+
+lz4_deps = [ liblz4_dep ]
+
+lz4 = executable('lz4',
+ lz4_sources,
+ include_directories: lz4_includes,
+ c_args: lz4_c_args,
+ dependencies: lz4_deps,
+ export_dynamic: export_dynamic_on_windows, # Since Meson 0.45.0
+ install: true)
+
+# =============================================================================
+# Programs and manpages installing
+# =============================================================================
+
+install_man(join_paths(lz4_root_dir, 'programs/lz4.1'))
+
+InstallSymlink_py = '../InstallSymlink.py'
+lz4_man1_dir = join_paths(lz4_mandir, 'man1')
+man1_EXT = host_machine_os != os_windows ? '.1.gz' : '.1'
+
+foreach f : ['lz4c', 'lz4cat', 'unlz4']
+ meson.add_install_script(InstallSymlink_py, 'lz4', f, lz4_bindir)
+ meson.add_install_script(InstallSymlink_py, 'lz4' + man1_EXT, f + man1_EXT, lz4_man1_dir)
+endforeach