diff --git a/0005-clang-support.patch b/0005-clang-support.patch new file mode 100644 index 0000000000000000000000000000000000000000..13d92a731522227ec7bd02306a8d00d68bd3ea07 --- /dev/null +++ b/0005-clang-support.patch @@ -0,0 +1,239 @@ +diff -uNr vdo-8.2.2.2-patchedbackup/utils/uds/Makefile vdo-8.2.2.2-patched/utils/uds/Makefile +--- vdo-8.2.2.2-patchedbackup/utils/uds/Makefile 2024-09-27 10:05:29.529846385 +0800 ++++ vdo-8.2.2.2-patched/utils/uds/Makefile 2024-09-27 10:34:25.699840596 +0800 +@@ -22,42 +22,46 @@ + + DEPDIR = .deps + +-ifeq ($(origin CC), default) +- CC=gcc +-endif +- + ifeq ($(filter riscv64%,$(MAKE_HOST)),) + Wcast-align = -Wcast-align + endif +-WARNS = -Wall \ +- $(Wcast-align) \ +- -Werror \ +- -Wextra \ +- -Winit-self \ +- -Wlogical-op \ +- -Wmissing-include-dirs \ +- -Wpointer-arith \ +- -Wredundant-decls \ +- -Wunused \ +- -Wwrite-strings +- +-C_WARNS = -Wbad-function-cast \ +- -Wcast-qual \ +- -Wfloat-equal \ +- -Wformat=2 \ +- -Wmissing-declarations \ +- -Wmissing-format-attribute \ +- -Wmissing-prototypes \ +- -Wnested-externs \ +- -Wold-style-definition \ +- -Wswitch-default ++ ++# Define WARNS and C_WARNS only if using gcc ++CLANG_VERSION := $(shell $(CC) --version | grep -i clang) ++ifeq ($(findstring clang, $(CLANG_VERSION)),clang) ++WARNS = ++C_WARNS = ++else ++WARNS = -Wall \ ++ $(Wcast-align) \ ++ -Werror \ ++ -Wextra \ ++ -Winit-self \ ++ -Wlogical-op \ ++ -Wmissing-include-dirs \ ++ -Wpointer-arith \ ++ -Wredundant-decls \ ++ -Wunused \ ++ -Wwrite-strings ++ ++C_WARNS = -Wbad-function-cast \ ++ -Wcast-qual \ ++ -Wfloat-equal \ ++ -Wformat=2 \ ++ -Wmissing-declarations \ ++ -Wmissing-format-attribute \ ++ -Wmissing-prototypes \ ++ -Wnested-externs \ ++ -Wold-style-definition \ ++ -Wswitch-default ++endif + + OPT_FLAGS = -O3 -fno-omit-frame-pointer + DEBUG_FLAGS = + RPM_OPT_FLAGS ?= -fpic +-GLOBAL_FLAGS = $(RPM_OPT_FLAGS) -D_GNU_SOURCE -g $(OPT_FLAGS) \ +- $(WARNS) $(shell getconf LFS_CFLAGS) $(DEBUG_FLAGS) \ +- -DCURRENT_VERSION='"$(BUILD_VERSION)"' \ ++GLOBAL_FLAGS = $(RPM_OPT_FLAGS) -D_GNU_SOURCE -g $(OPT_FLAGS) \ ++ $(WARNS) $(shell getconf LFS_CFLAGS) $(DEBUG_FLAGS) \ ++ -DCURRENT_VERSION='"$(BUILD_VERSION)"' + + CFLAGS = $(GLOBAL_FLAGS) -I. -std=gnu99 -pedantic $(C_WARNS) $(MY_CFLAGS) + LDFLAGS = $(RPM_LD_FLAGS) $(MY_LDFLAGS) +@@ -69,48 +73,48 @@ + vpath %.c . + vpath %.c ./murmur + +-UDS_OBJECTS = murmurhash3.o \ +- buffer.o \ +- buffered-reader.o \ +- buffered-writer.o \ +- chapter-index.o \ +- config.o \ +- delta-index.o \ +- errors.o \ +- event-count.o \ +- fileIORegion.o \ +- fileUtils.o \ +- funnel-queue.o \ +- geometry.o \ +- hash-utils.o \ +- index.o \ +- index-layout.o \ +- index-page-map.o \ +- index-session.o \ +- ioFactory.o \ +- logger.o \ +- memoryAlloc.o \ +- minisyslog.o \ +- open-chapter.o \ +- page-cache.o \ +- permassert.o \ +- radix-sort.o \ +- random.o \ +- record-page.o \ +- requestQueue.o \ +- sparse-cache.o \ +- string-utils.o \ +- syscalls.o \ +- threadCondVar.o \ +- threadMutex.o \ +- threadSemaphore.o \ +- time-utils.o \ +- uds-threads.o \ +- volume.o \ +- volume-index005.o \ +- volume-index006.o \ +- volume-index-ops.o \ +- volume-store.o ++UDS_OBJECTS = murmurhash3.o \ ++ buffer.o \ ++ buffered-reader.o \ ++ buffered-writer.o \ ++ chapter-index.o \ ++ config.o \ ++ delta-index.o \ ++ errors.o \ ++ event-count.o \ ++ fileIORegion.o \ ++ fileUtils.o \ ++ funnel-queue.o \ ++ geometry.o \ ++ hash-utils.o \ ++ index.o \ ++ index-layout.o \ ++ index-page-map.o \ ++ index-session.o \ ++ ioFactory.o \ ++ logger.o \ ++ memoryAlloc.o \ ++ minisyslog.o \ ++ open-chapter.o \ ++ page-cache.o \ ++ permassert.o \ ++ radix-sort.o \ ++ random.o \ ++ record-page.o \ ++ requestQueue.o \ ++ sparse-cache.o \ ++ string-utils.o \ ++ syscalls.o \ ++ threadCondVar.o \ ++ threadMutex.o \ ++ threadSemaphore.o \ ++ time-utils.o \ ++ uds-threads.o \ ++ volume.o \ ++ volume-index005.o \ ++ volume-index006.o \ ++ volume-index-ops.o \ ++ volume-store.o + + .PHONY: all + all: libuds.a +@@ -129,7 +133,6 @@ + %.s: %.c + $(CC) $(CFLAGS) -S $^ + +- + ######################################################################## + # Dependency processing + +diff -uNr vdo-8.2.2.2-patchedbackup/utils/vdo/Makefile vdo-8.2.2.2-patched/utils/vdo/Makefile +--- vdo-8.2.2.2-patchedbackup/utils/vdo/Makefile 2024-09-27 10:05:29.529846385 +0800 ++++ vdo-8.2.2.2-patched/utils/vdo/Makefile 2024-09-27 10:34:19.959840728 +0800 +@@ -25,30 +25,34 @@ + ifeq ($(filter riscv64%,$(MAKE_HOST)),) + Wcast-align = -Wcast-align + endif +-WARNS = \ +- -Wall \ +- $(Wcast-align) \ +- -Werror \ +- -Wextra \ +- -Winit-self \ +- -Wlogical-op \ +- -Wmissing-include-dirs \ +- -Wpointer-arith \ +- -Wredundant-decls \ +- -Wunused \ +- -Wwrite-strings \ ++CLANG_VERSION := $(shell $(CC) --version | grep -i clang) ++ifeq ($(findstring clang, $(CLANG_VERSION)),clang) ++WARNS = ++C_WARNS = ++else ++WARNS = -Wall \ ++ $(Wcast-align) \ ++ -Werror \ ++ -Wextra \ ++ -Winit-self \ ++ -Wlogical-op \ ++ -Wmissing-include-dirs \ ++ -Wpointer-arith \ ++ -Wredundant-decls \ ++ -Wunused \ ++ -Wwrite-strings + +-C_WARNS = \ +- -Wbad-function-cast \ +- -Wcast-qual \ +- -Wfloat-equal \ +- -Wformat=2 \ +- -Wmissing-declarations \ +- -Wmissing-format-attribute \ +- -Wmissing-prototypes \ +- -Wnested-externs \ +- -Wold-style-definition \ +- -Wswitch-default \ ++C_WARNS = -Wbad-function-cast \ ++ -Wcast-qual \ ++ -Wfloat-equal \ ++ -Wformat=2 \ ++ -Wmissing-declarations \ ++ -Wmissing-format-attribute \ ++ -Wmissing-prototypes \ ++ -Wnested-externs \ ++ -Wold-style-definition \ ++ -Wswitch-default ++endif + + ifeq ($(AR), ar) + ifeq ($(origin AR), default) diff --git a/vdo.spec b/vdo.spec index dab799ceca0f7c4be2de46885af3075e6e700508..bb7464dc57d3975ef7dd7a372878379c9881b811 100644 --- a/vdo.spec +++ b/vdo.spec @@ -1,6 +1,6 @@ Name: vdo Version: 8.2.2.2 -Release: 3 +Release: 4 Summary: Management tools for Virtual Data Optimizer License: GPLv2 URL: http://github.com/dm-vdo/vdo @@ -9,6 +9,7 @@ Patch0001: 0001-Add-loongarch64-support.patch Patch0002: 0002-fix_dmeventd_linking.patch Patch0003: 0003-RISC-V-support.patch Patch0004: 0004-fix-vdostats-output-error.patch +Patch0005: 0005-clang-support.patch BuildRequires: gcc libuuid-devel device-mapper-devel device-mapper-event-devel BuildRequires: zlib-devel libblkid-devel @@ -55,7 +56,10 @@ This package provides the user-space management tools for VDO. %{_mandir}/man8/* %changelog -* Fri Oct 17 2025 weishuaihao 8.2.2.2-3 +* Thu Oct 23 2025 weishuaihao - 8.2.2.2-4 +- Fix add if else to support clang + +* Fri Oct 17 2025 weishuaihao - 8.2.2.2-3 - Fix vdostats output error * Sun Apr 28 2024 yinsist - 8.2.2.2-2