1 Star 0 Fork 10

mxh/eggo

forked from src-openEuler/eggo 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0017-fix-Makefile-build-error.patch 2.48 KB
一键复制 编辑 原始数据 按行查看 历史
zhangxiaoyu 提交于 2022-09-19 20:03 . fix makefile build error
From ace481915286e8973821d80642ec56457331d07f Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Mon, 19 Sep 2022 16:37:07 +0800
Subject: [PATCH 17/17] fix Makefile build error
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
Makefile | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 4b6d7c7..d2c4d9e 100644
--- a/Makefile
+++ b/Makefile
@@ -9,26 +9,40 @@ ARCH = arm64
endif
endif
+TMP_PATH := /tmp/xxeggo
+
EXTRALDFLAGS :=
LDFLAGS := -X isula.org/eggo/cmd.Version=$(VERSION) \
-X isula.org/eggo/cmd.Commit=$(GIT_COMMIT) \
-X isula.org/eggo/cmd.BuildTime=$(SOURCE_DATE_EPOCH) \
-X isula.org/eggo/cmd.Arch=$(ARCH) \
$(EXTRALDFLAGS)
-STATIC_LDFLAGS := -extldflags=-static -linkmode=external
-SAFEBUILDFLAGS := -buildmode=pie -extldflags=-ftrapv -extldflags=-zrelro -extldflags=-znow -tmpdir=/tmp/xxeggo $(LDFLAGS)
+STATIC_LDFLAGS := -extldflags=-static -linkmode=external
+SAFEBUILDFLAGS := -buildmode=pie \
+ -extldflags=-ftrapv -extldflags=-zrelro -extldflags=-znow \
+ -linkmode=external \
+ -extldflags "-static-pie -Wl,-z,now" \
+ -tmpdir=$(TMP_PATH) \
+ $(LDFLAGS)
GO := go
-GO_BUILD := CGO_ENABLED=0 GOARCH=$(ARCH) $(GO)
+GO_BUILD := CGO_ENABLED=1 GOARCH=$(ARCH) $(GO)
+GO_SAFE_BUILD:= CGO_ENABLE=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" \
+ GOARCH=$(ARCH) \
+ $(GO)
.PHONY: eggo
eggo:
@echo "build eggo of $(ARCH) starting..."
- @$(GO_BUILD) build -ldflags '$(LDFLAGS) $(STATIC_LDFLAGS)' -o bin/eggo .
+ @$(GO_BUILD) build -ldflags '$(LDFLAGS) $(STATIC_LDFLAGS)' -o bin/eggo . 2>/dev/null
@echo "build eggo done!"
local:
@echo "build eggo use vendor starting..."
- @$(GO_BUILD) build -ldflags '$(LDFLAGS) $(STATIC_LDFLAGS)' -mod vendor -o bin/eggo .
+ @$(GO_BUILD) build -ldflags '$(LDFLAGS) $(STATIC_LDFLAGS)' -mod vendor -o bin/eggo . 2>/dev/null
@echo "build eggo use vendor done!"
test:
@echo "Unit tests starting..."
@@ -38,7 +52,9 @@ test:
.PHONY: safe
safe:
@echo "build safe eggo starting..."
- $(GO_BUILD) build -ldflags '$(SAFEBUILDFLAGS) $(STATIC_LDFLAGS)' -o bin/eggo .
+ mkdir -p $(TMP_PATH)
+ $(GO_SAFE_BUILD) build -ldflags '$(SAFEBUILDFLAGS)' -o bin/eggo .
+ rm -rf $(TMP_PATH)
@echo "build safe eggo done!"
images: image-eggo
--
2.25.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mxh111999/eggo.git
git@gitee.com:mxh111999/eggo.git
mxh111999
eggo
eggo
master

搜索帮助