From 0cedef0150e8bbf6799a8d314950a3954a67e074 Mon Sep 17 00:00:00 2001 From: Wenlong Zhang Date: Wed, 17 Jan 2024 00:44:54 +0000 Subject: [PATCH] fix uname processortype error for loongarch64 --- ...-processortype-error-for-loongarch64.patch | 52 +++++++++++++++++++ coreutils.spec | 10 +++- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 0001-fix-uname-processortype-error-for-loongarch64.patch diff --git a/0001-fix-uname-processortype-error-for-loongarch64.patch b/0001-fix-uname-processortype-error-for-loongarch64.patch new file mode 100644 index 0000000..28f3df9 --- /dev/null +++ b/0001-fix-uname-processortype-error-for-loongarch64.patch @@ -0,0 +1,52 @@ +From 108098b073c9a62c0ae27d9d363d1b7c31f29313 Mon Sep 17 00:00:00 2001 +From: Wenlong Zhang +Date: Wed, 17 Jan 2024 00:42:18 +0000 +Subject: [PATCH] fix uname processortype error for loongarch64 + +--- + src/uname.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/src/uname.c b/src/uname.c +index 883b9a4..ce67e57 100644 +--- a/src/uname.c ++++ b/src/uname.c +@@ -314,6 +314,7 @@ main (int argc, char **argv) + if (toprint & PRINT_PROCESSOR) + { + char const *element = unknown; ++ + #ifdef __APPLE__ + # if defined __arm__ || defined __arm64__ + element = "arm"; +@@ -330,6 +331,13 @@ main (int argc, char **argv) + if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor)) + element = processor; + } ++#else ++ { ++ static struct utsname u; ++ uname(&u); ++ element = u.machine; ++ } ++ + #endif + #ifdef UNAME_PROCESSOR + if (element == unknown) +@@ -355,6 +363,13 @@ main (int argc, char **argv) + hardware_platform, sizeof hardware_platform)) + element = hardware_platform; + } ++#else ++ { ++ static struct utsname u; ++ uname(&u); ++ element = u.machine; ++ } ++ + #endif + #ifdef UNAME_HARDWARE_PLATFORM + if (element == unknown) +-- +2.41.0 + diff --git a/coreutils.spec b/coreutils.spec index 24af6ba..6f01fb9 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,4 +1,4 @@ -%define anolis_release 2 +%define anolis_release 3 Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils Version: 9.4 @@ -51,6 +51,8 @@ Obsoletes: %{name} < 8.24 # backport patch from upstream +Patch001: 0001-fix-uname-processortype-error-for-loongarch64.patch + %description These are the GNU core utilities. This package is the combination of the old GNU fileutils, sh-utils, and textutils packages. @@ -139,6 +141,9 @@ for type in separate single; do --enable-install-program=arch \ --enable-no-install-program=kill,uptime \ --with-tty-group \ +%ifarch loongarch64 + FORCE_UNSAFE_CONFIGURE=1 \ +%endif DEFAULT_POSIX2_VERSION=200112 alternative=199209 || : %make_build all V=1 @@ -225,6 +230,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %doc NEWS README THANKS TODO %changelog +* Wed Jan 17 2024 Wenlong Zhang - 9.4-3 +- fix uname processortype error for loongarch64 + * Tue Nov 7 2023 Wenlong Zhang - 9.4-2 - fix build error for coreutils -- Gitee