From 88a49fb8d1c4da982ffe0cce57d0ec55ab664bf9 Mon Sep 17 00:00:00 2001 From: Steven Seungcheol Lee Date: Thu, 27 Jan 2022 20:40:36 +0900 Subject: [PATCH] rpmbuild: enable rpmbuild via make rpm Makefile: add make rpm via meson rename libnvme -> nvme on Makefile meson.build, meson_options.txt: using former path that nvme provided using libdir to be installed right place (32bit -> lib, 64bit -> lib64) rpmbuild: remove unnecessary rpm stages since rpm spec file created from meson build no need to pacaking it to rpmbuild directory build in meson directory using rpmbuild directory for install & packaging rpm Signed-off-by: Steven Seungcheol Lee --- Makefile | 13 +++++++++++-- README.md | 4 ++++ meson.build | 1 + nvme.spec.in | 27 ++++++++++----------------- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 0f15d30d..d52c5e26 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ # SPDX-License-Identifier: LGPL-2.1-or-later # -# This file is part of libnvme. +# This file is part of nvme. # Copyright (c) 2021 Dell Inc. # # Authors: Martin Belanger # -NAME := libnvme +NAME := nvme .DEFAULT_GOAL := ${NAME} BUILD-DIR := .build @@ -37,3 +37,12 @@ install dist: ${BUILD-DIR} .PHONY: test test: ${BUILD-DIR} ninja -C ${BUILD-DIR} $@ + +.PHONY: rpm +rpm: + meson ${BUILD-DIR} \ + -Dudevrulesdir=$(shell rpm --eval '%{_udevrulesdir}') \ + -Ddracutrulesdir=lib/dracut/dracut.conf.d \ + -Dsystemddir=$(shell rpm --eval '%{_unitdir}') \ + -Ddocs=man + rpmbuild -ba ${BUILD-DIR}/nvme.spec --define "_builddir ${BUILD-DIR}" -v diff --git a/README.md b/README.md index 8bbaaa8a..c5d08865 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ There is a Makefile wrapper for meson for backwards compatiblily $ make # make install +RPM build support via Makefile that uses meson + + $ make rpm + If not sure how to use, find the top-level documentation with: $ man nvme diff --git a/meson.build b/meson.build index 7c0217dc..04bb9999 100644 --- a/meson.build +++ b/meson.build @@ -147,6 +147,7 @@ substs.set('NAME', meson.project_name()) substs.set('VERSION', meson.project_version()) substs.set('LICENSE', meson.project_license()[0]) substs.set('UDEVRULESDIR', udevrulesdir) +substs.set('DRACUTRILESDIR', dracutrulesdir) configure_file( input: 'nvme.spec.in', diff --git a/nvme.spec.in b/nvme.spec.in index 17129944..aff1de3e 100644 --- a/nvme.spec.in +++ b/nvme.spec.in @@ -5,7 +5,6 @@ Summary: Core nvme tools License: GPL Group: Development/Tools URL: https://github.com/linux-nvme/nvme-cli/ -Source: nvme-@VERSION@.tar.gz Provides: nvme Requires(post): util-linux systemd systemd-udev BuildRoot: %{_tmppath}/%{name}-%{version}-root @@ -14,19 +13,13 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-root NVMe is a fast, scalable, direct attached storage interface. The nvme cli rpm installs core management tools with minimal dependencies. -%prep -%setup - -%build -make - %install -rm -rf $RPM_BUILD_ROOT -make install-spec DESTDIR=%{buildroot} PREFIX=/usr +meson install --destdir %{buildroot} --skip-subprojects +touch %{buildroot}/%{_sysconfdir}/nvme/hostnqn +touch %{buildroot}/%{_sysconfdir}/nvme/hostid %files %defattr(-,root,root) -%doc Documentation/nvme*.1 %{_sbindir}/nvme %{_mandir}/man1/nvme*.1* %{_datadir}/bash-completion/completions/nvme @@ -36,13 +29,13 @@ make install-spec DESTDIR=%{buildroot} PREFIX=/usr %{_sysconfdir}/nvme/hostid %{_sysconfdir}/nvme/discovery.conf %ghost %{_sysconfdir}/nvme/config.json -%{_sysconfdir}/udev/rules.d/70-nvmf-autoconnect.rules -%{_sysconfdir}/udev/rules.d/71-nvmf-iopolicy-netapp.rules -%{_libdir}/dracut/dracut.conf.d/70-nvmf-autoconnect.conf -%{_libdir}/systemd/system/nvmf-connect@.service -%{_libdir}/systemd/system/nvmefc-boot-connections.service -%{_libdir}/systemd/system/nvmf-connect.target -%{_libdir}/systemd/system/nvmf-autoconnect.service +%{_udevrulesdir}/70-nvmf-autoconnect.rules +%{_udevrulesdir}/71-nvmf-iopolicy-netapp.rules +@DRACUTRILESDIR@/70-nvmf-autoconnect.conf +%{_unitdir}/nvmf-connect@.service +%{_unitdir}/nvmefc-boot-connections.service +%{_unitdir}/nvmf-connect.target +%{_unitdir}/nvmf-autoconnect.service %clean rm -rf $RPM_BUILD_ROOT -- 2.50.1