support clang build

Signed-off-by: luofeng14 <luofeng13@huawei.com>
(cherry picked from commit 31eebd3db8e8523387c23a3a455df1a57494890e)
This commit is contained in:
luofeng14 2024-03-04 08:05:37 +00:00 committed by openeuler-sync-bot
parent 8332d97094
commit fa83a93b2e
2 changed files with 31 additions and 1 deletions

View File

@ -2,7 +2,7 @@
Name: secpaver
Summary: Security policy development tool
Version: 1.0.2
Release: 6
Release: 7
License: MulanPSL-2.0
URL: https://gitee.com/openeuler/secpaver
Source: https://gitee.com/openeuler/secpaver/repository/archive/%{name}-%{version}.tar.gz
@ -11,6 +11,8 @@ Source1: sys.tar.gz
Patch0001: dont-do-daemon-reload-in-make-install.patch
Patch0002: set-default-log-path.patch
Patch0003: support-clang-build.patch
%ifarch riscv64
Patch1000: 1000-fix-build-on-riscv64.patch
%endif
@ -82,6 +84,9 @@ tar -xf %{SOURCE1} -C vendor/golang.org/x/
%systemd_postun_with_restart pavd.service
%changelog
* Fri Mar 1 2024 luofeng <luofeng13@huawei.com> - 1.0.2-7
- support clang build
* Fri Sep 15 2023 misaka00251 <liuxin@iscas.ac.cn> - 1.0.2-6
- Fix build on riscv64

25
support-clang-build.patch Normal file
View File

@ -0,0 +1,25 @@
From cb587f370f5cd9caf57c8c4364392f5513435b21 Mon Sep 17 00:00:00 2001
From: luofeng <luofeng13@huawei.com>
Date: Mon, 4 Mar 2024 15:49:13 +0800
Subject: [PATCH] support clang build
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 858346a..405bcc3 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ SYSTEMD_DIR = $(DESTDIR)/usr/lib/systemd/system
LOG_DIR := $(DESTDIR)/var/log/secpaver
BUILDFLAGS := -trimpath
-LDFLAGS := -w -s -buildid=IdBySecPaver -linkmode=external -extldflags=-static -extldflags=-zrelro -extldflags=-znow $(LDFLAGS)
+LDFLAGS := -w -s -buildid=IdBySecPaver -linkmode=external -extldflags=-static -extldflags=-zrelro -extldflags=-Wl,-z,now $(LDFLAGS)
ifeq ($(shell go help mod >/dev/null 2>&1 && echo true), true)
export GO111MODULE=on
--
2.19.1