anitazha / rpms / ndctl

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