From f259233e5c3163c27e2f3842db06349ae24ee64b Mon Sep 17 00:00:00 2001 From: shen-chenbang <1944340417@qq.com> Date: Thu, 26 Sep 2024 21:43:01 +0800 Subject: [PATCH] support clang --- 0004-add-if-else-to-support-clang.patch | 57 +++++++++++++++++++++++++ vdo.spec | 6 ++- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 0004-add-if-else-to-support-clang.patch diff --git a/0004-add-if-else-to-support-clang.patch b/0004-add-if-else-to-support-clang.patch new file mode 100644 index 0000000..34974e3 --- /dev/null +++ b/0004-add-if-else-to-support-clang.patch @@ -0,0 +1,57 @@ +From f68257af667b803999ddc58f63bbd4f4475b28dc Mon Sep 17 00:00:00 2001 +From: shen-chenbang <1944340417@qq.com> +Date: Thu, 26 Sep 2024 21:34:22 +0800 +Subject: [PATCH] add if else to support clang + +--- + utils/uds/Makefile | 4 ++++ + utils/vdo/Makefile | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/utils/uds/Makefile b/utils/uds/Makefile +index c258d55..d2c946b 100644 +--- a/utils/uds/Makefile ++++ b/utils/uds/Makefile +@@ -26,6 +26,8 @@ ifeq ($(origin CC), default) + CC=gcc + endif + ++ifeq ($(shell $(CC) --version | grep -i clang),) ++else + ifeq ($(filter riscv64%,$(MAKE_HOST)),) + Wcast-align = -Wcast-align + endif +@@ -52,6 +54,8 @@ C_WARNS = -Wbad-function-cast \ + -Wold-style-definition \ + -Wswitch-default + ++endif ++ + OPT_FLAGS = -O3 -fno-omit-frame-pointer + DEBUG_FLAGS = + RPM_OPT_FLAGS ?= -fpic +diff --git a/utils/vdo/Makefile b/utils/vdo/Makefile +index 290a413..09100d0 100644 +--- a/utils/vdo/Makefile ++++ b/utils/vdo/Makefile +@@ -22,6 +22,8 @@ VDO_VERSION = 8.2.2.2 + + UDS_DIR = ../uds + ++ifeq ($(shell $(CC) --version | grep -i clang),) ++else + ifeq ($(filter riscv64%,$(MAKE_HOST)),) + Wcast-align = -Wcast-align + endif +@@ -50,6 +52,8 @@ C_WARNS = \ + -Wold-style-definition \ + -Wswitch-default \ + ++endif ++ + ifeq ($(AR), ar) + ifeq ($(origin AR), default) + AR := gcc-ar +-- +2.45.2.windows.1 + diff --git a/vdo.spec b/vdo.spec index 7a2978d..46d4818 100644 --- a/vdo.spec +++ b/vdo.spec @@ -1,6 +1,6 @@ Name: vdo Version: 8.2.2.2 -Release: 2 +Release: 3 Summary: Management tools for Virtual Data Optimizer License: GPLv2 URL: http://github.com/dm-vdo/vdo @@ -8,6 +8,7 @@ Source0: https://github.com/dm-vdo/vdo/archive/refs/tags/%{version}.tar.gz Patch0001: 0001-Add-loongarch64-support.patch Patch0002: 0002-fix_dmeventd_linking.patch Patch0003: 0003-RISC-V-support.patch +Patch0004: 0004-add-if-else-to-support-clang.patch BuildRequires: gcc libuuid-devel device-mapper-devel device-mapper-event-devel BuildRequires: zlib-devel libblkid-devel @@ -54,6 +55,9 @@ This package provides the user-space management tools for VDO. %{_mandir}/man8/* %changelog +* Tue Aug 27 2024 shenchenbang <1944340417@qq.com> - 8.2.2.2-3 +- Fix add if else to support clang + * Sun Apr 28 2024 yinsist - 8.2.2.2-2 - Valgrind does not support certain architectures like RISC-V, Before depending on Valgrind, first check if Valgrind supports the architecture -- Gitee