From 72b46562962bcabf8ee06b71637b282238549a13 Mon Sep 17 00:00:00 2001 From: Wenlong Zhang Date: Thu, 26 Jun 2025 12:47:36 +0000 Subject: [PATCH] fix build error on loongarch64 --- fix-build-error-on-loongarch64.patch | 33 ++++++++++++++++++++++++++++ gn.spec | 6 ++++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 fix-build-error-on-loongarch64.patch diff --git a/fix-build-error-on-loongarch64.patch b/fix-build-error-on-loongarch64.patch new file mode 100644 index 0000000..74842ae --- /dev/null +++ b/fix-build-error-on-loongarch64.patch @@ -0,0 +1,33 @@ +From 8c12bc005ab003e2c60c1a84cadea42e2972fef7 Mon Sep 17 00:00:00 2001 +From: Wenlong Zhang +Date: Thu, 26 Jun 2025 12:42:54 +0000 +Subject: [PATCH] fix build error on loongarch64 + +--- + src/gn/args.cc | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/gn/args.cc b/src/gn/args.cc +index e59b034..3d427d1 100644 +--- a/src/gn/args.cc ++++ b/src/gn/args.cc +@@ -337,6 +337,7 @@ void Args::SetSystemVarsLocked(Scope* dest) const { + static const char kPPC64[] = "ppc64"; + static const char kRISCV32[] = "riscv32"; + static const char kRISCV64[] = "riscv64"; ++ static const char kLoongArch64[] = "loongarch64"; + const char* arch = nullptr; + + // Set the host CPU architecture based on the underlying OS, not +@@ -365,6 +366,8 @@ void Args::SetSystemVarsLocked(Scope* dest) const { + arch = kRISCV32; + else if (os_arch == "riscv64") + arch = kRISCV64; ++ else if (os_arch == "loongarch64") ++ arch = kLoongArch64; + else + CHECK(false) << "OS architecture not handled. (" << os_arch << ")"; + +-- +2.43.0 + diff --git a/gn.spec b/gn.spec index 401ba71..757e77d 100644 --- a/gn.spec +++ b/gn.spec @@ -2,7 +2,7 @@ Name: gn Version: 1.0.0 -Release: 5 +Release: 6 Summary: Meta-build system that generates build files for Ninja License: BSD-3-Clause URL: https://gn.googlesource.com/gn @@ -11,6 +11,7 @@ Source1: last_commit_position.h Patch0000: gn-always-python3.patch Patch0001: add_safe_compilation_options.patch Patch1000: add-risc-v-and-loongarch-support.patch +Patch1001: fix-build-error-on-loongarch64.patch BuildRequires: python3-devel ninja-build gcc-c++ clang emacs-common help2man @@ -104,6 +105,9 @@ rm -rf %{buildroot}%{_datadir}/vim/vimfiles/__pycache__ %changelog +* Thu Jun 26 2025 Wenlong Zhang - 1.0.0-6 +- fix build error on loongarch64 + * Fri Dec 22 2023 misaka00251 - 1.0.0-5 - Enable debuginfo for riscv64 -- Gitee