aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build66
1 files changed, 41 insertions, 25 deletions
diff --git a/meson.build b/meson.build
index 2d67ae1..cb7fc47 100644
--- a/meson.build
+++ b/meson.build
@@ -1,12 +1,10 @@
project('libslirp', 'c',
- version : run_command('build-aux/git-version-gen', '@0@/.tarball-version'.format(meson.source_root()), check : true).stdout().strip(),
+ version : '4.3.1',
license : 'BSD-3-Clause',
default_options : ['warning_level=1', 'c_std=gnu99'],
- meson_version : '>= 0.49',
+ meson_version : '>= 0.50',
)
-meson.add_dist_script('build-aux/meson-dist', meson.project_version(), meson.source_root())
-
version = meson.project_version()
varr = version.split('.')
major_version = varr[0]
@@ -17,7 +15,17 @@ conf = configuration_data()
conf.set('SLIRP_MAJOR_VERSION', major_version)
conf.set('SLIRP_MINOR_VERSION', minor_version)
conf.set('SLIRP_MICRO_VERSION', micro_version)
-conf.set_quoted('SLIRP_VERSION_STRING', version)
+
+full_version = run_command('build-aux/git-version-gen',
+ '@0@/.tarball-version'.format(meson.current_source_dir()),
+ check : true).stdout().strip()
+if full_version.startswith('UNKNOWN')
+ full_version = meson.project_version()
+elif not full_version.startswith(meson.project_version())
+ error('meson.build project version @0@ does not match git-describe output @1@'
+ .format(meson.project_version(), full_version))
+endif
+conf.set_quoted('SLIRP_VERSION_STRING', full_version + get_option('version_suffix'))
# libtool versioning - this applies to libslirp
#
@@ -105,9 +113,12 @@ if cc.has_link_argument(vflag_test)
vflag += vflag_test
endif
+install_devel = not meson.is_subproject()
+
configure_file(
input : 'src/libslirp-version.h.in',
output : 'libslirp-version.h',
+ install : install_devel,
install_dir : join_paths(get_option('includedir'), 'slirp'),
configuration : conf
)
@@ -118,25 +129,30 @@ lib = library('slirp', sources,
link_args : vflag,
link_depends : mapfile,
dependencies : [glib_dep, platform_deps],
- install : true
+ install : install_devel or get_option('default_library') == 'shared',
)
-libslirp_dep = declare_dependency(
- include_directories: include_directories('.', 'src'),
- link_with: lib)
-
-install_headers(['src/libslirp.h'], subdir : 'slirp')
-
-pkg = import('pkgconfig')
-
-pkg.generate(
- version : version,
- libraries : lib,
- requires : [
- 'glib-2.0',
- ],
- name : 'slirp',
- description : 'User-space network stack',
- filebase : 'slirp',
- subdirs : 'slirp',
-)
+if install_devel
+ install_headers(['src/libslirp.h'], subdir : 'slirp')
+
+ pkg = import('pkgconfig')
+
+ pkg.generate(
+ version : version,
+ libraries : lib,
+ requires : [
+ 'glib-2.0',
+ ],
+ name : 'slirp',
+ description : 'User-space network stack',
+ filebase : 'slirp',
+ subdirs : 'slirp',
+ )
+else
+ if get_option('default_library') == 'both'
+ lib = lib.get_static_lib()
+ endif
+ libslirp_dep = declare_dependency(
+ include_directories: include_directories('.', 'src'),
+ link_with: lib)
+endif