summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorLzu Tao <taolzu@gmail.com>2018-12-03 15:48:25 (GMT)
committerLzu Tao <taolzu@gmail.com>2018-12-03 15:48:37 (GMT)
commit0caeec939fafd12dd8278f80928c86f496ffc3aa (patch)
tree1ec6fd3ebf0ff46988fbf715f20943d14965ba5f /contrib
parent7b6ccfe52c2c21cf7d969e5b4148645b253e2854 (diff)
downloadlz4-0caeec939fafd12dd8278f80928c86f496ffc3aa.zip
lz4-0caeec939fafd12dd8278f80928c86f496ffc3aa.tar.gz
lz4-0caeec939fafd12dd8278f80928c86f496ffc3aa.tar.bz2
meson: Correct support for Windows build
Diffstat (limited to 'contrib')
-rw-r--r--contrib/meson/lib/meson.build2
-rw-r--r--contrib/meson/meson.build57
-rw-r--r--contrib/meson/programs/meson.build5
3 files changed, 23 insertions, 41 deletions
diff --git a/contrib/meson/lib/meson.build b/contrib/meson/lib/meson.build
index 7a1b5d5..f4b873e 100644
--- a/contrib/meson/lib/meson.build
+++ b/contrib/meson/lib/meson.build
@@ -33,7 +33,7 @@ liblz4 = library('lz4',
c_args: liblz4_c_args,
install: true,
version: lz4_libversion,
- soversion: '1')
+ soversion: lz4_libsoversion)
liblz4_dep = declare_dependency(link_with: liblz4,
include_directories: liblz4_includes)
diff --git a/contrib/meson/meson.build b/contrib/meson/meson.build
index 3c39034..0047444 100644
--- a/contrib/meson/meson.build
+++ b/contrib/meson/meson.build
@@ -17,6 +17,7 @@ project('lz4', ['c'],
cc = meson.get_compiler('c')
pkgconfig = import('pkgconfig')
python3 = import('python').find_installation()
+c_std = get_option('c_std')
host_machine_os = host_machine.system()
os_windows = 'windows'
@@ -31,26 +32,30 @@ compiler_clang = 'clang'
compiler_msvc = 'msvc'
lz4_version = meson.project_version()
-lz4_libversion = ''
-c_std = get_option('c_std')
+lz4_h_file = join_paths(meson.current_source_dir(), 'lib/lz4.h')
+GetLz4LibraryVersion_py = files('GetLz4LibraryVersion.py')
+r = run_command(python3, GetLz4LibraryVersion_py, lz4_h_file)
+if r.returncode() == 0
+ output = r.stdout().strip()
+ if output.version_compare('>@0@'.format(lz4_version))
+ lz4_version = output
+ message('Project version is now: @0@'.format(lz4_version))
+ endif
+endif
+
+lz4_version_array = lz4_version.split('.')
+lz4_libversion = lz4_version
+lz4_libsoversion = lz4_version_array[0]
# =============================================================================
# Installation directories
# =============================================================================
-if host_machine_os == os_windows
- lz4_prefix = '.'
- lz4_bindir = 'bin'
- lz4_datadir = 'share'
- lz4_mandir = join_paths(lz4_datadir, 'man')
-else
- lz4_prefix = get_option('prefix')
- lz4_bindir = join_paths(lz4_prefix, get_option('bindir'))
- lz4_datadir = join_paths(lz4_prefix, get_option('datadir'))
- lz4_mandir = join_paths(lz4_prefix, get_option('mandir'))
-endif
-
+lz4_prefix = get_option('prefix')
+lz4_bindir = join_paths(lz4_prefix, get_option('bindir'))
+lz4_datadir = join_paths(lz4_prefix, get_option('datadir'))
+lz4_mandir = join_paths(lz4_prefix, get_option('mandir'))
lz4_docdir = join_paths(lz4_datadir, 'doc', meson.project_name())
# =============================================================================
@@ -73,30 +78,6 @@ build_examples = get_option('build_examples')
#feature_multi_thread = get_option('multi_thread')
# =============================================================================
-# Helper scripts for Meson
-# =============================================================================
-
-GetLz4LibraryVersion_py = files('GetLz4LibraryVersion.py')
-
-# =============================================================================
-# Getting project version from lz4.h
-# =============================================================================
-
-lz4_h_file = join_paths(meson.current_source_dir(), 'lib/lz4.h')
-r = run_command(python3, GetLz4LibraryVersion_py, lz4_h_file)
-if r.returncode() == 0
- output = r.stdout().strip()
- if output.version_compare('>@0@'.format(lz4_version))
- lz4_version = output
- message('Project version is now: @0@'.format(lz4_version))
- endif
-endif
-
-if host_machine_os != os_windows
- lz4_libversion = lz4_version
-endif
-
-# =============================================================================
# Dependencies
# =============================================================================
diff --git a/contrib/meson/programs/meson.build b/contrib/meson/programs/meson.build
index b5c3228..2d39b59 100644
--- a/contrib/meson/programs/meson.build
+++ b/contrib/meson/programs/meson.build
@@ -43,9 +43,10 @@ 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'
+bin_EXT = host_machine_os == os_windows ? '.exe' : ''
+man1_EXT = '.1.gz' # Meson automatically compresses manpages
foreach f : ['lz4c', 'lz4cat', 'unlz4']
- meson.add_install_script(InstallSymlink_py, 'lz4', f, lz4_bindir)
+ 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