|
7 | 7 | %global debug_package %{nil}
|
8 | 8 | %endif
|
9 | 9 |
|
10 |
| -# RHEL's default %%gobuild macro doesn't account for the BUILDTAGS variable, so we |
11 |
| -# set it separately here and do not depend on RHEL's go-[s]rpm-macros package |
12 |
| -# until that's fixed. |
13 |
| -# c9s bz: https://bugzilla.redhat.com/show_bug.cgi?id=2227328 |
14 |
| -%if %{defined rhel} && 0%{?rhel} < 10 |
15 |
| -%define gobuild(o:) go build -buildmode pie -compiler gc -tags="rpm_crashtraceback libtrust_openssl ${BUILDTAGS:-}" -ldflags "-linkmode=external -compressdwarf=false ${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**}; |
16 |
| -%endif |
17 |
| - |
18 | 10 | %global gomodulesmode GO111MODULE=on
|
19 | 11 |
|
20 |
| -%if %{defined rhel} |
21 |
| -# _user_tmpfiles.d currently undefined on rhel |
22 |
| -%global _user_tmpfilesdir %{_datadir}/user-tmpfiles.d |
23 |
| -%endif |
24 |
| - |
25 | 12 | %if %{defined fedora}
|
26 | 13 | %define build_with_btrfs 1
|
27 | 14 | # qemu-system* isn't packageed for CentOS Stream / RHEL
|
|
32 | 19 | %define copr_build 1
|
33 | 20 | %endif
|
34 | 21 |
|
| 22 | +# Only RHEL and CentOS Stream rpms are built with fips-enabled go compiler |
| 23 | +%if %{defined rhel} |
| 24 | +%define fips_enabled 1 |
| 25 | +%endif |
| 26 | + |
35 | 27 | %global container_base_path github.com/containers
|
36 | 28 | %global container_base_url https://%{container_base_path}
|
37 | 29 |
|
@@ -251,6 +243,14 @@ LDFLAGS="-X %{ld_libpod}/define.buildInfo=${SOURCE_DATE_EPOCH:-$(date +%s)} \
|
251 | 243 |
|
252 | 244 | export BASEBUILDTAGS="seccomp exclude_graphdriver_devicemapper $(hack/systemd_tag.sh) $(hack/libsubid_tag.sh)"
|
253 | 245 |
|
| 246 | +# libtrust_openssl buildtag switches to using the FIPS-compatible func |
| 247 | +# `ecdsa.HashSign`. |
| 248 | +# Ref 1: https://github.com/golang-fips/go/blob/main/patches/015-add-hash-sign-verify.patch#L22 |
| 249 | +# Ref 2: https://github.com/containers/libtrust/blob/main/ec_key_openssl.go#L23 |
| 250 | +%if %{defined fips_enabled} |
| 251 | +export BASEBUILDTAGS="$BASEBUILDTAGS libtrust_openssl" |
| 252 | +%endif |
| 253 | + |
254 | 254 | # build %%{name}
|
255 | 255 | export BUILDTAGS="$BASEBUILDTAGS $(hack/btrfs_installed_tag.sh) $(hack/btrfs_tag.sh) $(hack/libdm_tag.sh)"
|
256 | 256 | %gobuild -o bin/%{name} ./cmd/%{name}
|
|
0 commit comments