]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
rpmbuild: enable rpmbuild via make rpm
authorSteven Seungcheol Lee <sc108.lee@samsung.com>
Thu, 27 Jan 2022 11:40:36 +0000 (20:40 +0900)
committerSteven Seungcheol Lee <sc108.lee@samsung.com>
Fri, 4 Feb 2022 05:45:28 +0000 (14:45 +0900)
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 <sc108.lee@samsung.com>
Makefile
README.md
meson.build
nvme.spec.in

index 0f15d30d809873c54bb5dea14caa07420910c052..d52c5e2606e42d100cb9373fe673683ca8ad6ddd 100644 (file)
--- 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 <Martin.Belanger@dell.com>
 #
-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
index 8bbaaa8ad1abe8301adfbb09805f8675566163ce..c5d08865abd5ee1cb4441f6808bd7224d059d53d 100644 (file)
--- 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
index 7c0217dc34c66421248dd1566f5753b2e73a2430..04bb999954b6c7253b0992e465438815f67c7376 100644 (file)
@@ -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',
index 17129944eff5e97cb03be962135709b1ebc5ba01..aff1de3e23c66e4dd3516035858d0b83accf5be1 100644 (file)
@@ -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