Blame SOURCES/0082-build-Add-meson-build-infrastructure.patch

26ccd9
From 4e5faa1726d22e8ef51e860d56f4300077a3e9ba Mon Sep 17 00:00:00 2001
26ccd9
From: Dan Williams <dan.j.williams@intel.com>
26ccd9
Date: Wed, 5 Jan 2022 13:32:53 -0800
26ccd9
Subject: [PATCH 082/217] build: Add meson build infrastructure
26ccd9
26ccd9
Build times improve from 10s of seconds to sub-second builds especially
26ccd9
when ccache gets involved and the only change is a git version bump. Recall
26ccd9
that every time the version changes with autotools it does a reconfigure.
26ccd9
With meson only the objects that depend on the version string are rebuilt.
26ccd9
So the primary motivation is to make the ndctl project more enjoyable to
26ccd9
develop.
26ccd9
26ccd9
Tools, libraries, documentation, and tests all seem to be working. The
26ccd9
remaining work is to redo the rpm build infrastructure, and validate that
26ccd9
installation is working as expected.
26ccd9
26ccd9
Given the long standing momentum on the old build system it is still kept
26ccd9
functional for now. The only compatibility hack when moving from an
26ccd9
autotools build to a meson build is to delete the config.h files generated
26ccd9
by the old system in favor of the unified configuration header build from
26ccd9
the config.h.meson template.
26ccd9
26ccd9
Link: https://lore.kernel.org/r/164141837329.3990253.11664056350173402543.stgit@dwillia2-desk3.amr.corp.intel.com
26ccd9
Tested-by: Vaibhav Jain <vaibhav@linux.ibm.com>
26ccd9
Tested-by: Alison Schofield <alison.schofield@intel.com>
26ccd9
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
26ccd9
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
26ccd9
---
26ccd9
 .gitignore                        |   5 +-
26ccd9
 Documentation/cxl/lib/meson.build |  79 +++++++++
26ccd9
 Documentation/cxl/meson.build     |  84 +++++++++
26ccd9
 Documentation/daxctl/meson.build  |  94 ++++++++++
26ccd9
 Documentation/ndctl/meson.build   | 124 +++++++++++++
26ccd9
 clean_config.sh                   |   2 +
26ccd9
 config.h.meson                    | 151 ++++++++++++++++
26ccd9
 contrib/meson.build               |  28 +++
26ccd9
 cxl/lib/meson.build               |  35 ++++
26ccd9
 cxl/meson.build                   |  25 +++
26ccd9
 daxctl/device.c                   |   1 +
26ccd9
 daxctl/lib/meson.build            |  44 +++++
26ccd9
 daxctl/meson.build                |  35 ++++
26ccd9
 meson.build                       | 280 ++++++++++++++++++++++++++++++
26ccd9
 meson_options.txt                 |  25 +++
26ccd9
 ndctl/lib/meson.build             |  48 +++++
26ccd9
 ndctl/meson.build                 |  82 +++++++++
26ccd9
 test/meson.build                  | 237 +++++++++++++++++++++++++
26ccd9
 tools/meson-vcs-tag.sh            |  18 ++
26ccd9
 util/meson.build                  |  16 ++
26ccd9
 version.h.in                      |   2 +
26ccd9
 21 files changed, 1414 insertions(+), 1 deletion(-)
26ccd9
 create mode 100644 Documentation/cxl/lib/meson.build
26ccd9
 create mode 100644 Documentation/cxl/meson.build
26ccd9
 create mode 100644 Documentation/daxctl/meson.build
26ccd9
 create mode 100644 Documentation/ndctl/meson.build
26ccd9
 create mode 100755 clean_config.sh
26ccd9
 create mode 100644 config.h.meson
26ccd9
 create mode 100644 contrib/meson.build
26ccd9
 create mode 100644 cxl/lib/meson.build
26ccd9
 create mode 100644 cxl/meson.build
26ccd9
 create mode 100644 daxctl/lib/meson.build
26ccd9
 create mode 100644 daxctl/meson.build
26ccd9
 create mode 100644 meson.build
26ccd9
 create mode 100644 meson_options.txt
26ccd9
 create mode 100644 ndctl/lib/meson.build
26ccd9
 create mode 100644 ndctl/meson.build
26ccd9
 create mode 100644 test/meson.build
26ccd9
 create mode 100755 tools/meson-vcs-tag.sh
26ccd9
 create mode 100644 util/meson.build
26ccd9
 create mode 100644 version.h.in
26ccd9
26ccd9
diff -up ndctl-71.1/.gitignore.orig ndctl-71.1/.gitignore
26ccd9
--- ndctl-71.1/.gitignore.orig	2022-10-07 17:29:42.924688214 -0400
26ccd9
+++ ndctl-71.1/.gitignore	2022-10-07 17:29:51.566717638 -0400
26ccd9
@@ -9,7 +9,9 @@ Makefile.in
26ccd9
 /aclocal.m4
26ccd9
 /autom4te.cache
26ccd9
 /build-aux
26ccd9
-/config.*
26ccd9
+/config.h
26ccd9
+/config.log
26ccd9
+/config.status
26ccd9
 /configure
26ccd9
 /libtool
26ccd9
 /stamp-h1
26ccd9
@@ -24,6 +26,7 @@ Documentation/ndctl/asciidoctor-extensio
26ccd9
 Documentation/cxl/asciidoctor-extensions.rb
26ccd9
 Documentation/cxl/lib/asciidoctor-extensions.rb
26ccd9
 .dirstamp
26ccd9
+build/
26ccd9
 daxctl/config.h
26ccd9
 daxctl/daxctl
26ccd9
 daxctl/lib/libdaxctl.la
