[libvirt PATCH 339/351] meson: generate and distribute spec files and AUTHORS

Pavel Hrdina phrdina at redhat.com
Thu Jul 16 09:59:35 UTC 2020


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 Makefile.am                  | 19 ---------------
 configure.ac                 |  3 +--
 meson.build                  | 45 ++++++++++++++++++++++++++++++++++++
 scripts/meson-dist.sh        |  6 +++++
 scripts/meson-gen-authors.sh |  4 ++++
 scripts/meson.build          |  2 ++
 6 files changed, 58 insertions(+), 21 deletions(-)
 create mode 100755 scripts/meson-dist.sh
 create mode 100755 scripts/meson-gen-authors.sh

diff --git a/Makefile.am b/Makefile.am
index e6a37deb4a5..7490acbcfba 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -31,24 +31,5 @@ rpm: clean
 srpm: clean
 	@(unset CDPATH ; $(MAKE) dist && rpmbuild -ts $(distdir).tar.xz)
 
-dist-hook: gen-AUTHORS
-
-.PHONY: gen-AUTHORS
-gen-AUTHORS:
-	$(AM_V_GEN)\
-	if test -d $(srcdir)/.git; then \
-	  ( \
-	    cd $(srcdir) && \
-	    git log --pretty=format:'%aN <%aE>' | sort -u \
-	  ) > all.list && \
-	  sort -u $(srcdir)/AUTHORS.in > maint.list && \
-	  comm -23 all.list maint.list > contrib.list && \
-	  contrib="`cat contrib.list`" && \
-	  perl -p -e "s/#contributorslist#// and print '$$contrib'" \
-	    < $(srcdir)/AUTHORS.in > $(distdir)/AUTHORS-tmp && \
-	  mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS && \
-	  rm -f all.list maint.list contrib.list; \
-	fi
-
 ci-%:
 	$(MAKE) -C $(srcdir)/ci/ $@
diff --git a/configure.ac b/configure.ac
index b0a6cad178a..b70aa17cb23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -108,6 +108,5 @@ AC_CONFIG_FILES([run],
 AC_CONFIG_FILES([\
         Makefile \
         .color_coded \
-        .ycm_extra_conf.py \
-        libvirt.spec mingw-libvirt.spec])
+        .ycm_extra_conf.py])
 AC_OUTPUT
diff --git a/meson.build b/meson.build
index 7b858797388..9d0a0c1665b 100644
--- a/meson.build
+++ b/meson.build
@@ -2243,6 +2243,51 @@ foreach file : pkgconfig_files
   )
 endforeach
 
+
+# generate dist files
+
+if git
+  spec_files = [
+    'libvirt.spec.in',
+    'mingw-libvirt.spec.in',
+  ]
+
+  spec_conf = configuration_data()
+  spec_conf.set('VERSION', meson.project_version())
+
+  foreach file : spec_files
+    configure_file(
+      input: file,
+      output: '@BASENAME@',
+      configuration: spec_conf,
+    )
+  endforeach
+
+  authors = run_command(meson_gen_authors_prog)
+  authors_file = 'AUTHORS.in'
+
+  authors_conf = configuration_data()
+  authors_conf.set('contributorslist', authors.stdout())
+
+  configure_file(
+    input: authors_file,
+    output: '@BASENAME@',
+    configuration: authors_conf,
+  )
+
+  # Using return values from configure_file in add_dist_script is possible since 0.55.0
+  dist_files = [
+    'libvirt.spec',
+    'mingw-libvirt.spec',
+    'AUTHORS',
+  ]
+
+  foreach file : dist_files
+    meson.add_dist_script(meson_dist_prog.path(), meson.build_root(), file)
+  endforeach
+endif
+
+
 # generate meson-config.h file
 configure_file(output: 'meson-config.h', configuration: conf)
 
diff --git a/scripts/meson-dist.sh b/scripts/meson-dist.sh
new file mode 100755
index 00000000000..fdcc0154e02
--- /dev/null
+++ b/scripts/meson-dist.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+MESON_BUILD_ROOT=$1
+FILE=$2
+
+cp $MESON_BUILD_ROOT/$FILE $MESON_DIST_ROOT/$FILE
diff --git a/scripts/meson-gen-authors.sh b/scripts/meson-gen-authors.sh
new file mode 100755
index 00000000000..bf0a3b63886
--- /dev/null
+++ b/scripts/meson-gen-authors.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd $MESON_SOURCE_ROOT
+git log --pretty=format:'* %aN <%aE>' | sort -u
diff --git a/scripts/meson.build b/scripts/meson.build
index 3bcd6e85ce5..fa2ed57c99d 100644
--- a/scripts/meson.build
+++ b/scripts/meson.build
@@ -23,6 +23,8 @@ scripts = [
   'hyperv_wmi_generator.py',
   'install-dirs.sh',
   'install-symlink.sh',
+  'meson-dist.sh',
+  'meson-gen-authors.sh',
   'meson-html-gen.py',
   'meson-python.sh',
   'meson-timestamp.sh',
-- 
2.26.2




More information about the libvir-list mailing list