|
|
2eb93d |
From 8b5b941093521dd18fcc99659b3e3b1b9e9456b7 Mon Sep 17 00:00:00 2001
|
|
|
2eb93d |
From: Dan Williams <dan.j.williams@intel.com>
|
|
|
2eb93d |
Date: Wed, 5 Jan 2022 13:32:58 -0800
|
|
|
2eb93d |
Subject: [PATCH 083/217] build: Add meson rpmbuild support
|
|
|
2eb93d |
|
|
|
2eb93d |
Beyond being a prerequisite for removing autotools support, this capability
|
|
|
2eb93d |
served as validation that the meson conversion generated all the same files
|
|
|
2eb93d |
as autotools and installed them to the same expected locations.
|
|
|
2eb93d |
|
|
|
2eb93d |
The procedure to use the rpmbuild.sh script is:
|
|
|
2eb93d |
|
|
|
2eb93d |
meson setup build
|
|
|
2eb93d |
meson compile -C build rhel/ndctl.spec
|
|
|
2eb93d |
./rpmbuild.sh build/rhel/ndctl.spec
|
|
|
2eb93d |
|
|
|
2eb93d |
Link: https://lore.kernel.org/r/164141837841.3990253.11379060834465142446.stgit@dwillia2-desk3.amr.corp.intel.com
|
|
|
2eb93d |
Tested-by: Alison Schofield <alison.schofield@intel.com>
|
|
|
2eb93d |
Tested-by: Vaibhav Jain <vaibhav@linux.ibm.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 | 2 +-
|
|
|
2eb93d |
Makefile.am | 2 ++
|
|
|
2eb93d |
meson.build | 6 ++++++
|
|
|
2eb93d |
ndctl.spec.in | 23 +++++++++++++++++++++++
|
|
|
2eb93d |
rhel/meson.build | 23 +++++++++++++++++++++++
|
|
|
2eb93d |
rpmbuild.sh | 5 ++++-
|
|
|
2eb93d |
sles/meson.build | 36 ++++++++++++++++++++++++++++++++++++
|
|
|
2eb93d |
7 files changed, 95 insertions(+), 2 deletions(-)
|
|
|
2eb93d |
create mode 100644 rhel/meson.build
|
|
|
2eb93d |
create mode 100644 sles/meson.build
|
|
|
2eb93d |
|
|
|
2eb93d |
diff -up ndctl-71.1/.gitignore.orig ndctl-71.1/.gitignore
|
|
|
2eb93d |
--- ndctl-71.1/.gitignore.orig 2022-10-07 16:34:40.712445112 -0400
|
|
|
2eb93d |
+++ ndctl-71.1/.gitignore 2022-10-07 16:34:52.832486377 -0400
|
|
|
2eb93d |
@@ -35,7 +35,7 @@ daxctl/lib/libdaxctl.pc
|
|
|
2eb93d |
ndctl/config.h
|
|
|
2eb93d |
ndctl/lib/libndctl.pc
|
|
|
2eb93d |
ndctl/ndctl
|
|
|
2eb93d |
-rhel/
|
|
|
2eb93d |
+rhel/ndctl.spec
|
|
|
2eb93d |
sles/ndctl.spec
|
|
|
2eb93d |
version.m4
|
|
|
2eb93d |
*.swp
|
|
|
2eb93d |
diff -up ndctl-71.1/Makefile.am.orig ndctl-71.1/Makefile.am
|
|
|
2eb93d |
--- ndctl-71.1/Makefile.am.orig 2022-10-07 16:34:40.687445027 -0400
|
|
|
2eb93d |
+++ ndctl-71.1/Makefile.am 2022-10-07 16:34:52.832486377 -0400
|
|
|
2eb93d |
@@ -22,6 +22,7 @@ noinst_SCRIPTS = rhel/ndctl.spec sles/nd
|
|
|
2eb93d |
CLEANFILES += $(noinst_SCRIPTS)
|
|
|
2eb93d |
|
|
|
2eb93d |
do_rhel_subst = sed -e 's,VERSION,$(VERSION),g' \
|
|
|
2eb93d |
+ -e 's,MESON,0,g' \
|
|
|
2eb93d |
-e 's,DAX_DNAME,daxctl-devel,g' \
|
|
|
2eb93d |
-e 's,CXL_DNAME,cxl-devel,g' \
|
|
|
2eb93d |
-e 's,DNAME,ndctl-devel,g' \
|
|
|
2eb93d |
@@ -31,6 +32,7 @@ do_rhel_subst = sed -e 's,VERSION,$(VERS
|
|
|
2eb93d |
-e 's,LNAME,ndctl-libs,g'
|
|
|
2eb93d |
|
|
|
2eb93d |
do_sles_subst = sed -e 's,VERSION,$(VERSION),g' \
|
|
|
2eb93d |
+ -e 's,MESON,0,g' \
|
|
|
2eb93d |
-e 's,DAX_DNAME,libdaxctl-devel,g' \
|
|
|
2eb93d |
-e 's,CXL_DNAME,libcxl-devel,g' \
|
|
|
2eb93d |
-e 's,DNAME,libndctl-devel,g' \
|
|
|
2eb93d |
diff -up ndctl-71.1/meson.build.orig ndctl-71.1/meson.build
|
|
|
2eb93d |
--- ndctl-71.1/meson.build.orig 2022-10-07 16:34:40.715445122 -0400
|
|
|
2eb93d |
+++ ndctl-71.1/meson.build 2022-10-07 16:34:52.833486380 -0400
|
|
|
2eb93d |
@@ -278,3 +278,9 @@ if get_option('docs').enabled()
|
|
|
2eb93d |
endif
|
|
|
2eb93d |
subdir('test')
|
|
|
2eb93d |
subdir('contrib')
|
|
|
2eb93d |
+
|
|
|
2eb93d |
+# only support spec file generation from git builds
|
|
|
2eb93d |
+if version_tag == ''
|
|
|
2eb93d |
+ subdir('rhel')
|
|
|
2eb93d |
+ subdir('sles')
|
|
|
2eb93d |
+endif
|
|
|
2eb93d |
diff -up ndctl-71.1/ndctl.spec.in.orig ndctl-71.1/ndctl.spec.in
|
|
|
2eb93d |
--- ndctl-71.1/ndctl.spec.in.orig 2022-10-07 16:34:40.645444884 -0400
|
|
|
2eb93d |
+++ ndctl-71.1/ndctl.spec.in 2022-10-07 16:34:52.833486380 -0400
|
|
|
2eb93d |
@@ -6,14 +6,20 @@ License: GPLv2
|
|
|
2eb93d |
Url: https://github.com/pmem/ndctl
|
|
|
2eb93d |
Source0: https://github.com/pmem/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
|
|
2eb93d |
|
|
|
2eb93d |
+%define with_meson MESON
|
|
|
2eb93d |
Requires: LNAME%{?_isa} = %{version}-%{release}
|
|
|
2eb93d |
Requires: DAX_LNAME%{?_isa} = %{version}-%{release}
|
|
|
2eb93d |
Requires: CXL_LNAME%{?_isa} = %{version}-%{release}
|
|
|
2eb93d |
BuildRequires: autoconf
|
|
|
2eb93d |
%if 0%{?rhel} < 9
|
|
|
2eb93d |
BuildRequires: asciidoc
|
|
|
2eb93d |
+%if !%{with_meson}
|
|
|
2eb93d |
%define asciidoc --disable-asciidoctor
|
|
|
2eb93d |
+%endif
|
|
|
2eb93d |
%else
|
|
|
2eb93d |
+%if %{with_meson}
|
|
|
2eb93d |
+%define asciidoctor -Dasciidoctor=enabled
|
|
|
2eb93d |
+%endif
|
|
|
2eb93d |
BuildRequires: rubygem-asciidoctor
|
|
|
2eb93d |
%endif
|
|
|
2eb93d |
BuildRequires: xmlto
|
|
|
2eb93d |
@@ -28,6 +34,10 @@ BuildRequires: pkgconfig(bash-completion
|
|
|
2eb93d |
BuildRequires: pkgconfig(systemd)
|
|
|
2eb93d |
BuildRequires: keyutils-libs-devel
|
|
|
2eb93d |
|
|
|
2eb93d |
+%if %{with_meson}
|
|
|
2eb93d |
+BuildRequires: meson
|
|
|
2eb93d |
+%endif
|
|
|
2eb93d |
+
|
|
|
2eb93d |
%description
|
|
|
2eb93d |
Utility library for managing the "libnvdimm" subsystem. The "libnvdimm"
|
|
|
2eb93d |
subsystem defines a kernel device model and control message interface for
|
|
|
2eb93d |
@@ -115,17 +125,30 @@ libcxl is a library for enumerating and
|
|
|
2eb93d |
%setup -q ndctl-%{version}
|
|
|
2eb93d |
|
|
|
2eb93d |
%build
|
|
|
2eb93d |
+%if %{with_meson}
|
|
|
2eb93d |
+%meson %{?asciidoctor} -Dversion-tag=%{version}
|
|
|
2eb93d |
+%meson_build
|
|
|
2eb93d |
+%else
|
|
|
2eb93d |
echo %{version} > version
|
|
|
2eb93d |
./autogen.sh
|
|
|
2eb93d |
%configure --disable-static --disable-silent-rules %{?asciidoc}
|
|
|
2eb93d |
make %{?_smp_mflags}
|
|
|
2eb93d |
+%endif
|
|
|
2eb93d |
|
|
|
2eb93d |
%install
|
|
|
2eb93d |
+%if %{with_meson}
|
|
|
2eb93d |
+%meson_install
|
|
|
2eb93d |
+%else
|
|
|
2eb93d |
%make_install
|
|
|
2eb93d |
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
|
|
|
2eb93d |
+%endif
|
|
|
2eb93d |
|
|
|
2eb93d |
%check
|
|
|
2eb93d |
+%if %{with_meson}
|
|
|
2eb93d |
+%meson_test
|
|
|
2eb93d |
+%else
|
|
|
2eb93d |
make check
|
|
|
2eb93d |
+%endif
|
|
|
2eb93d |
|
|
|
2eb93d |
%ldconfig_scriptlets -n LNAME
|
|
|
2eb93d |
|
|
|
2eb93d |
diff -up ndctl-71.1/rhel/meson.build.orig ndctl-71.1/rhel/meson.build
|
|
|
2eb93d |
--- ndctl-71.1/rhel/meson.build.orig 2022-10-07 16:34:52.834486384 -0400
|
|
|
2eb93d |
+++ ndctl-71.1/rhel/meson.build 2022-10-07 16:34:52.834486384 -0400
|
|
|
2eb93d |
@@ -0,0 +1,23 @@
|
|
|
2eb93d |
+rhel_spec1 = vcs_tag(
|
|
|
2eb93d |
+ input : '../ndctl.spec.in',
|
|
|
2eb93d |
+ output : 'ndctl.spec.in',
|
|
|
2eb93d |
+ command: vcs_tagger,
|
|
|
2eb93d |
+ replace_string : 'VERSION',
|
|
|
2eb93d |
+)
|
|
|
2eb93d |
+
|
|
|
2eb93d |
+rhel_spec2 = custom_target('ndctl.spec',
|
|
|
2eb93d |
+ command : [
|
|
|
2eb93d |
+ 'sed', '-e', 's,MESON,1,g',
|
|
|
2eb93d |
+ '-e', 's,DAX_DNAME,daxctl-devel,g',
|
|
|
2eb93d |
+ '-e', 's,CXL_DNAME,cxl-devel,g',
|
|
|
2eb93d |
+ '-e', 's,DNAME,ndctl-devel,g',
|
|
|
2eb93d |
+ '-e', '/^%defattr.*/d',
|
|
|
2eb93d |
+ '-e', 's,DAX_LNAME,daxctl-libs,g',
|
|
|
2eb93d |
+ '-e', 's,CXL_LNAME,cxl-libs,g',
|
|
|
2eb93d |
+ '-e', 's,LNAME,ndctl-libs,g',
|
|
|
2eb93d |
+ '@INPUT@'
|
|
|
2eb93d |
+ ],
|
|
|
2eb93d |
+ input : rhel_spec1,
|
|
|
2eb93d |
+ output : 'ndctl.spec',
|
|
|
2eb93d |
+ capture : true,
|
|
|
2eb93d |
+)
|
|
|
2eb93d |
diff -up ndctl-71.1/rpmbuild.sh.orig ndctl-71.1/rpmbuild.sh
|
|
|
2eb93d |
--- ndctl-71.1/rpmbuild.sh.orig 2020-12-22 16:44:57.000000000 -0500
|
|
|
2eb93d |
+++ ndctl-71.1/rpmbuild.sh 2022-10-07 16:34:52.834486384 -0400
|
|
|
2eb93d |
@@ -1,6 +1,9 @@
|
|
|
2eb93d |
#!/bin/bash
|
|
|
2eb93d |
+
|
|
|
2eb93d |
+spec=${1:-$(dirname $0)/rhel/ndctl.spec)}
|
|
|
2eb93d |
+
|
|
|
2eb93d |
pushd $(dirname $0) >/dev/null
|
|
|
2eb93d |
[ ! -d ~/rpmbuild/SOURCES ] && echo "rpmdev tree not found" && exit 1
|
|
|
2eb93d |
./make-git-snapshot.sh
|
|
|
2eb93d |
popd > /dev/null
|
|
|
2eb93d |
-rpmbuild -ba $(dirname $0)/rhel/ndctl.spec
|
|
|
2eb93d |
+rpmbuild --nocheck -ba $spec
|
|
|
2eb93d |
diff -up ndctl-71.1/sles/meson.build.orig ndctl-71.1/sles/meson.build
|
|
|
2eb93d |
--- ndctl-71.1/sles/meson.build.orig 2022-10-07 16:34:52.836486391 -0400
|
|
|
2eb93d |
+++ ndctl-71.1/sles/meson.build 2022-10-07 16:34:52.835486387 -0400
|
|
|
2eb93d |
@@ -0,0 +1,36 @@
|
|
|
2eb93d |
+sles_spec1 = vcs_tag(
|
|
|
2eb93d |
+ input : '../ndctl.spec.in',
|
|
|
2eb93d |
+ output : 'ndctl.spec.sles.in',
|
|
|
2eb93d |
+ command: vcs_tagger,
|
|
|
2eb93d |
+ replace_string : 'VERSION',
|
|
|
2eb93d |
+)
|
|
|
2eb93d |
+
|
|
|
2eb93d |
+header = files('header')
|
|
|
2eb93d |
+
|
|
|
2eb93d |
+sles_spec2 = custom_target('ndctl.spec.in',
|
|
|
2eb93d |
+ command : [
|
|
|
2eb93d |
+ 'cat', header, '@INPUT@',
|
|
|
2eb93d |
+ ],
|
|
|
2eb93d |
+ input : sles_spec1,
|
|
|
2eb93d |
+ output : 'ndctl.spec.in',
|
|
|
2eb93d |
+ capture : true,
|
|
|
2eb93d |
+)
|
|
|
2eb93d |
+
|
|
|
2eb93d |
+sles_spec3 = custom_target('ndctl.spec',
|
|
|
2eb93d |
+ command : [
|
|
|
2eb93d |
+ 'sed', '-e', 's,MESON,1,g',
|
|
|
2eb93d |
+ '-e', 's,DAX_DNAME,libdaxctl-devel,g',
|
|
|
2eb93d |
+ '-e', 's,CXL_DNAME,libcxl-devel,g',
|
|
|
2eb93d |
+ '-e', 's,DNAME,libndctl-devel,g',
|
|
|
2eb93d |
+ '-e', 's,%license,%doc,g',
|
|
|
2eb93d |
+ '-e', 's,\(^License:.*GPL\)v2,\1-2.0,g',
|
|
|
2eb93d |
+ '-e', 's,DAX_LNAME,libdaxctl@0@,g'.format(LIBDAXCTL_CURRENT - LIBDAXCTL_AGE),
|
|
|
2eb93d |
+ '-e', 's,CXL_LNAME,libcxl@0@,g'.format(LIBCXL_CURRENT - LIBCXL_AGE),
|
|
|
2eb93d |
+ '-e', 's,LNAME,libndctl@0@,g'.format(LIBNDCTL_CURRENT - LIBNDCTL_AGE),
|
|
|
2eb93d |
+ '@INPUT@'
|
|
|
2eb93d |
+ ],
|
|
|
2eb93d |
+
|
|
|
2eb93d |
+ input : sles_spec2,
|
|
|
2eb93d |
+ output : 'ndctl.spec',
|
|
|
2eb93d |
+ capture : true,
|
|
|
2eb93d |
+)
|