upgrade rubik to v1.0.0-1. more info about this release: https://gitee.com/openeuler/rubik/releases/tag/v1.0.0. And optimized compilation instruction.
48 lines
1.6 KiB
Diff
48 lines
1.6 KiB
Diff
From d8e0e3d724f2fc85886cf087eea3cc89f8aa6630 Mon Sep 17 00:00:00 2001
|
|
From: xiadanni <xiadanni1@huawei.com>
|
|
Date: Mon, 27 Dec 2021 16:52:03 +0800
|
|
Subject: [PATCH] rubik: enable GO111MODULE and Optimized compilation
|
|
instruction
|
|
|
|
Signed-off-by: xiadanni <xiadanni1@huawei.com>
|
|
---
|
|
Makefile | 10 +++++++---
|
|
1 file changed, 7 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/Makefile b/Makefile
|
|
index 4285721..8d943cc 100644
|
|
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -21,21 +21,25 @@ RELEASE :=$(if $(shell awk -F"-" '{print $$2}' < $(VERSION_FILE)),$(shell awk -F
|
|
BUILD_TIME := $(shell date "+%Y-%m-%d")
|
|
GIT_COMMIT := $(if $(shell git rev-parse --short HEAD),$(shell git rev-parse --short HEAD),$(shell cat ./git-commit | head -c 7))
|
|
|
|
+export GO111MODULE=on
|
|
+
|
|
DEBUG_FLAGS := -gcflags="all=-N -l"
|
|
LD_FLAGS := -ldflags '-buildid=none -tmpdir=$(TMP_DIR) \
|
|
-X isula.org/rubik/pkg/version.GitCommit=$(GIT_COMMIT) \
|
|
-X isula.org/rubik/pkg/version.BuildTime=$(BUILD_TIME) \
|
|
-X isula.org/rubik/pkg/version.Version=$(VERSION) \
|
|
-X isula.org/rubik/pkg/version.Release=$(RELEASE) \
|
|
- -extldflags=-ftrapv \
|
|
- -extldflags=-Wl,-z,relro,-z,now -linkmode=external -extldflags=-static'
|
|
+ -buildmode=pie \
|
|
+ -extldflags=-ftrapv -extldflags=-zrelro -extldflags=-znow \
|
|
+ -linkmode=external \
|
|
+ -extldflags "-static-pie -Wl,-z,now"'
|
|
|
|
GO_BUILD=CGO_ENABLED=1 \
|
|
CGO_CFLAGS="-fstack-protector-strong -fPIE" \
|
|
CGO_CPPFLAGS="-fstack-protector-strong -fPIE" \
|
|
CGO_LDFLAGS_ALLOW='-Wl,-z,relro,-z,now' \
|
|
CGO_LDFLAGS="-Wl,-z,relro,-z,now -Wl,-z,noexecstack" \
|
|
- go build -buildmode=pie
|
|
+ go build -mod=vendor
|
|
|
|
all: release
|
|
|
|
--
|
|
2.30.2
|
|
|