From fd4e93072c966c8690c14f47a61b3b6db4617d56 Mon Sep 17 00:00:00 2001 From: Funda Wang Date: Thu, 11 Dec 2025 23:35:27 +0800 Subject: [PATCH] fix build with cmake 4 --- add-sw_64-support-for-libmetal.patch | 47 +++++++++++++++++++++++++++ libmetal-fix-build-with-cmake-4.patch | 42 ++++++++++++++++++++++++ libmetal.spec | 10 ++++-- 3 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 add-sw_64-support-for-libmetal.patch create mode 100644 libmetal-fix-build-with-cmake-4.patch diff --git a/add-sw_64-support-for-libmetal.patch b/add-sw_64-support-for-libmetal.patch new file mode 100644 index 0000000..9031375 --- /dev/null +++ b/add-sw_64-support-for-libmetal.patch @@ -0,0 +1,47 @@ +From 45efccd7042df956566914d686001eb42285461c Mon Sep 17 00:00:00 2001 +From: mahailiang +Date: Mon, 4 Nov 2024 11:15:36 +0800 +Subject: [PATCH] add sw_64 support + +--- + lib/processor/sw_64/CMakeLists.txt | 3 +++ + lib/processor/sw_64/cpu.h | 17 +++++++++++++++++ + 2 files changed, 20 insertions(+) + create mode 100644 lib/processor/sw_64/CMakeLists.txt + create mode 100644 lib/processor/sw_64/cpu.h + +diff --git a/lib/processor/sw_64/CMakeLists.txt b/lib/processor/sw_64/CMakeLists.txt +new file mode 100644 +index 0000000..c06e951 +--- /dev/null ++++ b/lib/processor/sw_64/CMakeLists.txt +@@ -0,0 +1,3 @@ ++collect (PROJECT_LIB_HEADERS cpu.h) ++ ++# vim: expandtab:ts=2:sw=2:smartindent +diff --git a/lib/processor/sw_64/cpu.h b/lib/processor/sw_64/cpu.h +new file mode 100644 +index 0000000..ea34eb6 +--- /dev/null ++++ b/lib/processor/sw_64/cpu.h +@@ -0,0 +1,17 @@ ++/* ++ * Copyright (c) 2018, Pinecone Inc. and Contributors. All rights reserved. ++ * ++ * SPDX-License-Identifier: BSD-3-Clause ++ */ ++ ++/* ++ * @file cpu.h ++ * @brief CPU specific primitives ++ */ ++ ++#ifndef __METAL_SW_64_CPU__H__ ++#define __METAL_SW_64_CPU__H__ ++ ++#define metal_cpu_yield() ++ ++#endif /* __METAL_SW_64_CPU__H__ */ +-- +2.43.0 + diff --git a/libmetal-fix-build-with-cmake-4.patch b/libmetal-fix-build-with-cmake-4.patch new file mode 100644 index 0000000..b623bf1 --- /dev/null +++ b/libmetal-fix-build-with-cmake-4.patch @@ -0,0 +1,42 @@ +From 9a21915a5f8f685a9d77672e3817a923d3de8e1f Mon Sep 17 00:00:00 2001 +From: Arnaud Pouliquen +Date: Thu, 13 Feb 2025 16:26:31 +0100 +Subject: [PATCH] cmake: update cmake minimum support to 3.16 + +We currently support an old version of CMake (3.0.2) that was released +in 2018. + +This requires adding specific policies to support the evolution to the +latest versions of Zephyr. + +Update the minimum version to 3.16. The reason for this version is to +support environments such as Debian Bullseye that are still in LTS state. + +By updating to CMake 3.16 as the minimum version, we can also clean up +the following policy add-ons: +- CMP0048 added in CMake v3.0 +- CMP0053 added in CMake v3.1 +- CMP0077 added in CMake v3.13 + +Signed-off-by: Arnaud Pouliquen +--- + CMakeLists.txt | 9 +-------- + 1 file changed, 1 insertion(+), 8 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3fe792827..eddbbfb5d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,11 +1,4 @@ +-cmake_minimum_required (VERSION 3.0.2) +-if (POLICY CMP0048) +- cmake_policy(SET CMP0048 NEW) +-endif() +- +-if (POLICY CMP0077) +- cmake_policy(SET CMP0077 NEW) +-endif() ++cmake_minimum_required (VERSION 3.16) + + set (LIBMETAL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + diff --git a/libmetal.spec b/libmetal.spec index 9a98fbd..cabc083 100644 --- a/libmetal.spec +++ b/libmetal.spec @@ -1,15 +1,17 @@ Name: libmetal Version: 2022.10.0 -Release: 6 +Release: 7 Summary: An abstraction layer across user-space Linux, baremetal, and RTOS environments -License: BSD +License: BSD-3-Clause OR Apache-2.0 OR GPL-2.0-only URL: https://github.com/OpenAMP/libmetal/ Source0: https://github.com/OpenAMP/libmetal/archive/refs/tags/v%{version}/%{name}-%{version}.tar.gz Patch0: libmetal-add-additional-arches.patch Patch1: add-riscv-support.patch Patch2: add-loongarch64-support-for-libmetal.patch +Patch3: add-sw_64-support-for-libmetal.patch +Patch4: libmetal-fix-build-with-cmake-4.patch BuildRequires: cmake BuildRequires: doxygen @@ -68,6 +70,10 @@ done %changelog +* Thu Dec 11 2025 Funda Wang - 2022.10.0-7 +- fix build with cmake 4 +- support sw64 + * Thu Nov 21 2024 Funda Wang - 2022.10.0-6 - adopt to new cmake macro -- Gitee