|
|
d018f5 |
From 1001f5a99439556c5ad3efe6045923e985a52f82 Mon Sep 17 00:00:00 2001
|
|
|
d018f5 |
From: =?UTF-8?q?Alejandro=20S=C3=A1ez?= <asm@redhat.com>
|
|
|
d018f5 |
Date: Wed, 23 Nov 2022 13:43:23 +0100
|
|
|
d018f5 |
Subject: [PATCH] Add %gobuild and %gotest
|
|
|
d018f5 |
|
|
|
d018f5 |
Both macros are define in rpm/macros.d/macros.go-compilers-gcc.
|
|
|
d018f5 |
CentOS Stream 9 go-srpm-macros discards that file and only installs rpm/macros.d/macros.go-srpm.
|
|
|
d018f5 |
|
|
|
d018f5 |
This commit adds %gobuild and %gotest to rpm/macros.d/macros.go-srpm with the same options that RHEL 8 uses.
|
|
|
d018f5 |
---
|
|
|
d018f5 |
rpm/macros.d/macros.go-srpm | 8 ++++++++
|
|
|
d018f5 |
1 file changed, 8 insertions(+)
|
|
|
d018f5 |
|
|
|
d018f5 |
diff --git a/rpm/macros.d/macros.go-srpm b/rpm/macros.d/macros.go-srpm
|
|
|
d018f5 |
index a46f81f..05cd6c9 100644
|
|
|
d018f5 |
--- a/rpm/macros.d/macros.go-srpm
|
|
|
d018f5 |
+++ b/rpm/macros.d/macros.go-srpm
|
|
|
d018f5 |
@@ -202,3 +202,11 @@ local processall = (rpm.expand("%{-a}") ~= "") and (rpm.expand("%{-z}") == "")
|
|
|
d018f5 |
local verbose = (rpm.expand("%{-v}") ~= "")
|
|
|
d018f5 |
go.files("alt", suffix, processall, verbose)
|
|
|
d018f5 |
}
|
|
|
d018f5 |
+
|
|
|
d018f5 |
+# Define commands for building
|
|
|
d018f5 |
+# BUILD_ID can be generated for golang build no matter of debuginfo
|
|
|
d018f5 |
+%gobuild(o:) \
|
|
|
d018f5 |
+CGO_CPPFLAGS="-D_FORTIFY_SOURCE=2 -fstack-protector-all" go build -compiler gc -buildmode pie '-tags=rpm_crashtraceback libtrust_openssl ' -ldflags "-linkmode=external -compressdwarf=false ${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**};\
|
|
|
d018f5 |
+
|
|
|
d018f5 |
+# Define commands for testing
|
|
|
d018f5 |
+%gotest() go test -compiler gc -ldflags "${LDFLAGS:-}" %{?**};
|
|
|
d018f5 |
--
|
|
|
d018f5 |
2.38.1
|
|
|
d018f5 |
|