From b24581760755eb4f560b8db2130244225d37b85d Mon Sep 17 00:00:00 2001 From: zhangsong234 Date: Thu, 2 Sep 2021 20:59:24 +0800 Subject: [PATCH] syscontainer-tools: enable external linkmode for cgo build Signed-off-by: zhangsong234 --- ...able-external-linkmode-for-cgo-build.patch | 26 +++++++++++++++++++ syscontainer-tools.spec | 9 ++++--- 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 0003-enable-external-linkmode-for-cgo-build.patch diff --git a/0003-enable-external-linkmode-for-cgo-build.patch b/0003-enable-external-linkmode-for-cgo-build.patch new file mode 100644 index 0000000..37c5192 --- /dev/null +++ b/0003-enable-external-linkmode-for-cgo-build.patch @@ -0,0 +1,26 @@ +From df6545261395654bdba369e23b7b4fd6705cad93 Mon Sep 17 00:00:00 2001 +From: zhangsong234 +Date: Thu, 2 Sep 2021 20:49:07 +0800 +Subject: [PATCH] enable external linkmode for cgo build + +Signed-off-by: zhangsong234 +--- + 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 + diff --git a/syscontainer-tools.spec b/syscontainer-tools.spec index 2ed0adb..6528f20 100644 --- a/syscontainer-tools.spec +++ b/syscontainer-tools.spec @@ -1,10 +1,7 @@ -#Global macro or variabl -%define debug_package %{nil} - #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 @@ -13,6 +10,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-enable-external-linkmode-for-cgo-build.patch #Dependency BuildRequires: glibc-static @@ -111,6 +109,9 @@ chmod 0640 ${HOOK_SPEC}/hookspec.json rm -rfv %{buildroot} %changelog +* Thu Sep 02 2021 zhangsong234 - 0.9-49 +- DESC: enable external linkmode for cgo build + * Fri Jul 30 2021 chenyanpanHW - 0.9-48 - DESC: delete -Sgit from %autosetup