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

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