26ccd9
diff -up ndctl-71.1/Documentation/cxl/lib/meson.build.orig ndctl-71.1/Documentation/cxl/lib/meson.build
26ccd9
--- ndctl-71.1/Documentation/cxl/lib/meson.build.orig	2022-10-07 17:29:51.567717641 -0400
26ccd9
+++ ndctl-71.1/Documentation/cxl/lib/meson.build	2022-10-07 17:29:51.567717641 -0400
26ccd9
@@ -0,0 +1,79 @@
26ccd9
+if get_option('asciidoctor').enabled()
26ccd9
+  asciidoc_conf = custom_target('asciidoctor-extensions.rb',
26ccd9
+    command : [
26ccd9
+      'sed', '-e', 's,@Utility@,Libcxl,g', '-e', 's,@utility@,cxl,g', '@INPUT@'
26ccd9
+    ],
26ccd9
+    input : '../../asciidoctor-extensions.rb.in',
26ccd9
+    output : 'asciidoctor-extensions.rb',
26ccd9
+    capture : true,
26ccd9
+  )
26ccd9
+else
26ccd9
+  asciidoc_conf = custom_target('asciidoc.conf',
26ccd9
+    command : [
26ccd9
+      'sed', '-e', 's,UTILITY,libcxl,g',
26ccd9
+    ],
26ccd9
+    input : '../../asciidoc.conf.in',
26ccd9
+    output : 'asciidoc.conf',
26ccd9
+    capture : true,
26ccd9
+  )
26ccd9
+endif
26ccd9
+
26ccd9
+filedeps = [
26ccd9
+        '../../copyright.txt',
26ccd9
+]
26ccd9
+
26ccd9
+libcxl_manpages = [
26ccd9
+  'libcxl.txt',
26ccd9
+  'cxl_new.txt',
26ccd9
+]
26ccd9
+
26ccd9
+foreach man : libcxl_manpages
26ccd9
+  name = man.split('.')[0]
26ccd9
+  output = name + '.3'
26ccd9
+  output_xml = name + '.xml'
26ccd9
+  if get_option('asciidoctor').enabled()
26ccd9
+    custom_target(name,
26ccd9
+      command : [
26ccd9
+        asciidoc,
26ccd9
+        '-b', 'manpage', '-d', 'manpage', '-acompat-mode', '-I', '@OUTDIR@',
26ccd9
+        '-rasciidoctor-extensions', '-amansource=libcxl',
26ccd9
+        '-amanmanual=libcxl Manual',
26ccd9
+        '-andctl_version=@0@'.format(meson.project_version()),
26ccd9
+        '-o', '@OUTPUT@', '@INPUT@'
26ccd9
+      ],
26ccd9
+      input : man,
26ccd9
+      output : output,
26ccd9
+      depend_files : filedeps,
26ccd9
+      depends : asciidoc_conf,
26ccd9
+      install : get_option('docs').enabled(),
26ccd9
+      install_dir : join_paths(get_option('mandir'), 'man3'),
26ccd9
+    )
26ccd9
+  else
26ccd9
+    xml = custom_target(output_xml,
26ccd9
+      command : [
26ccd9
+        asciidoc,
26ccd9
+	'-b', 'docbook', '-d', 'manpage', '-f', asciidoc_conf, '--unsafe',
26ccd9
+	'-andctl_version=@0@'.format(meson.project_version()),
26ccd9
+	'-o', '@OUTPUT@', '@INPUT@',
26ccd9
+      ],
26ccd9
+      input : man,
26ccd9
+      output : output_xml,
26ccd9
+      depend_files : filedeps,
26ccd9
+      depends : asciidoc_conf,
26ccd9
+    )
26ccd9
+
26ccd9
+    xsl = files('../../manpage-normal.xsl')
26ccd9
+
26ccd9
+    custom_target(name,
26ccd9
+      command : [
26ccd9
+        xmlto, '-o', '@OUTDIR@', '-m', xsl, 'man', '@INPUT@'
26ccd9
+      ],
26ccd9
+      depends : xml,
26ccd9
+      depend_files : xsl,
26ccd9
+      input : xml,
26ccd9
+      output : output,
26ccd9
+      install : get_option('docs').enabled(),
26ccd9
+      install_dir : join_paths(get_option('mandir'), 'man3'),
26ccd9
+    )
26ccd9
+  endif
26ccd9
+endforeach
26ccd9
diff -up ndctl-71.1/Documentation/cxl/meson.build.orig ndctl-71.1/Documentation/cxl/meson.build
26ccd9
--- ndctl-71.1/Documentation/cxl/meson.build.orig	2022-10-07 17:29:51.568717645 -0400
26ccd9
+++ ndctl-71.1/Documentation/cxl/meson.build	2022-10-07 17:29:51.568717645 -0400
26ccd9
@@ -0,0 +1,84 @@
26ccd9
+if get_option('asciidoctor').enabled()
26ccd9
+  asciidoc_conf = custom_target('asciidoctor-extensions.rb',
26ccd9
+    command : [
26ccd9
+      'sed', '-e', 's,@Utility@,Cxl,g', '-e', 's,@utility@,cxl,g', '@INPUT@'
26ccd9
+    ],
26ccd9
+    input : '../asciidoctor-extensions.rb.in',
26ccd9
+    output : 'asciidoctor-extensions.rb',
26ccd9
+    capture : true,
26ccd9
+  )
26ccd9
+else
26ccd9
+  asciidoc_conf = custom_target('asciidoc.conf',
26ccd9
+    command : [
26ccd9
+      'sed', '-e', 's,UTILITY,cxl,g',
26ccd9
+    ],
26ccd9
+    input : '../asciidoc.conf.in',
26ccd9
+    output : 'asciidoc.conf',
26ccd9
+    capture : true,
26ccd9
+  )
26ccd9
+endif
26ccd9
+
26ccd9
+filedeps = [
26ccd9
+        '../copyright.txt',
26ccd9
+]
26ccd9
+
26ccd9
+cxl_manpages = [
26ccd9
+  'cxl.txt',
26ccd9
+  'cxl-list.txt',
26ccd9
+  'cxl-read-labels.txt',
26ccd9
+  'cxl-write-labels.txt',
26ccd9
+  'cxl-zero-labels.txt',
26ccd9
+]
26ccd9
+
26ccd9
+foreach man : cxl_manpages
26ccd9
+  name = man.split('.')[0]
26ccd9
+  output = name + '.1'
26ccd9
+  output_xml = name + '.xml'
26ccd9
+  if get_option('asciidoctor').enabled()
26ccd9
+    custom_target(name,
26ccd9
+      command : [
26ccd9
+        asciidoc,
26ccd9
+        '-b', 'manpage', '-d', 'manpage', '-acompat-mode', '-I', '@OUTDIR@',
26ccd9
+        '-rasciidoctor-extensions', '-amansource=cxl',
26ccd9
+        '-amanmanual=cxl Manual',
26ccd9
+        '-andctl_version=@0@'.format(meson.project_version()),
26ccd9
+        '-o', '@OUTPUT@', '@INPUT@'
26ccd9
+      ],
26ccd9
+      input : man,
26ccd9
+      output : output,
26ccd9
+      depend_files : filedeps,
26ccd9
+      depends : asciidoc_conf,
26ccd9
+      install : get_option('docs').enabled(),
26ccd9
+      install_dir : join_paths(get_option('mandir'), 'man1'),
26ccd9
+    )
26ccd9
+  else
26ccd9
+    xml = custom_target(output_xml,
26ccd9
+      command : [
26ccd9
+        asciidoc,
26ccd9
+	'-b', 'docbook', '-d', 'manpage', '-f', asciidoc_conf, '--unsafe',
26ccd9
+	'-andctl_version=@0@'.format(meson.project_version()),
26ccd9
+	'-o', '@OUTPUT@', '@INPUT@',
26ccd9
+      ],
26ccd9
+      input : man,
26ccd9
+      output : output_xml,
26ccd9
+      depend_files : filedeps,
26ccd9
+      depends : asciidoc_conf,
26ccd9
+    )
26ccd9
+
26ccd9
+    xsl = files('../manpage-normal.xsl')
26ccd9
+
26ccd9
+    custom_target(name,
26ccd9
+      command : [
26ccd9
+        xmlto, '-o', '@OUTDIR@', '-m', xsl, 'man', '@INPUT@'
26ccd9
+      ],
26ccd9
+      depends : xml,
26ccd9
+      depend_files : xsl,
26ccd9
+      input : xml,
26ccd9
+      output : output,
26ccd9
+      install : get_option('docs').enabled(),
26ccd9
+      install_dir : join_paths(get_option('mandir'), 'man1'),
26ccd9
+    )
26ccd9
+  endif
26ccd9
+endforeach
26ccd9
+
26ccd9
+subdir('lib')
26ccd9
diff -up ndctl-71.1/Documentation/daxctl/meson.build.orig ndctl-71.1/Documentation/daxctl/meson.build
26ccd9
--- ndctl-71.1/Documentation/daxctl/meson.build.orig	2022-10-07 17:29:51.569717648 -0400
26ccd9
+++ ndctl-71.1/Documentation/daxctl/meson.build	2022-10-07 17:29:51.568717645 -0400
26ccd9
@@ -0,0 +1,94 @@
26ccd9
+if get_option('asciidoctor').enabled()
26ccd9
+  asciidoc_conf = custom_target('asciidoctor-extensions.rb',
26ccd9
+    command : [
26ccd9
+      'sed', '-e', 's,@Utility@,Daxctl,g', '-e', 's,@utility@,daxctl,g', '@INPUT@'
26ccd9
+    ],
26ccd9
+    input : '../asciidoctor-extensions.rb.in',
26ccd9
+    output : 'asciidoctor-extensions.rb',
26ccd9
+    capture : true,
26ccd9
+  )
26ccd9
+else
26ccd9
+  asciidoc_conf = custom_target('asciidoc.conf',
26ccd9
+    command : [
26ccd9
+      'sed', '-e', 's,UTILITY,daxctl,g',
26ccd9
+    ],
26ccd9
+    input : '../asciidoc.conf.in',
26ccd9
+    output : 'asciidoc.conf',
26ccd9
+    capture : true,
26ccd9
+  )
26ccd9
+endif
26ccd9
+
26ccd9
+filedeps = [
26ccd9
+	'human-option.txt',
26ccd9
+        '../copyright.txt',
26ccd9
+]
26ccd9
+
26ccd9
+daxctl_manpages = [
26ccd9
+  'daxctl.txt',
26ccd9
+  'daxctl-list.txt',
26ccd9
+  'daxctl-migrate-device-model.txt',
26ccd9
+  'daxctl-reconfigure-device.txt',
26ccd9
+  'daxctl-online-memory.txt',
26ccd9
+  'daxctl-offline-memory.txt',
26ccd9
+  'daxctl-disable-device.txt',
26ccd9
+  'daxctl-enable-device.txt',
26ccd9
+  'daxctl-create-device.txt',
26ccd9
+  'daxctl-destroy-device.txt',
26ccd9
+]
26ccd9
+
26ccd9
+foreach man : daxctl_manpages
26ccd9
+  name = man.split('.')[0]
26ccd9
+  output = name + '.1'
26ccd9
+  output_xml = name + '.xml'
26ccd9
+  if get_option('asciidoctor').enabled()
26ccd9
+    custom_target(name,
26ccd9
+      command : [
26ccd9
+        asciidoc,
26ccd9
+        '-b', 'manpage', '-d', 'manpage', '-acompat-mode', '-I', '@OUTDIR@',
26ccd9
+        '-rasciidoctor-extensions', '-amansource=daxctl',
26ccd9
+        '-amanmanual=daxctl Manual',
26ccd9
+	'-adaxctl_confdir=@0@'.format(daxctlconf_dir),
26ccd9
+	'-adaxctl_conf=@0@'.format(daxctlconf),
26ccd9
+	'-andctl_keysdir=@0@'.format(ndctlkeys_dir),
26ccd9
+        '-andctl_version=@0@'.format(meson.project_version()),
26ccd9
+        '-o', '@OUTPUT@', '@INPUT@'
26ccd9
+      ],
26ccd9
+      input : man,
26ccd9
+      output : output,
26ccd9
+      depend_files : filedeps,
26ccd9
+      depends : asciidoc_conf,
26ccd9
+      install : get_option('docs').enabled(),
26ccd9
+      install_dir : join_paths(get_option('mandir'), 'man1'),
26ccd9
+    )
26ccd9
+  else
26ccd9
+    xml = custom_target(output_xml,
26ccd9
+      command : [
26ccd9
+        asciidoc,
26ccd9
+	'-b', 'docbook', '-d', 'manpage', '-f', asciidoc_conf, '--unsafe',
26ccd9
+	'-adaxctl_confdir=@0@'.format(daxctlconf_dir),
26ccd9
+	'-adaxctl_conf=@0@'.format(daxctlconf),
26ccd9
+	'-andctl_keysdir=@0@'.format(ndctlkeys_dir),
26ccd9
+	'-andctl_version=@0@'.format(meson.project_version()),
26ccd9
+	'-o', '@OUTPUT@', '@INPUT@',
26ccd9
+      ],
26ccd9
+      input : man,
26ccd9
+      output : output_xml,
26ccd9
+      depend_files : filedeps,
26ccd9
+      depends : asciidoc_conf,
26ccd9
+    )
26ccd9
+
26ccd9
+    xsl = files('../manpage-normal.xsl')
26ccd9
+
26ccd9
+    custom_target(name,
26ccd9
+      command : [
26ccd9
+        xmlto, '-o', '@OUTDIR@', '-m', xsl, 'man', '@INPUT@'
26ccd9
+      ],
26ccd9
+      depends : xml,
26ccd9
+      depend_files : xsl,
26ccd9
+      input : xml,
26ccd9
+      output : output,
26ccd9
+      install : get_option('docs').enabled(),
26ccd9
+      install_dir : join_paths(get_option('mandir'), 'man1'),
26ccd9
+    )
26ccd9
+  endif
26ccd9
+endforeach
26ccd9
diff -up ndctl-71.1/Documentation/ndctl/meson.build.orig ndctl-71.1/Documentation/ndctl/meson.build
26ccd9
--- ndctl-71.1/Documentation/ndctl/meson.build.orig	2022-10-07 17:29:51.570717651 -0400
26ccd9
+++ ndctl-71.1/Documentation/ndctl/meson.build	2022-10-07 17:29:51.570717651 -0400
26ccd9
@@ -0,0 +1,124 @@
26ccd9
+if get_option('asciidoctor').enabled()
26ccd9
+  asciidoc_conf = custom_target('asciidoctor-extensions.rb',
26ccd9
+    command : [
26ccd9
+      'sed', '-e', 's,@Utility@,Ndctl,g', '-e', 's,@utility@,ndctl,g', '@INPUT@'
26ccd9
+    ],
26ccd9
+    input : '../asciidoctor-extensions.rb.in',
26ccd9
+    output : 'asciidoctor-extensions.rb',
26ccd9
+    capture : true,
26ccd9
+  )
26ccd9
+else
26ccd9
+  asciidoc_conf = custom_target('asciidoc.conf',
26ccd9
+    command : [
26ccd9
+      'sed', '-e', 's,UTILITY,ndctl,g',
26ccd9
+    ],
26ccd9
+    input : '../asciidoc.conf.in',
26ccd9
+    output : 'asciidoc.conf',
26ccd9
+    capture : true,
26ccd9
+  )
26ccd9
+endif
26ccd9
+
26ccd9
+filedeps = [
26ccd9
+        '../copyright.txt',
26ccd9
+        'region-description.txt',
26ccd9
+        'xable-region-options.txt',
26ccd9
+        'dimm-description.txt',
26ccd9
+        'xable-dimm-options.txt',
26ccd9
+        'xable-namespace-options.txt',
26ccd9
+        'ars-description.txt',
26ccd9
+        'labels-description.txt',
26ccd9
+        'labels-options.txt',
26ccd9
+]
26ccd9
+
26ccd9
+ndctl_manpages = [
26ccd9
+  'ndctl.txt',
26ccd9
+  'ndctl-wait-scrub.txt',
26ccd9
+  'ndctl-start-scrub.txt',
26ccd9
+  'ndctl-zero-labels.txt',
26ccd9
+  'ndctl-read-labels.txt',
26ccd9
+  'ndctl-write-labels.txt',
26ccd9
+  'ndctl-init-labels.txt',
26ccd9
+  'ndctl-check-labels.txt',
26ccd9
+  'ndctl-enable-region.txt',
26ccd9
+  'ndctl-disable-region.txt',
26ccd9
+  'ndctl-enable-dimm.txt',
26ccd9
+  'ndctl-disable-dimm.txt',
26ccd9
+  'ndctl-enable-namespace.txt',
26ccd9
+  'ndctl-disable-namespace.txt',
26ccd9
+  'ndctl-create-namespace.txt',
26ccd9
+  'ndctl-destroy-namespace.txt',
26ccd9
+  'ndctl-check-namespace.txt',
26ccd9
+  'ndctl-clear-errors.txt',
26ccd9
+  'ndctl-inject-error.txt',
26ccd9
+  'ndctl-inject-smart.txt',
26ccd9
+  'ndctl-update-firmware.txt',
26ccd9
+  'ndctl-list.txt',
26ccd9
+  'ndctl-monitor.txt',
26ccd9
+  'ndctl-setup-passphrase.txt',
26ccd9
+  'ndctl-update-passphrase.txt',
26ccd9
+  'ndctl-remove-passphrase.txt',
26ccd9
+  'ndctl-freeze-security.txt',
26ccd9
+  'ndctl-sanitize-dimm.txt',
26ccd9
+  'ndctl-load-keys.txt',
26ccd9
+  'ndctl-wait-overwrite.txt',
26ccd9
+  'ndctl-read-infoblock.txt',
26ccd9
+  'ndctl-write-infoblock.txt',
26ccd9
+  'ndctl-activate-firmware.txt',
26ccd9
+]
26ccd9
+
26ccd9
+foreach man : ndctl_manpages
26ccd9
+  name = man.split('.')[0]
26ccd9
+  output = name + '.1'
26ccd9
+  output_xml = name + '.xml'
26ccd9
+  if get_option('asciidoctor').enabled()
26ccd9
+    custom_target(name,
26ccd9
+      command : [
26ccd9
+        asciidoc,
26ccd9
+        '-b', 'manpage', '-d', 'manpage', '-acompat-mode', '-I', '@OUTDIR@',
26ccd9
+        '-rasciidoctor-extensions', '-amansource=ndctl',
26ccd9
+        '-amanmanual=ndctl Manual',
26ccd9
+	'-andctl_confdir=@0@'.format(ndctlconf_dir),
26ccd9
+	'-andctl_monitorconf=@0@'.format(ndctlconf),
26ccd9
+	'-andctl_keysdir=@0@'.format(ndctlkeys_dir),
26ccd9
+        '-andctl_version=@0@'.format(meson.project_version()),
26ccd9
+        '-o', '@OUTPUT@', '@INPUT@'
26ccd9
+      ],
26ccd9
+      input : man,
26ccd9
+      output : output,
26ccd9
+      depend_files : filedeps,
26ccd9
+      depends : asciidoc_conf,
26ccd9
+      install : get_option('docs').enabled(),
26ccd9
+      install_dir : join_paths(get_option('mandir'), 'man1'),
26ccd9
+    )
26ccd9
+  else
26ccd9
+    xml = custom_target(output_xml,
26ccd9
+      command : [
26ccd9
+        asciidoc,
26ccd9
+	'-b', 'docbook', '-d', 'manpage', '-f', asciidoc_conf, '--unsafe',
26ccd9
+	'-andctl_version=@0@'.format(meson.project_version()),
26ccd9
+	'-andctl_confdir=@0@'.format(ndctlconf_dir),
26ccd9
+	'-andctl_monitorconf=@0@'.format(ndctlconf),
26ccd9
+	'-andctl_keysdir=@0@'.format(ndctlkeys_dir),
26ccd9
+	'-o', '@OUTPUT@', '@INPUT@',
26ccd9
+      ],
26ccd9
+      input : man,
26ccd9
+      output : output_xml,
26ccd9
+      depend_files : filedeps,
26ccd9
+      depends : asciidoc_conf,
26ccd9
+    )
26ccd9
+
26ccd9
+    xsl = files('../manpage-normal.xsl')
26ccd9
+
26ccd9
+    custom_target(name,
26ccd9
+      command : [
26ccd9
+        xmlto, '-o', '@OUTDIR@', '-m', xsl, 'man', '@INPUT@'
26ccd9
+      ],
26ccd9
+      depends : xml,
26ccd9
+      depend_files : xsl,
26ccd9
+      input : xml,
26ccd9
+      output : output,
26ccd9
+      install : get_option('docs').enabled(),
26ccd9
+      install_dir : join_paths(get_option('mandir'), 'man1'),
26ccd9
+    )
26ccd9
+  endif
26ccd9
+endforeach
26ccd9
diff -up ndctl-71.1/clean_config.sh.orig ndctl-71.1/clean_config.sh
26ccd9
--- ndctl-71.1/clean_config.sh.orig	2022-10-07 17:29:51.570717651 -0400
26ccd9
+++ ndctl-71.1/clean_config.sh	2022-10-07 17:29:51.570717651 -0400
26ccd9
@@ -0,0 +1,2 @@
26ccd9
+#!/bin/bash
26ccd9
+git ls-files -o --exclude build | grep config.h\$ | xargs rm
26ccd9
diff -up ndctl-71.1/config.h.meson.orig ndctl-71.1/config.h.meson
26ccd9
--- ndctl-71.1/config.h.meson.orig	2022-10-07 17:29:51.570717651 -0400
26ccd9
+++ ndctl-71.1/config.h.meson	2022-10-07 17:29:51.570717651 -0400
26ccd9
@@ -0,0 +1,151 @@
26ccd9
+/* Debug messages. */
26ccd9
+#mesondefine ENABLE_DEBUG
26ccd9
+
26ccd9
+/* destructive functional tests support */
26ccd9
+#mesondefine ENABLE_DESTRUCTIVE
26ccd9
+
26ccd9
+/* Documentation / man pages. */
26ccd9
+#mesondefine ENABLE_DOCS
26ccd9
+
26ccd9
+/* Enable keyutils support */
26ccd9
+#mesondefine ENABLE_KEYUTILS
26ccd9
+
26ccd9
+/* System logging. */
26ccd9
+#mesondefine ENABLE_LOGGING
26ccd9
+
26ccd9
+/* ndctl test poison support */
26ccd9
+#mesondefine ENABLE_POISON
26ccd9
+
26ccd9
+/* ndctl test support */
26ccd9
+#mesondefine ENABLE_TEST
26ccd9
+
26ccd9
+/* Define to 1 if big-endian-arch */
26ccd9
+#mesondefine HAVE_BIG_ENDIAN
26ccd9
+
26ccd9
+/* Define to 1 if you have the declaration of `BUS_MCEERR_AR', and to 0 if you
26ccd9
+   don't. */
26ccd9
+#mesondefine HAVE_DECL_BUS_MCEERR_AR
26ccd9
+
26ccd9
+/* Define to 1 if you have the declaration of `MAP_SHARED_VALIDATE', and to 0
26ccd9
+   if you don't. */
26ccd9
+#mesondefine HAVE_DECL_MAP_SHARED_VALIDATE
26ccd9
+
26ccd9
+/* Define to 1 if you have the declaration of `MAP_SYNC', and to 0 if you
26ccd9
+   don't. */
26ccd9
+#mesondefine HAVE_DECL_MAP_SYNC
26ccd9
+
26ccd9
+/* Define to 1 if you have the <dlfcn.h> header file. */
26ccd9
+#mesondefine HAVE_DLFCN_H
26ccd9
+
26ccd9
+/* Define to 1 if you have the <inttypes.h> header file. */
26ccd9
+#mesondefine HAVE_INTTYPES_H
26ccd9
+
26ccd9
+/* Define to 1 if you have the <keyutils.h> header file. */
26ccd9
+#mesondefine HAVE_KEYUTILS_H
26ccd9
+
26ccd9
+/* Define to 1 if you have the <linux/version.h> header file. */
26ccd9
+#mesondefine HAVE_LINUX_VERSION_H
26ccd9
+
26ccd9
+/* Define to 1 if little-endian-arch */
26ccd9
+#mesondefine HAVE_LITTLE_ENDIAN
26ccd9
+
26ccd9
+/* Define to 1 if you have the <memory.h> header file. */
26ccd9
+#mesondefine HAVE_MEMORY_H
26ccd9
+
26ccd9
+/* Define to 1 if you have the `secure_getenv' function. */
26ccd9
+#mesondefine HAVE_SECURE_GETENV
26ccd9
+
26ccd9
+/* Define to 1 if you have statement expressions. */
26ccd9
+#mesondefine HAVE_STATEMENT_EXPR
26ccd9
+
26ccd9
+/* Define to 1 if you have the <stdint.h> header file. */
26ccd9
+#mesondefine HAVE_STDINT_H
26ccd9
+
26ccd9
+/* Define to 1 if you have the <stdlib.h> header file. */
26ccd9
+#mesondefine HAVE_STDLIB_H
26ccd9
+
26ccd9
+/* Define to 1 if you have the <strings.h> header file. */
26ccd9
+#mesondefine HAVE_STRINGS_H
26ccd9
+
26ccd9
+/* Define to 1 if you have the <string.h> header file. */
26ccd9
+#mesondefine HAVE_STRING_H
26ccd9
+
26ccd9
+/* Define to 1 if you have the <sys/stat.h> header file. */
26ccd9
+#mesondefine HAVE_SYS_STAT_H
26ccd9
+
26ccd9
+/* Define to 1 if you have the <sys/types.h> header file. */
26ccd9
+#mesondefine HAVE_SYS_TYPES_H
26ccd9
+
26ccd9
+/* Define to 1 if typeof works with your compiler. */
26ccd9
+#mesondefine HAVE_TYPEOF
26ccd9
+
26ccd9
+/* Define to 1 if you have the <unistd.h> header file. */
26ccd9
+#mesondefine HAVE_UNISTD_H
26ccd9
+
26ccd9
+/* Define to 1 if using libuuid */
26ccd9
+#mesondefine HAVE_UUID
26ccd9
+
26ccd9
+/* Define to 1 if you have the `__secure_getenv' function. */
26ccd9
+#mesondefine HAVE___SECURE_GETENV
26ccd9
+
26ccd9
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
26ccd9
+#mesondefine LT_OBJDIR
26ccd9
+
26ccd9
+/* Name of package */
26ccd9
+#mesondefine PACKAGE
26ccd9
+
26ccd9
+/* Define to the address where bug reports for this package should be sent. */
26ccd9
+#mesondefine PACKAGE_BUGREPORT
26ccd9
+
26ccd9
+/* Define to the full name of this package. */
26ccd9
+#mesondefine PACKAGE_NAME
26ccd9
+
26ccd9
+/* Define to the full name and version of this package. */
26ccd9
+#mesondefine PACKAGE_STRING
26ccd9
+
26ccd9
+/* Define to the one symbol short name of this package. */
26ccd9
+#mesondefine PACKAGE_TARNAME
26ccd9
+
26ccd9
+/* Define to the home page for this package. */
26ccd9
+#mesondefine PACKAGE_URL
26ccd9
+
26ccd9
+/* Define to the version of this package. */
26ccd9
+#mesondefine PACKAGE_VERSION
26ccd9
+
26ccd9
+/* Define to 1 if you have the ANSI C header files. */
26ccd9
+#mesondefine STDC_HEADERS
26ccd9
+
26ccd9
+/* Version number of package */
26ccd9
+#mesondefine VERSION
26ccd9
+
26ccd9
+/* Number of bits in a file offset, on hosts where this is settable. */
26ccd9
+#mesondefine _FILE_OFFSET_BITS
26ccd9
+
26ccd9
+/* Define for large files, on AIX-style hosts. */
26ccd9
+#mesondefine _LARGE_FILES
26ccd9
+
26ccd9
+/* Define to 1 if on MINIX. */
26ccd9
+#mesondefine _MINIX
26ccd9
+
26ccd9
+/* Define to 2 if the system does not provide POSIX.1 features except with
26ccd9
+   this defined. */
26ccd9
+#mesondefine _POSIX_1_SOURCE
26ccd9
+
26ccd9
+/* Define to 1 if you need to in order for `stat' and other things to work. */
26ccd9
+#mesondefine _POSIX_SOURCE
26ccd9
+
26ccd9
+/* Define to __typeof__ if your compiler spells it that way. */
26ccd9
+#mesondefine typeof
26ccd9
+
26ccd9
+/* Define to enable GNU Source Extensions */
26ccd9
+#mesondefine _GNU_SOURCE
26ccd9
+
26ccd9
+/* Locations to install configuration files, key config, man pages, etc.. */
26ccd9
+#mesondefine NDCTL_CONF_FILE
26ccd9
+#mesondefine NDCTL_CONF_DIR
26ccd9
+#mesondefine DAXCTL_CONF_DIR
26ccd9
+#mesondefine NDCTL_KEYS_DIR
26ccd9
+#mesondefine NDCTL_MAN_PATH
26ccd9
+#mesondefine DAXCTL_MODPROBE_DATA
26ccd9
+#mesondefine DAXCTL_MODPROBE_INSTALL
26ccd9
+#mesondefine PREFIX
26ccd9
diff -up ndctl-71.1/contrib/meson.build.orig ndctl-71.1/contrib/meson.build
26ccd9
--- ndctl-71.1/contrib/meson.build.orig	2022-10-07 17:29:51.571717655 -0400
26ccd9
+++ ndctl-71.1/contrib/meson.build	2022-10-07 17:29:51.570717651 -0400
26ccd9
@@ -0,0 +1,28 @@
26ccd9
+bashcompletiondir = get_option('bashcompletiondir')
26ccd9
+if bashcompletiondir == ''
26ccd9
+  bash_completion = dependency('bash-completion', required : false)
26ccd9
+  if bash_completion.found()
26ccd9
+      bashcompletiondir = bash_completion.get_pkgconfig_variable('completionsdir')
26ccd9
+  else
26ccd9
+    bashcompletiondir = datadir / 'bash-completion/completions'
26ccd9
+  endif
26ccd9
+endif
26ccd9
+
26ccd9
+if bashcompletiondir != 'no'
26ccd9
+  install_data('ndctl', install_dir : bashcompletiondir)
26ccd9
+
26ccd9
+# TODO Switch to symlinks once 0.61.0 is more widely available
26ccd9
+#  install_symlink('daxctl',
26ccd9
+#    install_dir : bashcompletiondir,
26ccd9
+#    pointing_to : 'ndctl'
26ccd9
+#  )
26ccd9
+#  install_symlink('cxl',
26ccd9
+#    install_dir : bashcompletiondir,
26ccd9
+#    pointing_to : 'ndctl'
26ccd9
+#  )
26ccd9
+  install_data('ndctl', rename : 'daxctl', install_dir : bashcompletiondir)
26ccd9
+  install_data('ndctl', rename : 'cxl', install_dir : bashcompletiondir)
26ccd9
+endif
26ccd9
+
26ccd9
+modprobedatadir = get_option('sysconfdir') + '/modprobe.d/'
26ccd9
+install_data('nvdimm-security.conf', install_dir : modprobedatadir)
26ccd9
diff -up ndctl-71.1/cxl/lib/meson.build.orig ndctl-71.1/cxl/lib/meson.build
26ccd9
--- ndctl-71.1/cxl/lib/meson.build.orig	2022-10-07 17:29:51.571717655 -0400
26ccd9
+++ ndctl-71.1/cxl/lib/meson.build	2022-10-07 17:29:51.571717655 -0400
26ccd9
@@ -0,0 +1,35 @@
26ccd9
+libcxl_version = '@0@.@1@.@2@'.format(
26ccd9
+  LIBCXL_CURRENT - LIBCXL_AGE,
26ccd9
+  LIBCXL_REVISION,
26ccd9
+  LIBCXL_AGE)
26ccd9
+
26ccd9
+mapfile = files('libcxl.sym')
26ccd9
+vflag = '-Wl,--version-script,@0@/@1@'.format(project_source_root, mapfile[0])
26ccd9
+
26ccd9
+cxl = library('cxl',
26ccd9
+  '../../util/sysfs.c',
26ccd9
+  '../../util/log.c',
26ccd9
+  '../../util/log.h',
26ccd9
+  'libcxl.c',
26ccd9
+  include_directories : root_inc,
26ccd9
+  dependencies : [
26ccd9
+    uuid,
26ccd9
+    kmod,
26ccd9
+  ],
26ccd9
+  version : libcxl_version,
26ccd9
+  install : true,
26ccd9
+  install_dir : rootlibdir,
26ccd9
+  link_args : vflag,
26ccd9
+  link_depends : mapfile,
26ccd9
+)
26ccd9
+cxl_dep = declare_dependency(link_with : cxl)
26ccd9
+
26ccd9
+custom_target(
26ccd9
+  'libcxl.pc',
26ccd9
+  command : pkgconfig_script + [ '@INPUT@' ],
26ccd9
+  input : 'libcxl.pc.in',
26ccd9
+  output : 'libcxl.pc',
26ccd9
+  capture : true,
26ccd9
+  install : true,
26ccd9
+  install_dir : pkgconfiglibdir,
26ccd9
+)
26ccd9
diff -up ndctl-71.1/cxl/meson.build.orig ndctl-71.1/cxl/meson.build
26ccd9
--- ndctl-71.1/cxl/meson.build.orig	2022-10-07 17:29:51.571717655 -0400
26ccd9
+++ ndctl-71.1/cxl/meson.build	2022-10-07 17:29:51.571717655 -0400
26ccd9
@@ -0,0 +1,25 @@
26ccd9
+cxl_src = [
26ccd9
+  'cxl.c',
26ccd9
+  'list.c',
26ccd9
+  'memdev.c',
26ccd9
+  '../util/json.c',
26ccd9
+  'json.c',
26ccd9
+  'filter.c',
26ccd9
+]
26ccd9
+
26ccd9
+cxl_tool = executable('cxl',
26ccd9
+  cxl_src,
26ccd9
+  include_directories : root_inc,
26ccd9
+  dependencies : [
26ccd9
+    cxl_dep,
26ccd9
+    util_dep,
26ccd9
+    uuid,
26ccd9
+    kmod,
26ccd9
+    json,
26ccd9
+    versiondep,
26ccd9
+  ],
26ccd9
+  install : true,
26ccd9
+  install_dir : rootbindir,
26ccd9
+)
26ccd9
+
26ccd9
+install_headers('libcxl.h', subdir : 'cxl')
26ccd9
diff -up ndctl-71.1/daxctl/device.c.orig ndctl-71.1/daxctl/device.c
26ccd9
--- ndctl-71.1/daxctl/device.c.orig	2022-10-07 17:29:42.909688163 -0400
26ccd9
+++ ndctl-71.1/daxctl/device.c	2022-10-07 17:29:51.572717658 -0400
26ccd9
@@ -8,6 +8,7 @@
26ccd9
 #include <limits.h>
