diff options
Diffstat (limited to 'contrib/meson/meson/programs/meson.build')
-rw-r--r-- | contrib/meson/meson/programs/meson.build | 78 |
1 files changed, 35 insertions, 43 deletions
diff --git a/contrib/meson/meson/programs/meson.build b/contrib/meson/meson/programs/meson.build index 705dbf54..f9d5bf1c 100644 --- a/contrib/meson/meson/programs/meson.build +++ b/contrib/meson/meson/programs/meson.build @@ -1,5 +1,6 @@ # ############################################################################# -# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com> +# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com> +# Copyright (c) 2022-present Tristan Partin <tristan(at)partin.io> # All rights reserved. # # This source code is licensed under both the BSD-style license (found in the @@ -7,46 +8,37 @@ # 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 +lz4_source_root = '../../../..' + +sources = files( + lz4_source_root / 'programs/bench.c', + lz4_source_root / 'programs/datagen.c', + lz4_source_root / 'programs/lz4cli.c', + lz4_source_root / 'programs/lz4io.c', +) + +lz4 = executable( + 'lz4', + sources, + include_directories: include_directories(lz4_source_root / 'programs'), + dependencies: [liblz4_internal_dep], + export_dynamic: get_option('debug') and host_machine.system() == 'windows', + install: true +) + +install_man(lz4_source_root / 'programs/lz4.1') + +if meson.version().version_compare('>=0.61.0') + foreach alias : ['lz4c', 'lz4cat', 'unlz4'] + install_symlink( + alias, + install_dir: get_option('bindir'), + pointing_to: 'lz4' + ) + install_symlink( + '@0@.1'.format(alias), + install_dir: get_option('mandir') / 'man1', + pointing_to: 'lz4.1' + ) + endforeach 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 |