2024-05-31 11:24:28

by Christian Heusel

[permalink] [raw]
Subject: [PATCH RESEND] tools/x86/kcpuid: Add missing dir via Makefile

So far the Makefile just installed the csv into $(HWDATADIR)/cpuid.csv,
which made it unaware about $DESTDIR. Add $DESTDIR to the install
command and while we are at it also create the directory, should it not
exist already. This eases the packaging of kcpuid and allows i.e. for
the install on arch to look like this:

make BINDIR=/usr/bin DESTDIR="$pkgdir" -C tools/arch/x86/kcpuid install

So far this change is carried as a downstream patch.

Signed-off-by: Christian Heusel <[email protected]>
---
Resend to add missing [email protected] to recipients
---
tools/arch/x86/kcpuid/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/arch/x86/kcpuid/Makefile b/tools/arch/x86/kcpuid/Makefile
index 87b554fab14b8..d0b4b0ed10ff9 100644
--- a/tools/arch/x86/kcpuid/Makefile
+++ b/tools/arch/x86/kcpuid/Makefile
@@ -19,6 +19,6 @@ clean :
@rm -f kcpuid

install : kcpuid
- install -d $(DESTDIR)$(BINDIR)
+ install -d $(DESTDIR)$(BINDIR) $(DESTDIR)$(HWDATADIR)
install -m 755 -p kcpuid $(DESTDIR)$(BINDIR)/kcpuid
- install -m 444 -p cpuid.csv $(HWDATADIR)/cpuid.csv
+ install -m 444 -p cpuid.csv $(DESTDIR)$(HWDATADIR)/cpuid.csv
--
2.45.1



2024-06-06 15:17:39

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH RESEND] tools/x86/kcpuid: Add missing dir via Makefile

Lemme fix CC addresses too. :-\

On Fri, May 31, 2024 at 01:17:58PM +0200, Christian Heusel wrote:
> So far the Makefile just installed the csv into $(HWDATADIR)/cpuid.csv,
> which made it unaware about $DESTDIR. Add $DESTDIR to the install
> command and while we are at it also create the directory, should it not
> exist already. This eases the packaging of kcpuid and allows i.e. for
> the install on arch to look like this:
>
> make BINDIR=/usr/bin DESTDIR="$pkgdir" -C tools/arch/x86/kcpuid install

Stupid question: is DESTDIR something that distro packaging machinery
uses? Dunno, some Linux packaging standards thing or so?

I.e., I wanna make sure this as generic and as easy for packaging as
possible.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Subject: [tip: x86/misc] tools/x86/kcpuid: Add missing dir via Makefile

The following commit has been merged into the x86/misc branch of tip:

Commit-ID: f6d116e080604251880b4957843f9b1f6fdfa30f
Gitweb: https://git.kernel.org/tip/f6d116e080604251880b4957843f9b1f6fdfa30f
Author: Christian Heusel <[email protected]>
AuthorDate: Fri, 31 May 2024 13:17:58 +02:00
Committer: Borislav Petkov (AMD) <[email protected]>
CommitterDate: Fri, 07 Jun 2024 23:30:52 +02:00

tools/x86/kcpuid: Add missing dir via Makefile

So far the Makefile just installed the csv into $(HWDATADIR)/cpuid.csv, which
made it unaware about $DESTDIR. Add $DESTDIR to the install command and while
at it also create the directory, should it not exist already. This eases the
packaging of kcpuid and allows i.e. for the install on Arch to look like this:

$ make BINDIR=/usr/bin DESTDIR="$pkgdir" -C tools/arch/x86/kcpuid install

Some background on DESTDIR:

DESTDIR is commonly used in packaging for staged installs (regardless of the
used package manager):

https://www.gnu.org/prep/standards/html_node/DESTDIR.html

So the package is built and installed into a directory which the package
manager later picks up and creates some archive from it.

What is specific to Arch Linux here is only the usage of $pkgdir in the
example, DESTDIR itself is widely used.

[ bp: Extend the commit message with Christian's info on DESTDIR as a GNU
coding standards thing. ]

Signed-off-by: Christian Heusel <[email protected]>
Signed-off-by: Borislav Petkov (AMD) <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
tools/arch/x86/kcpuid/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/arch/x86/kcpuid/Makefile b/tools/arch/x86/kcpuid/Makefile
index 87b554f..d0b4b0e 100644
--- a/tools/arch/x86/kcpuid/Makefile
+++ b/tools/arch/x86/kcpuid/Makefile
@@ -19,6 +19,6 @@ clean :
@rm -f kcpuid

install : kcpuid
- install -d $(DESTDIR)$(BINDIR)
+ install -d $(DESTDIR)$(BINDIR) $(DESTDIR)$(HWDATADIR)
install -m 755 -p kcpuid $(DESTDIR)$(BINDIR)/kcpuid
- install -m 444 -p cpuid.csv $(HWDATADIR)/cpuid.csv
+ install -m 444 -p cpuid.csv $(DESTDIR)$(HWDATADIR)/cpuid.csv

Subject: [tip: x86/misc] tools/x86/kcpuid: Add missing dir via Makefile

The following commit has been merged into the x86/misc branch of tip:

Commit-ID: 1d2a03d26a69e4e781077f5fbb5466143928c737
Gitweb: https://git.kernel.org/tip/1d2a03d26a69e4e781077f5fbb5466143928c737
Author: Christian Heusel <[email protected]>
AuthorDate: Fri, 31 May 2024 13:17:58 +02:00
Committer: Borislav Petkov (AMD) <[email protected]>
CommitterDate: Wed, 12 Jun 2024 11:33:45 +02:00

tools/x86/kcpuid: Add missing dir via Makefile

So far the Makefile just installed the csv into $(HWDATADIR)/cpuid.csv, which
made it unaware about $DESTDIR. Add $DESTDIR to the install command and while
at it also create the directory, should it not exist already. This eases the
packaging of kcpuid and allows i.e. for the install on Arch to look like this:

$ make BINDIR=/usr/bin DESTDIR="$pkgdir" -C tools/arch/x86/kcpuid install

Some background on DESTDIR:

DESTDIR is commonly used in packaging for staged installs (regardless of the
used package manager):

https://www.gnu.org/prep/standards/html_node/DESTDIR.html

So the package is built and installed into a directory which the package
manager later picks up and creates some archive from it.

What is specific to Arch Linux here is only the usage of $pkgdir in the
example, DESTDIR itself is widely used.

[ bp: Extend the commit message with Christian's info on DESTDIR as a GNU
coding standards thing. ]

Signed-off-by: Christian Heusel <[email protected]>
Signed-off-by: Borislav Petkov (AMD) <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
tools/arch/x86/kcpuid/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/arch/x86/kcpuid/Makefile b/tools/arch/x86/kcpuid/Makefile
index 87b554f..d0b4b0e 100644
--- a/tools/arch/x86/kcpuid/Makefile
+++ b/tools/arch/x86/kcpuid/Makefile
@@ -19,6 +19,6 @@ clean :
@rm -f kcpuid

install : kcpuid
- install -d $(DESTDIR)$(BINDIR)
+ install -d $(DESTDIR)$(BINDIR) $(DESTDIR)$(HWDATADIR)
install -m 755 -p kcpuid $(DESTDIR)$(BINDIR)/kcpuid
- install -m 444 -p cpuid.csv $(HWDATADIR)/cpuid.csv
+ install -m 444 -p cpuid.csv $(DESTDIR)$(HWDATADIR)/cpuid.csv