26ccd9
 #include <sys/stat.h>
26ccd9
 #include <sys/types.h>
26ccd9
+#include <uuid/uuid.h>
26ccd9
 #include <sys/sysmacros.h>
26ccd9
 #include <util/size.h>
26ccd9
 #include <util/json.h>
26ccd9
diff -up ndctl-71.1/daxctl/lib/meson.build.orig ndctl-71.1/daxctl/lib/meson.build
26ccd9
--- ndctl-71.1/daxctl/lib/meson.build.orig	2022-10-07 17:29:51.573717662 -0400
26ccd9
+++ ndctl-71.1/daxctl/lib/meson.build	2022-10-07 17:29:51.573717662 -0400
26ccd9
@@ -0,0 +1,44 @@
26ccd9
+libdaxctl_version = '@0@.@1@.@2@'.format(
26ccd9
+  LIBDAXCTL_CURRENT - LIBDAXCTL_AGE,
26ccd9
+  LIBDAXCTL_REVISION,
26ccd9
+  LIBDAXCTL_AGE,
26ccd9
+)
26ccd9
+
26ccd9
+mapfile = files('libdaxctl.sym')
26ccd9
+vflag = '-Wl,--version-script,@0@/@1@'.format(project_source_root, mapfile[0])
26ccd9
+
26ccd9
+libdaxctl_src = [
26ccd9
+  '../../util/iomem.c',
26ccd9
+  '../../util/sysfs.c',
26ccd9
+  '../../util/log.c',
26ccd9
+  'libdaxctl.c',
26ccd9
+]
26ccd9
+
26ccd9
+daxctl = library(
26ccd9
+ 'daxctl',
26ccd9
+  libdaxctl_src,
26ccd9
+  version : libdaxctl_version,
26ccd9
+  include_directories : root_inc,
26ccd9
+  dependencies : [
26ccd9
+    uuid,
26ccd9
+    kmod,
26ccd9
+  ],
26ccd9
+  install : true,
26ccd9
+  install_dir : rootlibdir,
26ccd9
+  link_args : vflag,
26ccd9
+  link_depends : mapfile,
26ccd9
+)
26ccd9
+
26ccd9
+daxctl_dep = declare_dependency(link_with : daxctl)
26ccd9
+
26ccd9
+custom_target(
26ccd9
+  'libdaxctl.pc',
26ccd9
+  command : pkgconfig_script + [ '@INPUT@' ],
26ccd9
+  input : 'libdaxctl.pc.in',
26ccd9
+  output : 'libdaxctl.pc',
26ccd9
+  capture : true,
26ccd9
+  install : true,
26ccd9
+  install_dir : pkgconfiglibdir,
26ccd9
+)
26ccd9
+
26ccd9
+install_data('daxctl.conf', install_dir : datadir / 'daxctl')
26ccd9
diff -up ndctl-71.1/daxctl/meson.build.orig ndctl-71.1/daxctl/meson.build
26ccd9
--- ndctl-71.1/daxctl/meson.build.orig	2022-10-07 17:29:51.574717665 -0400
26ccd9
+++ ndctl-71.1/daxctl/meson.build	2022-10-07 17:29:51.574717665 -0400
26ccd9
@@ -0,0 +1,28 @@
26ccd9
+daxctl_src = [
26ccd9
+  'daxctl.c',
26ccd9
+  'acpi.c',
26ccd9
+  'list.c',
26ccd9
+  'migrate.c',
26ccd9
+  'device.c',
26ccd9
+  '../util/json.c',
26ccd9
+  'json.c',
26ccd9
+  'filter.c',
26ccd9
+]
26ccd9
+
26ccd9
+daxctl_tool = executable('daxctl',
26ccd9
+  daxctl_src,
26ccd9
+  include_directories : root_inc,
26ccd9
+  dependencies : [
26ccd9
+    daxctl_dep,
26ccd9
+    ndctl_dep,
26ccd9
+    util_dep,
26ccd9
+    uuid,
26ccd9
+    kmod,
26ccd9
+    json,
26ccd9
+    versiondep,
26ccd9
+  ],
26ccd9
+  install : true,
26ccd9
+  install_dir : rootbindir,
26ccd9
+)
26ccd9
+
26ccd9
+install_headers('libdaxctl.h', subdir : 'daxctl')
26ccd9
diff -up ndctl-71.1/meson.build.orig ndctl-71.1/meson.build
26ccd9
--- ndctl-71.1/meson.build.orig	2022-10-07 17:29:51.575717669 -0400
26ccd9
+++ ndctl-71.1/meson.build	2022-10-07 17:33:21.562432608 -0400
26ccd9
@@ -0,0 +1,279 @@
26ccd9
+project('ndctl', 'c',
26ccd9
+  version : '72',
26ccd9
+  license : [
26ccd9
+    'GPL-2.0',
26ccd9
+    'LGPL-2.1',
26ccd9
+    'CC0-1.0',
26ccd9
+    'MIT',
26ccd9
+  ],
26ccd9
+  default_options : [
26ccd9
+    'c_std=gnu99',
26ccd9
+    'prefix=/usr',
26ccd9
+    'sysconfdir=/etc',
26ccd9
+    'localstatedir=/var',
26ccd9
+  ],
26ccd9
+)
26ccd9
+
26ccd9
+# rootprefixdir and rootlibdir setup copied from systemd:
26ccd9
+rootprefixdir = get_option('rootprefix')
26ccd9
+rootprefix_default = '/usr'
26ccd9
+if rootprefixdir == ''
26ccd9
+        rootprefixdir = rootprefix_default
26ccd9
+endif
26ccd9
+rootbindir = join_paths(rootprefixdir, 'bin')
26ccd9
+
26ccd9
+# join_paths ignores the preceding arguments if an absolute component is
26ccd9
+# encountered, so this should canonicalize various paths when they are
26ccd9
+# absolute or relative.
26ccd9
+prefixdir = get_option('prefix')
26ccd9
+if not prefixdir.startswith('/')
26ccd9
+        error('Prefix is not absolute: "@0@"'.format(prefixdir))
26ccd9
+endif
26ccd9
+if prefixdir != rootprefixdir and rootprefixdir != '/' and not prefixdir.strip('/').startswith(rootprefixdir.strip('/') + '/')
26ccd9
+  error('Prefix is not below root prefix (now rootprefix=@0@ prefix=@1@)'.format(
26ccd9
+	rootprefixdir, prefixdir))
26ccd9
+endif
26ccd9
+
26ccd9
+libdir = join_paths(prefixdir, get_option('libdir'))
26ccd9
+rootlibdir = get_option('rootlibdir')
26ccd9
+if rootlibdir == ''
26ccd9
+  rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1])
26ccd9
+endif
26ccd9
+datadir = prefixdir / get_option('datadir')
26ccd9
+includedir = prefixdir / get_option('includedir')
26ccd9
+
26ccd9
+pkgconfiglibdir = get_option('pkgconfiglibdir') != '' ? get_option('pkgconfiglibdir') : libdir / 'pkgconfig'
26ccd9
+
26ccd9
+datadir = prefixdir / get_option('datadir')
26ccd9
+includedir = prefixdir / get_option('includedir')
26ccd9
+sysconfdir =  get_option('sysconfdir')
26ccd9
+
26ccd9
+pkgconfig_script = '''
26ccd9
+sed -e s,@VERSION@,@0@,g
26ccd9
+    -e s,@prefix@,@1@,g
26ccd9
+    -e s,@exec_prefix@,@1@,g
26ccd9
+    -e s,@libdir@,@2@,g
26ccd9
+    -e s,@includedir@,@3@,g
26ccd9
+'''.format(meson.project_version(), prefixdir, libdir, includedir).split()
26ccd9
+
26ccd9
+cc_flags = [
26ccd9
+  '-Wall',
26ccd9
+  '-Wchar-subscripts',
26ccd9
+  '-Wformat-security',
26ccd9
+  '-Wmissing-declarations',
26ccd9
+  '-Wmissing-prototypes',
26ccd9
+  '-Wnested-externs ',
26ccd9
+  '-Wshadow',
26ccd9
+  '-Wsign-compare',
26ccd9
+  '-Wstrict-prototypes',
26ccd9
+  '-Wtype-limits',
26ccd9
+  '-Wmaybe-uninitialized',
26ccd9
+  '-Wdeclaration-after-statement',
26ccd9
+  '-Wunused-result',
26ccd9
+  '-D_FORTIFY_SOURCE=2',
26ccd9
+  '-O2',
26ccd9
+]
26ccd9
+cc = meson.get_compiler('c')
26ccd9
+add_project_arguments(cc.get_supported_arguments(cc_flags), language : 'c')
26ccd9
+
26ccd9
+project_source_root = meson.current_source_dir()
26ccd9
+
26ccd9
+# Remove this after the conversion to meson has been completed
26ccd9
+# Cleanup the leftover config.h files to avoid conflicts with the meson
26ccd9
+# generated config.h
26ccd9
+git = find_program('git', required : false)
26ccd9
+if git.found()
26ccd9
+  run_command('clean_config.sh',
26ccd9
+    env : 'GIT_DIR=@0@/.git'.format(project_source_root),
26ccd9
+  )
26ccd9
+endif
26ccd9
+
26ccd9
+version_tag = get_option('version-tag')
26ccd9
+if version_tag != ''
26ccd9
+  vcs_data = configuration_data()
26ccd9
+  vcs_data.set('VCS_TAG', version_tag)
26ccd9
+  version_h = configure_file(
26ccd9
+    configuration : vcs_data,
26ccd9
+    input : 'version.h.in',
26ccd9
+    output : 'version.h'
26ccd9
+  )
26ccd9
+else
26ccd9
+  vcs_tagger = [
26ccd9
+    project_source_root + '/tools/meson-vcs-tag.sh',
26ccd9
+    project_source_root,
26ccd9
+    meson.project_version()
26ccd9
+  ]
26ccd9
+
26ccd9
+  version_h = vcs_tag(
26ccd9
+      input : 'version.h.in',
26ccd9
+      output : 'version.h',
26ccd9
+      command: vcs_tagger
26ccd9
+  )
26ccd9
+endif
26ccd9
+
26ccd9
+versiondep = declare_dependency(
26ccd9
+  compile_args: ['-include', 'version.h'],
26ccd9
+  sources: version_h
26ccd9
+)
26ccd9
+
26ccd9
+kmod = dependency('libkmod')
26ccd9
+libudev = dependency('libudev')
26ccd9
+uuid = dependency('uuid')
26ccd9
+json = dependency('json-c')
26ccd9
+if get_option('docs').enabled()
26ccd9
+  if get_option('asciidoctor').enabled()
26ccd9
+    asciidoc = find_program('asciidoctor', required : true)
26ccd9
+  else
26ccd9
+    asciidoc = find_program('asciidoc', required : true)
26ccd9
+    xmlto = find_program('xmlto', required : true)
26ccd9
+  endif
26ccd9
+endif
26ccd9
+
26ccd9
+if get_option('systemd').enabled()
26ccd9
+  systemd = dependency('systemd', required : true)
26ccd9
+  systemdunitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
26ccd9
+  udev = dependency('udev', required : true)
26ccd9
+  udevdir = udev.get_pkgconfig_variable('udevdir')
26ccd9
+  udevrulesdir = udevdir / 'rules.d'
26ccd9
+endif
26ccd9
+
26ccd9
+cc = meson.get_compiler('c')
26ccd9
+
26ccd9
+# keyutils and iniparser lack pkgconfig
26ccd9
+keyutils = cc.find_library('keyutils', required : get_option('keyutils'))
26ccd9
+
26ccd9
+conf = configuration_data()
26ccd9
+check_headers = [
26ccd9
+  ['HAVE_DLFCN_H', 'dlfcn.h'],
26ccd9
+  ['HAVE_INTTYPES_H', 'inttypes.h'],
26ccd9
+  ['HAVE_KEYUTILS_H', 'keyutils.h'],
26ccd9
+  ['HAVE_LINUX_VERSION_H', 'linux/version.h'],
26ccd9
+  ['HAVE_MEMORY_H', 'memory.h'],
26ccd9
+  ['HAVE_STDINT_H', 'stdint.h'],
26ccd9
+  ['HAVE_STDLIB_H', 'stdlib.h'],
26ccd9
+  ['HAVE_STRINGS_H', 'strings.h'],
26ccd9
+  ['HAVE_STRING_H', 'string.h'],
26ccd9
+  ['HAVE_SYS_STAT_H', 'sys/stat.h'],
26ccd9
+  ['HAVE_SYS_TYPES_H', 'sys/types.h'],
26ccd9
+  ['HAVE_UNISTD_H', 'unistd.h'],
26ccd9
+]
26ccd9
+
26ccd9
+foreach h : check_headers
26ccd9
+  if cc.has_header(h.get(1))
26ccd9
+    conf.set(h.get(0), 1)
26ccd9
+  endif
26ccd9
+endforeach
26ccd9
+
26ccd9
+map_sync_symbols = [
26ccd9
+  [ 'signal.h', 'BUS_MCEERR_AR' ],
26ccd9
+  [ 'linux/mman.h', 'MAP_SHARED_VALIDATE' ],
26ccd9
+  [ 'linux/mman.h', 'MAP_SYNC' ],
26ccd9
+]
26ccd9
+
26ccd9
+count = 0
26ccd9
+foreach symbol : map_sync_symbols
26ccd9
+  if cc.has_header_symbol(symbol[0], symbol[1])
26ccd9
+    conf.set('HAVE_DECL_@0@'.format(symbol[1].to_upper()), 1)
26ccd9
+    count = count + 1
26ccd9
+  endif
26ccd9
+endforeach
26ccd9
+
26ccd9
+poison_enabled = false
26ccd9
+if get_option('poison').enabled() and count == 3
26ccd9
+  poison_enabled = true
26ccd9
+endif
26ccd9
+
26ccd9
+conf.set('ENABLE_POISON', poison_enabled)
26ccd9
+conf.set('ENABLE_KEYUTILS', get_option('keyutils').enabled())
26ccd9
+conf.set('ENABLE_TEST', get_option('test').enabled())
26ccd9
+conf.set('ENABLE_DESTRUCTIVE', get_option('destructive').enabled())
26ccd9
+conf.set('ENABLE_LOGGING', get_option('logging').enabled())
26ccd9
+conf.set('ENABLE_DEBUG', get_option('dbg').enabled())
26ccd9
+
26ccd9
+typeof = cc.run('''
26ccd9
+  int main() {
26ccd9
+    struct {
26ccd9
+      char a[16];
26ccd9
+    } x;
26ccd9
+    typeof(x) y;
26ccd9
+
26ccd9
+    return sizeof(x) == sizeof(y);
26ccd9
+  }
26ccd9
+  '''
26ccd9
+)
26ccd9
+
26ccd9
+if typeof.compiled() and typeof.returncode() == 1
26ccd9
+  conf.set('HAVE_TYPEOF', 1)
26ccd9
+  conf.set('HAVE_STATEMENT_EXPR', 1)
26ccd9
+endif
26ccd9
+
26ccd9
+if target_machine.endian() == 'big'
26ccd9
+  conf.set('HAVE_BIG_ENDIAN', 1)
26ccd9
+else
26ccd9
+  conf.set('HAVE_LITTLE_ENDIAN', 1)
26ccd9
+endif
26ccd9
+
26ccd9
+conf.set('_GNU_SOURCE', true)
26ccd9
+conf.set_quoted('PREFIX', get_option('prefix'))
26ccd9
+conf.set_quoted('NDCTL_MAN_PATH', get_option('mandir'))
26ccd9
+
26ccd9
+foreach ident : ['secure_getenv', '__secure_getenv']
26ccd9
+  conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
26ccd9
+endforeach
26ccd9
+
26ccd9
+
26ccd9
+ndctlconf_dir = sysconfdir / 'ndctl'
26ccd9
+ndctlconf = ndctlconf_dir / 'monitor.conf'
26ccd9
+conf.set_quoted('NDCTL_CONF_FILE', ndctlconf)
26ccd9
+conf.set_quoted('NDCTL_CONF_DIR', ndctlconf_dir)
26ccd9
+
26ccd9
+ndctlkeys_dir = sysconfdir / 'ndctl' / 'keys'
26ccd9
+conf.set_quoted('NDCTL_KEYS_DIR', ndctlkeys_dir)
26ccd9
+
26ccd9
+daxctlconf_dir = sysconfdir / 'daxctl.conf.d'
26ccd9
+daxctlconf = daxctlconf_dir / 'dax.conf'
26ccd9
+conf.set_quoted('DAXCTL_CONF_DIR', daxctlconf_dir)
26ccd9
+
26ccd9
+conf.set_quoted('DAXCTL_MODPROBE_DATA', datadir / 'daxctl/daxctl.conf')
26ccd9
+conf.set_quoted('DAXCTL_MODPROBE_INSTALL', sysconfdir / 'modprobe.d/daxctl.conf')
26ccd9
+
26ccd9
+config_h = configure_file(
26ccd9
+  input : 'config.h.meson',
26ccd9
+  output : 'config.h',
26ccd9
+  configuration : conf
26ccd9
+)
26ccd9
+add_project_arguments('-include', 'config.h', language : 'c')
26ccd9
+
26ccd9
+LIBNDCTL_CURRENT=25
26ccd9
+LIBNDCTL_REVISION=1
26ccd9
+LIBNDCTL_AGE=19
26ccd9
+
26ccd9
+LIBDAXCTL_CURRENT=6
26ccd9
+LIBDAXCTL_REVISION=0
26ccd9
+LIBDAXCTL_AGE=5
26ccd9
+
26ccd9
+LIBCXL_CURRENT=1
26ccd9
+LIBCXL_REVISION=0
26ccd9
+LIBCXL_AGE=0
26ccd9
+
26ccd9
+root_inc = include_directories(['.', 'ndctl', ])
26ccd9
+
26ccd9
+ccan = static_library('ccan',
26ccd9
+  [ 'ccan/str/str.c', 'ccan/list/list.c' ],
26ccd9
+)
26ccd9
+ccan_dep = declare_dependency(link_with : ccan)
26ccd9
+
26ccd9
+subdir('daxctl/lib')
26ccd9
+subdir('ndctl/lib')
26ccd9
+subdir('cxl/lib')
26ccd9
+subdir('util')
26ccd9
+subdir('ndctl')
26ccd9
+subdir('daxctl')
26ccd9
+subdir('cxl')
26ccd9
+if get_option('docs').enabled()
26ccd9
+  subdir('Documentation/ndctl')
26ccd9
+  subdir('Documentation/daxctl')
26ccd9
+  subdir('Documentation/cxl')
26ccd9
+endif
26ccd9
+subdir('test')
26ccd9
+subdir('contrib')
26ccd9
diff -up ndctl-71.1/meson_options.txt.orig ndctl-71.1/meson_options.txt
26ccd9
--- ndctl-71.1/meson_options.txt.orig	2022-10-07 17:29:51.575717669 -0400
26ccd9
+++ ndctl-71.1/meson_options.txt	2022-10-07 17:29:51.575717669 -0400
26ccd9
@@ -0,0 +1,25 @@
26ccd9
+option('version-tag', type : 'string',
26ccd9
+       description : 'override the git version string')
26ccd9
+option('docs', type : 'feature', value : 'enabled')
26ccd9
+option('asciidoctor', type : 'feature', value : 'disabled')
26ccd9
+option('systemd', type : 'feature', value : 'enabled')
26ccd9
+option('keyutils', type : 'feature', value : 'enabled',
26ccd9
+  description : 'enable nvdimm device passphrase management')
26ccd9
+option('test', type : 'feature', value : 'disabled',
26ccd9
+  description : 'enable shipping tests in ndctl')
26ccd9
+option('destructive', type : 'feature', value : 'disabled',
26ccd9
+  description : 'enable tests that may clobber live system resources')
26ccd9
+option('poison', type : 'feature', value : 'enabled',
26ccd9
+  description : 'enable tests that inject poison / memory-failure')
26ccd9
+option('logging', type : 'feature', value : 'enabled',
26ccd9
+  description : 'enable log infrastructure')
26ccd9
+option('dbg', type : 'feature', value : 'enabled',
26ccd9
+  description : 'enable dbg messages')
26ccd9
+option('rootprefix', type : 'string',
26ccd9
+       description : '''override the root prefix [default '/' if split-usr and '/usr' otherwise]''')
26ccd9
+option('rootlibdir', type : 'string',
26ccd9
+       description : '''[/usr]/lib/x86_64-linux-gnu or such''')
26ccd9
+option('pkgconfiglibdir', type : 'string', value : '',
26ccd9
+       description : 'directory for standard pkg-config files')
26ccd9
+option('bashcompletiondir', type : 'string',
26ccd9
+       description : '''${datadir}/bash-completion/completions''')
26ccd9
diff -up ndctl-71.1/ndctl/lib/meson.build.orig ndctl-71.1/ndctl/lib/meson.build
26ccd9
--- ndctl-71.1/ndctl/lib/meson.build.orig	2022-10-07 17:29:51.576717672 -0400
26ccd9
+++ ndctl-71.1/ndctl/lib/meson.build	2022-10-07 17:29:51.576717672 -0400
26ccd9
@@ -0,0 +1,48 @@
26ccd9
+libndctl_version = '@0@.@1@.@2@'.format(
26ccd9
+  LIBNDCTL_CURRENT - LIBNDCTL_AGE,
26ccd9
+  LIBNDCTL_REVISION,
26ccd9
+  LIBNDCTL_AGE)
26ccd9
+
26ccd9
+mapfile = files('libndctl.sym')
26ccd9
+vflag = '-Wl,--version-script,@0@/@1@'.format(project_source_root, mapfile[0])
26ccd9
+
26ccd9
+ndctl = library(
26ccd9
+ 'ndctl',
26ccd9
+  '../../util/log.c',
26ccd9
+  '../../util/sysfs.c',
26ccd9
+  'dimm.c',
26ccd9
+  'inject.c',
26ccd9
+  'nfit.c',
26ccd9
+  'smart.c',
26ccd9
+  'intel.c',
26ccd9
+  'hpe1.c',
26ccd9
+  'msft.c',
26ccd9
+  'hyperv.c',
26ccd9
+  'papr.c',
26ccd9
+  'ars.c',
26ccd9
+  'firmware.c',
26ccd9
+  'libndctl.c',
26ccd9
+  dependencies : [
26ccd9
+    daxctl_dep,
26ccd9
+    libudev,
26ccd9
+    uuid,
26ccd9
+    kmod,
26ccd9
+  ],
26ccd9
+  include_directories : root_inc,
26ccd9
+  version : libndctl_version,
26ccd9
+  install : true,
26ccd9
+  install_dir : rootlibdir,
26ccd9
+  link_args : vflag,
26ccd9
+  link_depends : mapfile,
26ccd9
+)
26ccd9
+ndctl_dep = declare_dependency(link_with : ndctl)
26ccd9
+
26ccd9
+custom_target(
26ccd9
+  'libndctl.pc',
26ccd9
+  command : pkgconfig_script + [ '@INPUT@' ],
26ccd9
+  input : 'libndctl.pc.in',
26ccd9
+  output : 'libndctl.pc',
26ccd9
+  capture : true,
26ccd9
+  install : true,
26ccd9
+  install_dir : pkgconfiglibdir,
26ccd9
+)
26ccd9
diff -up ndctl-71.1/ndctl/meson.build.orig ndctl-71.1/ndctl/meson.build
26ccd9
--- ndctl-71.1/ndctl/meson.build.orig	2022-10-07 17:29:51.576717672 -0400
26ccd9
+++ ndctl-71.1/ndctl/meson.build	2022-10-07 17:29:51.576717672 -0400
26ccd9
@@ -0,0 +1,80 @@
26ccd9
+ndctl_src = [
26ccd9
+  'ndctl.c',
26ccd9
+  'bus.c',
26ccd9
+  'create-nfit.c',
26ccd9
+  'namespace.c',
26ccd9
+  'check.c',
26ccd9
+  'region.c',
26ccd9
+  'dimm.c',
26ccd9
+  '../util/log.c',
26ccd9
+  '../daxctl/filter.c',
26ccd9
+  'filter.c',
26ccd9
+  'list.c',
26ccd9
+  '../util/json.c',
26ccd9
+  '../daxctl/json.c',
26ccd9
+  'json.c',
26ccd9
+  'json-smart.c',
26ccd9
+  'inject-error.c',
26ccd9
+  'inject-smart.c',
26ccd9
+  'monitor.c',
26ccd9
+]
26ccd9
+
26ccd9
+deps = [
26ccd9
+  util_dep,
26ccd9
+  ndctl_dep,
26ccd9
+  daxctl_dep,
26ccd9
+  cxl_dep,
26ccd9
+  uuid,
26ccd9
+  kmod,
26ccd9
+  json,
26ccd9
+  versiondep,
26ccd9
+]
26ccd9
+
26ccd9
+if get_option('keyutils').enabled()
26ccd9
+  ndctl_src += [
26ccd9
+    'keys.c',
26ccd9
+    'load-keys.c',
26ccd9
+  ]
26ccd9
+  deps += keyutils
26ccd9
+endif
26ccd9
+
26ccd9
+if get_option('test').enabled()
26ccd9
+  ndctl_src += [
26ccd9
+  '../test/libndctl.c',
26ccd9
+  '../test/dsm-fail.c',
26ccd9
+  '../util/sysfs.c',
26ccd9
+  '../test/core.c',
26ccd9
+  'test.c',
26ccd9
+]
26ccd9
+endif
26ccd9
+
26ccd9
+if get_option('destructive').enabled()
26ccd9
+  if get_option('test').disabled()
26ccd9
+    error('\'-D=destructive=enabled\' requires \'-Dtest=enabled\'\n')
26ccd9
+  endif
26ccd9
+  ndctl_src += [
26ccd9
+    '../test/pmem_namespaces.c',
26ccd9
+    'bat.c',
26ccd9
+  ]
26ccd9
+endif
26ccd9
+
26ccd9
+if get_option('systemd').enabled()
26ccd9
+  install_data('ndctl-monitor.service', install_dir : systemdunitdir)
26ccd9
+endif
26ccd9
+install_data('monitor.conf', install_dir : ndctlconf_dir)
26ccd9
+install_data('keys.readme', install_dir : ndctlkeys_dir)
26ccd9
+
26ccd9
+ndctl_tool = executable('ndctl', ndctl_src,
26ccd9
+  dependencies : deps,
26ccd9
+  install : true,
26ccd9
+  install_dir : rootbindir,
26ccd9
+  include_directories : root_inc,
26ccd9
+)
26ccd9
+
26ccd9
+install_headers(
26ccd9
+  [
26ccd9
+    'libndctl.h',
26ccd9
+    'ndctl.h'
26ccd9
+  ],
26ccd9
+  subdir : 'ndctl'
26ccd9
+)
26ccd9
diff -up ndctl-71.1/test/meson.build.orig ndctl-71.1/test/meson.build
26ccd9
--- ndctl-71.1/test/meson.build.orig	2022-10-07 17:29:51.577717675 -0400
26ccd9
+++ ndctl-71.1/test/meson.build	2022-10-07 17:29:51.577717675 -0400
26ccd9
@@ -0,0 +1,237 @@
26ccd9
+testcore = [
26ccd9
+  'core.c',
26ccd9
+  '../util/log.c',
26ccd9
+  '../util/sysfs.c',
26ccd9
+]
26ccd9
+
26ccd9
+libndctl_deps = [
26ccd9
+  ndctl_dep,
26ccd9
+  daxctl_dep,
26ccd9
+  uuid,
26ccd9
+  kmod,
26ccd9
+]
26ccd9
+
26ccd9
+ndctl_deps = libndctl_deps + [
26ccd9
+  json,
26ccd9
+  util_dep,
26ccd9
+  versiondep,
26ccd9
+]
26ccd9
+
26ccd9
+libndctl = executable('libndctl', testcore + [ 'libndctl.c'],
26ccd9
+  dependencies : libndctl_deps,
26ccd9
+  include_directories : root_inc,
26ccd9
+)
26ccd9
+
26ccd9
+namespace_core = [
26ccd9
+  '../ndctl/namespace.c',
26ccd9
+  '../ndctl/filter.c',
26ccd9
+  '../ndctl/check.c',
26ccd9
+  '../util/json.c',
26ccd9
+  '../ndctl/json.c',
26ccd9
+  '../daxctl/filter.c',
26ccd9
+  '../daxctl/json.c',
26ccd9
+]
26ccd9
+
26ccd9
+dsm_fail = executable('dsm-fail', testcore + namespace_core + [ 'dsm-fail.c' ],
26ccd9
+  dependencies : ndctl_deps,
26ccd9
+  include_directories : root_inc,
26ccd9
+)
26ccd9
+
26ccd9
+hugetlb_src = testcore + [ 'hugetlb.c', 'dax-pmd.c' ]
26ccd9
+if poison_enabled
26ccd9
+  hugetlb_src += [ 'dax-poison.c' ]
26ccd9
+endif
26ccd9
+hugetlb = executable('hugetlb', hugetlb_src,
26ccd9
+  dependencies : libndctl_deps,
26ccd9
+  include_directories : root_inc,
26ccd9
+)
26ccd9
+
26ccd9
+ack_shutdown_count = executable('ack-shutdown-count-set',
26ccd9
+  testcore + [ 'ack-shutdown-count-set.c' ],
26ccd9
+  dependencies : libndctl_deps,
26ccd9
+  include_directories : root_inc,
26ccd9
+)
26ccd9
+
26ccd9
+dax_errors = executable('dax-errors',
26ccd9
+  'dax-errors.c',
26ccd9
+)
26ccd9
+
26ccd9
+smart_notify = executable('smart-notify', 'smart-notify.c',
26ccd9
+  dependencies : libndctl_deps,
26ccd9
+  include_directories : root_inc,
26ccd9
+)
26ccd9
+
26ccd9
+smart_listen = executable('smart-listen', 'smart-listen.c',
26ccd9
+  dependencies : libndctl_deps,
26ccd9
+  include_directories : root_inc,
26ccd9
+)
26ccd9
+
26ccd9
+daxdev_errors = executable('daxdev-errors', [
26ccd9
+    'daxdev-errors.c',
26ccd9
+    '../util/log.c',
26ccd9
+    '../util/sysfs.c',
26ccd9
+  ],
26ccd9
+  dependencies : libndctl_deps,
26ccd9
+  include_directories : root_inc,
26ccd9
+)
26ccd9
+
26ccd9
+list_smart_dimm = executable('list-smart-dimm', [
26ccd9
+    'list-smart-dimm.c',
26ccd9
+    '../ndctl/filter.c',
26ccd9
+    '../util/json.c',
26ccd9
+    '../ndctl/json.c',
26ccd9
+    '../daxctl/json.c',
26ccd9
+    '../daxctl/filter.c',
26ccd9
+  ],
26ccd9
+  dependencies : ndctl_deps,
26ccd9
+  include_directories : root_inc,
26ccd9
+)
26ccd9
+
26ccd9
+pmem_ns = executable('pmem-ns', testcore + [ 'pmem_namespaces.c' ],
26ccd9
+  dependencies : libndctl_deps,
26ccd9
+  include_directories : root_inc,
26ccd9
+)
26ccd9
+
26ccd9
+dax_dev = executable('dax-dev', testcore + [ 'dax-dev.c' ],
26ccd9
+  dependencies : libndctl_deps,
26ccd9
+  include_directories : root_inc,
26ccd9
+)
26ccd9
+
26ccd9
+dax_pmd_src = testcore + [ 'dax-pmd.c' ]
26ccd9
+if poison_enabled
26ccd9
+  dax_pmd_src += [ 'dax-poison.c' ]
26ccd9
+endif
26ccd9
+
26ccd9
+dax_pmd = executable('dax-pmd', dax_pmd_src,
26ccd9
+  dependencies : libndctl_deps,
26ccd9
+  include_directories : root_inc,
26ccd9
+)
26ccd9
+
26ccd9
+device_dax_src = testcore + namespace_core + [
26ccd9
+  'device-dax.c',
26ccd9
+  'dax-dev.c',
26ccd9
+  'dax-pmd.c',
26ccd9
+]
26ccd9
+
26ccd9
+if poison_enabled
26ccd9
+  device_dax_src += 'dax-poison.c'
26ccd9
+endif
26ccd9
+
26ccd9
+device_dax = executable('device-dax', device_dax_src,
26ccd9
+  dependencies : ndctl_deps,
26ccd9
+  include_directories : root_inc,
26ccd9
+)
26ccd9
+
26ccd9
+revoke_devmem = executable('revoke_devmem', testcore + [
26ccd9
+    'revoke-devmem.c',
26ccd9
+    'dax-dev.c',
26ccd9
+  ],
26ccd9
+  dependencies : libndctl_deps,
26ccd9
+  include_directories : root_inc,
26ccd9
+)
26ccd9
+
26ccd9
+mmap = executable('mmap', 'mmap.c',)
26ccd9
+
26ccd9
+create = find_program('create.sh')
26ccd9
+clear = find_program('clear.sh')
26ccd9
+pmem_errors = find_program('pmem-errors.sh')
26ccd9
+daxdev_errors_sh = find_program('daxdev-errors.sh')
26ccd9
+multi_dax = find_program('multi-dax.sh')
26ccd9
+btt_check = find_program('btt-check.sh')
26ccd9
+label_compat = find_program('label-compat.sh')
26ccd9
+sector_mode = find_program('sector-mode.sh')
26ccd9
+inject_error = find_program('inject-error.sh')
26ccd9
+btt_errors = find_program('btt-errors.sh')
26ccd9
+btt_pad_compat = find_program('btt-pad-compat.sh')
26ccd9
+firmware_update = find_program('firmware-update.sh')
26ccd9
+rescan_partitions = find_program('rescan-partitions.sh')
26ccd9
+inject_smart = find_program('inject-smart.sh')
26ccd9
+monitor = find_program('monitor.sh')
26ccd9
+max_extent = find_program('max_available_extent_ns.sh')
26ccd9
+pfn_meta_errors = find_program('pfn-meta-errors.sh')
26ccd9
+track_uuid = find_program('track-uuid.sh')
26ccd9
+
26ccd9
+tests = [
26ccd9
+  [ 'libndctl',               libndctl ],
26ccd9
+  [ 'dsm-fail',               dsm_fail ],
26ccd9
+  [ 'create.sh',              create ],
26ccd9
+  [ 'clear.sh',               clear ],
26ccd9
+  [ 'pmem-errors.sh',         pmem_errors ],
26ccd9
+  [ 'daxdev-errors.sh',       daxdev_errors_sh ],
26ccd9
+  [ 'multi-dax.sh',           multi_dax ],
26ccd9
+  [ 'btt-check.sh',           btt_check ],
26ccd9
+  [ 'label-compat.sh',        label_compat ],
26ccd9
+  [ 'sector-mode.sh',         sector_mode ],
26ccd9
+  [ 'inject-error.sh',        inject_error ],
26ccd9
+  [ 'btt-errors.sh',          btt_errors ],
26ccd9
+  [ 'hugetlb',                hugetlb ],
26ccd9
+  [ 'btt-pad-compat.sh',      btt_pad_compat ],
26ccd9
+  [ 'firmware-update.sh',     firmware_update ],
26ccd9
+  [ 'ack-shutdown-count-set', ack_shutdown_count ],
26ccd9
+  [ 'rescan-partitions.sh',   rescan_partitions ],
26ccd9
+  [ 'inject-smart.sh',        inject_smart ],
26ccd9
+  [ 'monitor.sh',             monitor ],
26ccd9
+  [ 'max_extent_ns',          max_extent ],
26ccd9
+  [ 'pfn-meta-errors.sh',     pfn_meta_errors ],
26ccd9
+  [ 'track-uuid.sh',          track_uuid ],
26ccd9
+]
26ccd9
+
26ccd9
+if get_option('destructive').enabled()
26ccd9
+  sub_section = find_program('sub-section.sh')
26ccd9
+  dax_ext4 = find_program('dax-ext4.sh')
26ccd9
+  dax_xfs = find_program('dax-xfs.sh')
26ccd9
+  align = find_program('align.sh')
26ccd9
+  device_dax_fio = find_program('device-dax-fio.sh')
26ccd9
+  daxctl_devices = find_program('daxctl-devices.sh')
26ccd9
+  daxctl_create = find_program('daxctl-create.sh')
26ccd9
+  dm = find_program('dm.sh')
26ccd9
+  mmap_test = find_program('mmap.sh')
26ccd9
+
26ccd9
+  tests += [
26ccd9
+    [ 'pmem-ns',           pmem_ns ],
26ccd9
+    [ 'sub-section.sh',    sub_section ],
26ccd9
+    [ 'dax-dev',           dax_dev ],
26ccd9
+    [ 'dax-ext4.sh',       dax_ext4 ],
26ccd9
+    [ 'dax-xfs.sh',        dax_xfs ],
26ccd9
+    [ 'align.sh',          align ],
26ccd9
+    [ 'device-dax',        device_dax ],
26ccd9
+    [ 'revoke-devmem',     revoke_devmem ],
26ccd9
+    [ 'device-dax-fio.sh', device_dax_fio ],
26ccd9
+    [ 'daxctl-devices.sh', daxctl_devices ],
26ccd9
+    [ 'daxctl-create.sh',  daxctl_create ],
26ccd9
+    [ 'dm.sh',             dm ],
26ccd9
+    [ 'mmap.sh',           mmap_test ],
26ccd9
+  ]
26ccd9
+endif
26ccd9
+
26ccd9
+if get_option('keyutils').enabled()
26ccd9
+  security = find_program('security.sh')
26ccd9
+  tests += [
26ccd9
+    [ 'security.sh', security ]
26ccd9
+  ]
26ccd9
+endif
26ccd9
+
26ccd9
+foreach t : tests
26ccd9
+  test(t[0], t[1],
26ccd9
+    is_parallel : false,
26ccd9
+    depends : [
26ccd9
+      ndctl_tool,
26ccd9
+      daxctl_tool,
26ccd9
+      cxl_tool,
26ccd9
+      smart_notify,
26ccd9
+      list_smart_dimm,
26ccd9
+      dax_pmd,
26ccd9
+      dax_errors,
26ccd9
+      daxdev_errors,
26ccd9
+      dax_dev,
26ccd9
+      mmap,
26ccd9
+    ],
26ccd9
+    timeout : 0,
26ccd9
+    env : [
26ccd9
+      'NDCTL=@0@'.format(ndctl_tool.full_path()),
26ccd9
+      'DAXCTL=@0@'.format(daxctl_tool.full_path()),
26ccd9
+      'TEST_PATH=@0@'.format(meson.current_build_dir()),
26ccd9
+      'DATA_PATH=@0@'.format(meson.current_source_dir()),
26ccd9
+    ],
26ccd9
+  )
26ccd9
+endforeach
26ccd9
diff -up ndctl-71.1/tools/meson-vcs-tag.sh.orig ndctl-71.1/tools/meson-vcs-tag.sh
26ccd9
--- ndctl-71.1/tools/meson-vcs-tag.sh.orig	2022-10-07 17:29:51.577717675 -0400
26ccd9
+++ ndctl-71.1/tools/meson-vcs-tag.sh	2022-10-07 17:29:51.577717675 -0400
26ccd9
@@ -0,0 +1,18 @@
26ccd9
+#!/usr/bin/env bash
26ccd9
+# SPDX-License-Identifier: LGPL-2.1-or-later
26ccd9
+
26ccd9
+set -eu
26ccd9
+set -o pipefail
26ccd9
+
26ccd9
+dir="${1:?}"
26ccd9
+fallback="${2:?}"
26ccd9
+
26ccd9
+# Apparently git describe has a bug where it always considers the work-tree
26ccd9
+# dirty when invoked with --git-dir (even though 'git status' is happy). Work
26ccd9
+# around this issue by cd-ing to the source directory.
26ccd9
+cd "$dir"
26ccd9
+# Check that we have either .git/ (a normal clone) or a .git file (a work-tree)
26ccd9
+# and that we don't get confused if a tarball is extracted in a higher-level
26ccd9
+# git repository.
26ccd9
+[ -e .git ] && git describe --abbrev=7 --dirty=+ 2>/dev/null | \
26ccd9
+	sed -e 's/^v//' -e 's/-/./g' || echo "$fallback"
26ccd9
diff -up ndctl-71.1/util/meson.build.orig ndctl-71.1/util/meson.build
26ccd9
--- ndctl-71.1/util/meson.build.orig	2022-10-07 17:29:51.578717679 -0400
26ccd9
+++ ndctl-71.1/util/meson.build	2022-10-07 17:29:51.578717679 -0400
26ccd9
@@ -0,0 +1,15 @@
26ccd9
+util = static_library('util', [
26ccd9
+  'parse-options.c',
26ccd9
+  'usage.c',
26ccd9
+  'size.c',
26ccd9
+  'main.c',
26ccd9
+  'help.c',
26ccd9
+  'strbuf.c',
26ccd9
+  'wrapper.c',
26ccd9
+  'bitmap.c',
26ccd9
+  'abspath.c',
26ccd9
+  'iomem.c',
26ccd9
+  ],
26ccd9
+  include_directories : root_inc,
26ccd9
+)
26ccd9
+util_dep = declare_dependency(link_with : util)
26ccd9
diff -up ndctl-71.1/version.h.in.orig ndctl-71.1/version.h.in
26ccd9
--- ndctl-71.1/version.h.in.orig	2022-10-07 17:29:51.578717679 -0400
26ccd9
+++ ndctl-71.1/version.h.in	2022-10-07 17:29:51.578717679 -0400
26ccd9
@@ -0,0 +1,2 @@
26ccd9
+/* SPDX-License-Identifier: LGPL-2.1 */
26ccd9
+#define VERSION "@VCS_TAG@"