diff options
author | Yann Collet <Cyan4973@users.noreply.github.com> | 2018-12-17 17:32:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-17 17:32:01 (GMT) |
commit | 6e24ef902a4f6de5fd9419c6364a4e8b473445b9 (patch) | |
tree | a1852a087c6fc5418361dd294b4e254c4152f171 | |
parent | e5a1911ec298a03242b2c8f954f3b511d5a743f6 (diff) | |
parent | 34dcc5e16d281a11dbccdb238cefdee678d075d5 (diff) | |
download | lz4-6e24ef902a4f6de5fd9419c6364a4e8b473445b9.zip lz4-6e24ef902a4f6de5fd9419c6364a4e8b473445b9.tar.gz lz4-6e24ef902a4f6de5fd9419c6364a4e8b473445b9.tar.bz2 |
Merge pull request #620 from lzutao/meson_symlink
Update meson symlink and man1 extension
-rw-r--r-- | contrib/meson/InstallSymlink.py | 26 | ||||
-rw-r--r-- | contrib/meson/programs/meson.build | 2 |
2 files changed, 12 insertions, 16 deletions
diff --git a/contrib/meson/InstallSymlink.py b/contrib/meson/InstallSymlink.py index c1f13f5..3f2998c 100644 --- a/contrib/meson/InstallSymlink.py +++ b/contrib/meson/InstallSymlink.py @@ -1,12 +1,13 @@ #!/usr/bin/env python3 # ############################################################################# -# Copyright (c) 2018-present lzutao <taolzu(at)gmail.com> +# 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). # ############################################################################# +# This file should be synced with https://github.com/lzutao/meson-symlink import os import pathlib # since Python 3.4 @@ -29,30 +30,25 @@ def install_symlink(src, dst, install_dir, dst_is_dir=False, dir_mode=0o777): def main(): import argparse parser = argparse.ArgumentParser(description='Install a symlink', - usage='InstallSymlink.py [-h] [-d] [-m MODE] src dst install_dir\n\n' + usage='{0} [-h] [-d] [-m MODE] source dest install_dir\n\n' 'example:\n' - '\tInstallSymlink.py dash sh /bin') - parser.add_argument('src', help='target to link') - parser.add_argument('dst', help='link name') + ' {0} dash sh /bin'.format(pathlib.Path(__file__).name)) + parser.add_argument('source', help='target to link') + parser.add_argument('dest', help='link name') parser.add_argument('install_dir', help='installation directory') parser.add_argument('-d', '--isdir', action='store_true', - help='dst is a directory') + help='dest is a directory') parser.add_argument('-m', '--mode', help='directory mode on creating if not exist', - default='0o777') + default='0o755') args = parser.parse_args() - src = args.src - dst = args.dst - dst_is_dir = args.isdir dir_mode = int(args.mode, 8) - install_dir = pathlib.Path(args.install_dir) - meson_destdir = os.environ.get('MESON_INSTALL_DESTDIR_PREFIX') - if meson_destdir: - install_dir = pathlib.Path(meson_destdir).joinpath(install_dir) - install_symlink(src, dst, install_dir, dst_is_dir, dir_mode) + meson_destdir = os.environ.get('MESON_INSTALL_DESTDIR_PREFIX', default='') + install_dir = pathlib.Path(meson_destdir, args.install_dir) + install_symlink(args.source, args.dest, install_dir, args.isdir, dir_mode) if __name__ == '__main__': diff --git a/contrib/meson/programs/meson.build b/contrib/meson/programs/meson.build index 2d39b59..df64eb0 100644 --- a/contrib/meson/programs/meson.build +++ b/contrib/meson/programs/meson.build @@ -44,7 +44,7 @@ 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 = '.1.gz' # Meson automatically compresses manpages +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) |