summaryrefslogtreecommitdiffstats
path: root/contrib/meson/meson/programs/meson.build
diff options
context:
space:
mode:
authorJulius Michaelis <gitter@liftm.de>2019-09-26 08:23:53 (GMT)
committerJulius Michaelis <gitter@liftm.de>2019-09-26 08:29:04 (GMT)
commitb6623e710d6bea36634d82547b0d89021b0d6549 (patch)
tree7318aaa0f75467501645d2ef754a9334d59bf0e1 /contrib/meson/meson/programs/meson.build
parente9d8e15263df4a0529dcd22ca48c82869d19abb9 (diff)
downloadlz4-b6623e710d6bea36634d82547b0d89021b0d6549.zip
lz4-b6623e710d6bea36634d82547b0d89021b0d6549.tar.gz
lz4-b6623e710d6bea36634d82547b0d89021b0d6549.tar.bz2
meson: move one layer deeper to allow easy construction of a wrap file
Diffstat (limited to 'contrib/meson/meson/programs/meson.build')
-rw-r--r--contrib/meson/meson/programs/meson.build52
1 files changed, 52 insertions, 0 deletions
diff --git a/contrib/meson/meson/programs/meson.build b/contrib/meson/meson/programs/meson.build
new file mode 100644
index 0000000..705dbf5
--- /dev/null
+++ b/contrib/meson/meson/programs/meson.build
@@ -0,0 +1,52 @@
+# #############################################################################
+# 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')
+bin_EXT = host_machine_os == os_windows ? '.exe' : ''
+man1_EXT = meson.version().version_compare('>=0.49.0') ? '.1' : '.1.gz'
+
+foreach f : ['lz4c', 'lz4cat', 'unlz4']
+ meson.add_install_script(InstallSymlink_py, 'lz4' + bin_EXT, f + bin_EXT, lz4_bindir)
+ meson.add_install_script(InstallSymlink_py, 'lz4' + man1_EXT, f + man1_EXT, lz4_man1_dir)
+endforeach