forked from yoctoproject/poky
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rpm: Allow setting platform macro settings externally
Feed platform settings to installplatform externally. Based on the patch submitted under rpm-software-management/rpm#2585 Patch against INSTALL was backported for rpm 4.18.1 (From OE-Core rev: 1c3b7f610645363d073d7c2f165d4f56eeab1ad8) Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
- Loading branch information
1 parent
0189367
commit 2179de7
Showing
2 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
119 changes: 119 additions & 0 deletions
119
...ecipes-devtools/rpm/files/0001-Allow-setting-platform-macro-settings-externally-258.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
From e58c607dcdb303ff3ba1b22fd23eb20e374b6ed3 Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= | ||
<zboszor@gmail.com> | ||
Date: Fri, 28 Jul 2023 12:16:56 +0200 | ||
Subject: [PATCH] Allow setting platform macro settings externally (#2585) | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; charset=UTF-8 | ||
Content-Transfer-Encoding: 8bit | ||
|
||
* Allow setting platform macro settings externally | ||
|
||
By default, rpm installs a series of default platforms based on | ||
the CPU architecture names in subdirectories called | ||
|
||
/usr/lib/platform/<arch>-<os> | ||
|
||
This is enough for regular Linux distributions. However, some | ||
distributions may use more specific platform names that refer to | ||
particular computer systems, like SBCs or specific CPU tuning when | ||
compiling. | ||
|
||
If the platform subdirectory does not exist in /usr/lib/platform | ||
then rpmbuild does not work. | ||
|
||
Allow creating such custom platform subdirectory with feeding | ||
the necessary data using external variables: RPM_CUSTOM_ARCH, | ||
RPM_CUSTOM_ISANAME, RPM_CUSTOM_ISABITS, RPM_CUSTOM_CANONARCH | ||
and RPM_CUSTOM_CANONCOLOR | ||
|
||
Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> | ||
Upstream-Status: Backport [https://github.com/rpm-software-management/rpm/commit/fde03ae33d55b160a31a6c54946880dcdf8fd0d6] | ||
|
||
--------- | ||
|
||
Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> | ||
Co-authored-by: Florian Festi <ffesti@redhat.com> | ||
--- | ||
INSTALL | 37 +++++++++++++++++++++++++++++++++++++ | ||
installplatform | 9 ++++++++- | ||
2 files changed, 45 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/INSTALL b/INSTALL | ||
index 13d0d8a83..5e035cf6a 100644 | ||
--- a/INSTALL | ||
+++ b/INSTALL | ||
@@ -148,6 +148,43 @@ and then install with: | ||
|
||
make install | ||
|
||
+ | ||
+By default, rpm installs a series of default platforms based on the CPU | ||
+architecture names in subdirectories called | ||
+ | ||
+ /usr/lib/platform/<arch>-<os> | ||
+ | ||
+This is enough for many distributions. However, some distributions | ||
+may use more specific platform names that refer to particular computer | ||
+systems, like SBCs or specific CPU tuning when compiling. Examples of such | ||
+platform names are: "genericx86_64", "intel_skylake_64", "raspberrypi_armv7", | ||
+"raspberrypi_armv8", etc. | ||
+ | ||
+If the platform name is put into /etc/rpm/platform, then rpmbuild uses it | ||
+and the only macros file rpmbuild looks for is | ||
+ | ||
+ /usr/lib/platform/`cat /etc/rpm/platform`-<os>/macros | ||
+ | ||
+If this file does not exist, many rpm macros will not have their expected | ||
+values set and e.g. %configure will fail when trying to run rpmbuild. | ||
+ | ||
+To allow creating the macros file for such a custom platform, the shell | ||
+variables listed below must be set. If RPM_CUSTOM_ARCH is not set, the rest | ||
+is ignored. | ||
+ | ||
+ export RPM_CUSTOM_ARCH=genericx86_64 | ||
+ export RPM_CUSTOM_ISANAME=x86 | ||
+ export RPM_CUSTOM_ISABITS=64 | ||
+ export RPM_CUSTOM_CANONARCH=x86_64 | ||
+ export RPM_CUSTOM_CANONCOLOR=0 # to use /usr/lib for %_libdir | ||
+ export RPM_CUSTOM_CANONCOLOR=3 # to use /usr/lib64 for %_libdir | ||
+ | ||
+ make install | ||
+ | ||
+This also creates and installs the new platform file e.g. | ||
+/usr/lib/platform/genericx86_64-linux/macros | ||
+ | ||
+ | ||
Rpm comes with an automated self-test suite. The test-suite relies heavily | ||
on fakechroot (https://github.com/dex4er/fakechroot/) and cannot be executed | ||
without it. Provided that fakechroot was found during configure, | ||
diff --git a/installplatform b/installplatform | ||
index a5ad7c5b8..59f57697b 100755 | ||
--- a/installplatform | ||
+++ b/installplatform | ||
@@ -11,7 +11,7 @@ VENDOR="${4}" | ||
OS="${5}" | ||
RPMRC_GNU="${6}" | ||
|
||
-for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do | ||
+for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2` ${RPM_CUSTOM_ARCH:+custom}; do | ||
RPMRC_OPTFLAGS="`sed -n 's/^optflags: '$ARCH' //p' $RPMRC`" | ||
RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`" | ||
case $RPMRC_OPTFLAGS in | ||
@@ -30,6 +30,13 @@ for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do | ||
CANONCOLOR= | ||
FILTER=cat | ||
case "${ARCH}" in | ||
+ custom) | ||
+ ARCH=$RPM_CUSTOM_ARCH | ||
+ ISANAME=$RPM_CUSTOM_ISANAME | ||
+ ISABITS=$RPM_CUSTOM_ISABITS | ||
+ CANONARCH=$RPM_CUSTOM_CANONARCH | ||
+ CANONCOLOR=$RPM_CUSTOM_CANONCOLOR | ||
+ ;; | ||
sparc64*) | ||
ISANAME=sparc | ||
ISABITS=64 | ||
-- | ||
2.41.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters