!70 add compile option

From: @vegbir 
Reviewed-by: @zhangsong234, @jingwoo 
Signed-off-by: @jingwoo
This commit is contained in:
openeuler-ci-bot 2023-11-13 12:38:53 +00:00 committed by Gitee
commit 816b519338
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,26 @@
From df6545261395654bdba369e23b7b4fd6705cad93 Mon Sep 17 00:00:00 2001
From: zhangsong234 <zhangsong34@huawei.com>
Date: Thu, 2 Sep 2021 20:49:07 +0800
Subject: [PATCH] enable external linkmode for cgo build
Signed-off-by: zhangsong234 <zhangsong34@huawei.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 792a861..5881aec 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ VERSION := $(shell cat ./VERSION)
BEP_DIR=/tmp/syscontainer-tools-build-bep
BEP_FLAGS=-tmpdir=/tmp/syscontainer-tools-build-bep
-GO_LDFLAGS="-buildid=IdByiSula $(BEP_FLAGS) -extldflags=-static -extldflags=-Wl,-z,relro,-z,now -X main.gitCommit=${COMMIT} -X main.version=${VERSION}"
+GO_LDFLAGS="-buildid=IdByiSula $(BEP_FLAGS) -linkmode=external -extldflags=-static -extldflags=-Wl,-z,relro,-z,now -X main.gitCommit=${COMMIT} -X main.version=${VERSION}"
ENV = GOPATH=${GOPATH} \
CGO_ENABLED=1 \
--
1.8.3.1

View File

@ -4,7 +4,7 @@
#Basic Information
Name: syscontainer-tools
Version: 0.9
Release: 48
Release: 49
Summary: syscontainer tools for IT, work with iSulad
License: Mulan PSL v2
URL: https://gitee.com/openeuler/syscontainer-tools
@ -14,6 +14,7 @@ BuildRoot: %{_tmppath}/%{name}-root
Patch1: 0001-fix-failed-build-with-golang-1.15.5.patch
Patch2: 0002-syscontainer-tools-build-security-option.patch
Patch3: 0003-add-dt-test.patch
Patch4: 0004-enable-external-linkmode-for-cgo-build.patch
#Dependency
BuildRequires: glibc-static
@ -30,6 +31,8 @@ This is syscontainer tools, to make it work, you need a isulad and util-linux
%build
make init && make
strip build/syscontainer-hooks
strip build/syscontainer-tools
%install
HOOK_DIR=$RPM_BUILD_ROOT/var/lib/isulad/hooks
@ -115,6 +118,9 @@ chmod 0640 ${HOOK_SPEC}/hookspec.json
rm -rfv %{buildroot}
%changelog
* Mon Nov 13 2023 yangjiaqi <yangjiaqi16@huawei.com> - 0.9-49
- fix compile option
* Wed Feb 15 2023 yangjiaqi <yangjiaqi16@huawei.com> - 0.9-48
- add dt test for util.go