Switch over to using meson for building the two NSS modules

Signed-off-by: Daniel P. Berrangé <berra...@redhat.com>
---
 meson.build           |   5 ++
 tools/Makefile.am     | 112 +-----------------------------------------
 tools/meson.build     |   2 +
 tools/nss/meson.build |  63 ++++++++++++++++++++++++
 4 files changed, 72 insertions(+), 110 deletions(-)
 create mode 100644 tools/meson.build
 create mode 100644 tools/nss/meson.build

diff --git a/meson.build b/meson.build
index 1b9efde467..53ee9e331f 100644
--- a/meson.build
+++ b/meson.build
@@ -21,6 +21,7 @@ pkg_doc_dir = data_dir / 'doc' / meson.project_name() + '-' + 
meson.project_vers
 
 public_inc_dir = include_directories('include')
 gnulib_inc_dir = include_directories('gnulib/lib')
+top_inc_dir = include_directories('.')
 
 cc = meson.get_compiler('c')
 
@@ -32,5 +33,9 @@ gnulib_dep = declare_dependency(
 
 meson.add_dist_script('build-aux' / 'dist.py', meson.source_root(), 
meson.build_root())
 
+yajl_min_version = '>= 2.0.3'
+yajl_dep = dependency('yajl', version: yajl_min_version)
+
 subdir('src')
 subdir('examples')
+subdir('tools')
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 29fdbfe846..a294224a99 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -354,10 +354,10 @@ POD2MAN = pod2man -c "Virtualization Support" -r 
"$(PACKAGE)-$(VERSION)"
                < $< > $@-t && \
        mv $@-t $@
 
-install-data-local: install-systemd install-nss \
+install-data-local: install-systemd \
        install-bash-completion
 
-uninstall-local: uninstall-systemd uninstall-nss \
+uninstall-local: uninstall-systemd \
        uninstall-bash-completion
 
 install-sysconfig:
@@ -470,114 +470,6 @@ wireshark/src/libvirt/protocol.h: 
wireshark/util/genxdrstub.pl \
 
 endif WITH_WIRESHARK_DISSECTOR
 
-if WITH_BSD_NSS
-LIBVIRT_NSS_SYMBOL_FILE = \
-       $(srcdir)/nss/libvirt_nss_bsd.syms
-LIBVIRT_GUEST_NSS_SYMBOL_FILE = \
-       $(LIBVIRT_NSS_SYMBOL_FILE)
-NSS_SO_VER = 1
-
-install-nss:
-       ( cd $(DESTDIR)$(libdir) && \
-         rm -f nss_libvirt.so.$(NSS_SO_VER) && \
-         $(LN_S) libnss_libvirt.so.$(NSS_SO_VER) nss_libvirt.so.$(NSS_SO_VER) 
&& \
-         rm -f nss_libvirt_guest.so.$(NSS_SO_VER) && \
-         $(LN_S) libnss_libvirt_guest.so.$(NSS_SO_VER) \
-         nss_libvirt_guest.so.$(NSS_SO_VER))
-
-uninstall-nss:
-       -rm -f $(DESTDIR)$(libdir)/nss_libvirt.so.$(NSS_SO_VER)
-       -rm -f $(DESTDIR)$(libdir)/nss_libvirt_guest.so.$(NSS_SO_VER)
-else ! WITH_BSD_NSS
-LIBVIRT_NSS_SYMBOL_FILE = \
-       $(srcdir)/nss/libvirt_nss.syms
-LIBVIRT_GUEST_NSS_SYMBOL_FILE = \
-       $(srcdir)/nss/libvirt_guest_nss.syms
-NSS_SO_VER = 2
-
-install-nss:
-uninstall-nss:
-endif ! WITH_BSD_NSS
-
-LIBVIRT_NSS_SOURCES = \
-       nss/libvirt_nss.c \
-       nss/libvirt_nss.h \
-       nss/libvirt_nss_leases.c \
-       nss/libvirt_nss_leases.h \
-       $(NULL)
-
-if WITH_NSS
-noinst_LTLIBRARIES += nss/libnss_libvirt_impl.la
-nss_libnss_libvirt_impl_la_SOURCES = \
-       $(LIBVIRT_NSS_SOURCES)
-
-nss_libnss_libvirt_impl_la_CPPFLAGS = $(STANDALONE_CPPFLAGS)
-nss_libnss_libvirt_impl_la_CFLAGS = \
-       -DLIBVIRT_NSS \
-       $(YAJL_CFLAGS) \
-       $(AM_CFLAGS) \
-       $(NULL)
-
-nss_libnss_libvirt_impl_la_LIBADD = \
-       $(YAJL_LIBS) \
-       $(NULL)
-
-nss_libnss_libvirt_la_SOURCES =
-nss_libnss_libvirt_la_LDFLAGS = \
-       $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_NSS_SYMBOL_FILE) \
-       $(AM_LDFLAGS) \
-       -module \
-       -export-dynamic \
-       -avoid-version \
-       -shared \
-       -shrext .so.$(NSS_SO_VER)
-
-nss_libnss_libvirt_la_LIBADD = \
-       nss/libnss_libvirt_impl.la
-
-noinst_LTLIBRARIES += nss/libnss_libvirt_guest_impl.la
-nss_libnss_libvirt_guest_impl_la_SOURCES = \
-       $(LIBVIRT_NSS_SOURCES) \
-       nss/libvirt_nss_macs.h \
-       nss/libvirt_nss_macs.c \
-       $(NULL)
-
-nss_libnss_libvirt_guest_impl_la_CPPFLAGS = $(STANDALONE_CPPFLAGS)
-nss_libnss_libvirt_guest_impl_la_CFLAGS = \
-       -DLIBVIRT_NSS \
-       -DLIBVIRT_NSS_GUEST \
-       $(YAJL_CFLAGS) \
-       $(AM_CFLAGS) \
-       $(NULL)
-
-nss_libnss_libvirt_guest_impl_la_LIBADD = \
-       $(YAJL_LIBS) \
-       $(NULL)
-
-nss_libnss_libvirt_guest_la_SOURCES =
-nss_libnss_libvirt_guest_la_LDFLAGS = \
-       $(VERSION_SCRIPT_FLAGS)$(LIBVIRT_GUEST_NSS_SYMBOL_FILE) \
-       $(AM_LDFLAGS) \
-       -module \
-       -export-dynamic \
-       -avoid-version \
-       -shared \
-       -shrext .so.$(NSS_SO_VER)
-
-nss_libnss_libvirt_guest_la_LIBADD = \
-       nss/libnss_libvirt_guest_impl.la
-
-lib_LTLIBRARIES = \
-       nss/libnss_libvirt.la \
-       nss/libnss_libvirt_guest.la
-
-endif WITH_NSS
-
-EXTRA_DIST += $(LIBVIRT_NSS_SOURCES) \
-       $(srcdir)/nss/libvirt_nss.syms \
-       $(srcdir)/nss/libvirt_nss_bsd.syms \
-       $(srcdir)/nss/libvirt_guest_nss.syms
-
 clean-local:
        -rm -rf wireshark/src/libvirt
 
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 0000000000..dd2da4adc7
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,2 @@
+
+subdir('nss')
diff --git a/tools/nss/meson.build b/tools/nss/meson.build
new file mode 100644
index 0000000000..c21cfdfa9d
--- /dev/null
+++ b/tools/nss/meson.build
@@ -0,0 +1,63 @@
+
+if host_machine.system() == 'freebsd'
+  with_nss = true
+  libnss_prefix = ''
+  libnss_so_version = '1'
+  libnss_syms = 'libvirt_nss_bsd.syms'
+  libnss_guest_syms = 'libvirt_nss_bsd.syms'
+elif host_machine.system() == 'linux'
+  with_nss = true
+  libnss_prefix = 'lib'
+  libnss_so_version = '2'
+  libnss_syms = 'libvirt_nss.syms'
+  libnss_guest_syms = 'libvirt_guest_nss.syms'
+else
+  with_nss = false
+endif
+
+if with_nss
+  libnss_common_src = [
+    'libvirt_nss.c',
+    'libvirt_nss.h',
+    'libvirt_nss_leases.c',
+    'libvirt_nss_leases.h'
+  ]
+
+  libnss_src = libnss_common_src
+  libnss_guest_src = libnss_common_src + [
+    'libvirt_nss_macs.c',
+    'libvirt_nss_macs.h',
+  ]
+
+  libnss_deps = [yajl_dep]
+  libnss_link_args = [
+    '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), 
libnss_syms)
+  ]
+  libnss_guest_link_args = [
+    '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), 
libnss_guest_syms)
+  ]
+  libnss_inc_dirs = [top_inc_dir]
+
+  libnss_libvirt_so = shared_library('nss_libvirt',
+                                    libnss_src,
+                                    name_prefix: libnss_prefix,
+                                    version: libnss_so_version,
+                                    c_args: ['-DLIBVIRT_NSS'],
+                                    link_args: libnss_link_args,
+                                    dependencies: libnss_deps,
+                                    include_directories: libnss_inc_dirs,
+                                    link_depends: libnss_syms)
+
+  libnss_libvirt_guest_so = shared_library('nss_libvirt_guest',
+                                          libnss_guest_src,
+                                          name_prefix: libnss_prefix,
+                                          version: libnss_so_version,
+                                          c_args: ['-DLIBVIRT_NSS',
+                                                   '-DLIBVIRT_NSS_GUEST'],
+                                          link_args: libnss_guest_link_args,
+                                          dependencies: libnss_deps,
+                                          include_directories: libnss_inc_dirs,
+                                          link_depends: libnss_guest_syms)
+
+
+endif
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to