From: Lzu Tao Date: Tue, 4 Dec 2018 18:12:11 +0000 (+0700) Subject: meson: Correct support for building on Windows X-Git-Tag: v1.3.8~27^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa2fc274fd579ad67a58eb12bc2033acfb087f55;p=thirdparty%2Fzstd.git meson: Correct support for building on Windows Let soversion base on version if not set. For example, if version is 3.6.0 and soversion is not defined, it is set to 3. --- diff --git a/build/meson/lib/meson.build b/build/meson/lib/meson.build index bce6b7c56..8854d4370 100644 --- a/build/meson/lib/meson.build +++ b/build/meson/lib/meson.build @@ -111,8 +111,7 @@ libzstd = library('zstd', c_args: libzstd_c_args, dependencies: libzstd_deps, install: true, - version: zstd_libversion, - soversion: '1') + version: zstd_libversion) libzstd_dep = declare_dependency(link_with: libzstd, include_directories: libzstd_includes) diff --git a/build/meson/meson.build b/build/meson/meson.build index 2e1f9d06b..99173f50c 100644 --- a/build/meson/meson.build +++ b/build/meson/meson.build @@ -36,30 +36,30 @@ compiler_clang = 'clang' compiler_msvc = 'msvc' zstd_version = meson.project_version() -zstd_libversion = '' -# ============================================================================= -# Project directories -# ============================================================================= +zstd_h_file = join_paths(meson.current_source_dir(), '../../lib/zstd.h') +GetZstdLibraryVersion_py = files('GetZstdLibraryVersion.py') +r = run_command(python3, GetZstdLibraryVersion_py, zstd_h_file) +if r.returncode() == 0 + output = r.stdout().strip() + if output.version_compare('>@0@'.format(zstd_version)) + zstd_version = output + message('Project version is now: @0@'.format(zstd_version)) + endif +else + message('Cannot find project version in @0@'.format(zstd_h_file)) +endif -zstd_rootdir = '../..' +zstd_libversion = zstd_version # ============================================================================= # Installation directories # ============================================================================= -if host_machine_os == os_windows - zstd_prefix = '.' - zstd_bindir = 'bin' - zstd_datadir = 'share' - zstd_mandir = join_paths(zstd_datadir, 'man') -else - zstd_prefix = get_option('prefix') - zstd_bindir = join_paths(zstd_prefix, get_option('bindir')) - zstd_datadir = join_paths(zstd_prefix, get_option('datadir')) - zstd_mandir = join_paths(zstd_prefix, get_option('mandir')) -endif - +zstd_prefix = get_option('prefix') +zstd_bindir = get_option('bindir') +zstd_datadir = get_option('datadir') +zstd_mandir = get_option('mandir') zstd_docdir = join_paths(zstd_datadir, 'doc', meson.project_name()) # ============================================================================= @@ -85,30 +85,6 @@ feature_zlib = get_option('zlib') feature_lzma = get_option('lzma') feature_lz4 = get_option('lz4') -# ============================================================================= -# Helper scripts for Meson -# ============================================================================= - -GetZstdLibraryVersion_py = files('GetZstdLibraryVersion.py') - -# ============================================================================= -# Getting project version from zstd.h -# ============================================================================= - -zstd_h_file = join_paths(meson.current_source_dir(), zstd_rootdir, 'lib/zstd.h') -r = run_command(python3, GetZstdLibraryVersion_py, zstd_h_file) -if r.returncode() == 0 - output = r.stdout().strip() - if output.version_compare('>@0@'.format(zstd_version)) - zstd_version = output - message('Project version is now: @0@'.format(zstd_version)) - endif -endif - -if host_machine_os != os_windows - zstd_libversion = zstd_version -endif - # ============================================================================= # Dependencies # ============================================================================= diff --git a/build/meson/programs/meson.build b/build/meson/programs/meson.build index 333ad8e8b..5ede8c664 100644 --- a/build/meson/programs/meson.build +++ b/build/meson/programs/meson.build @@ -88,14 +88,15 @@ install_man(join_paths(zstd_rootdir, 'programs/zstd.1'), InstallSymlink_py = '../InstallSymlink.py' zstd_man1_dir = join_paths(zstd_mandir, 'man1') -man1_EXT = host_machine_os != os_windows ? '.1.gz' : '.1' +bin_EXT = host_machine_os == os_windows ? '.exe' : '' +man1_EXT = '.1.gz' # Meson automatically compresses manpages foreach f : ['zstdcat', 'unzstd'] - meson.add_install_script(InstallSymlink_py, 'zstd', f, zstd_bindir) + meson.add_install_script(InstallSymlink_py, 'zstd' + bin_EXT, f + bin_EXT, zstd_bindir) meson.add_install_script(InstallSymlink_py, 'zstd' + man1_EXT, f + man1_EXT, zstd_man1_dir) endforeach if use_multi_thread - meson.add_install_script(InstallSymlink_py, 'zstd', 'zstdmt', zstd_bindir) + meson.add_install_script(InstallSymlink_py, 'zstd' + bin_EXT, 'zstdmt' + bin_EXT, zstd_bindir) meson.add_install_script(InstallSymlink_py, 'zstd' + man1_EXT, 'zstdmt' + man1_EXT, zstd_man1_dir) endif