diff --git a/golang.spec b/golang.spec index c2d0c71..2fd1d51 100644 --- a/golang.spec +++ b/golang.spec @@ -92,6 +92,20 @@ %global gohostarch s390x %endif +# Set the RHEL architecture baseline. +%if 0%{?rhel} < 9 +%global goamd64 v1 +%global goppc64 power8 +%else +%if 0%{?rhel} < 10 +%global goamd64 v2 +%global goppc64 power8 +%else +%global goamd64 v3 +%global goppc64 power9 +%endif +%endif + %global go_api 1.26 %global go_version 1.26.3 %global version %{go_version} @@ -275,6 +289,13 @@ popd sed -i '1s/$/ (%{?rhel:Red Hat} %{version}-%{release})/' VERSION +# Historically the ISA baselines have been set in modify-go.env.patch. +# This will prevent us sharing a specfile across major RHEL versions. +# As such, we must override the baselines set in the patch file. +sed -iE "s/^.*baseline for RHEL.*$//" go.env +sed -i "s/GOAMD64=.*/GOAMD64=%{goamd64}/" go.env +sed -i "s/GOPPC64=.*/GOPPC64=%{goppc64}/" go.env + cp %{SOURCE2} ./src/runtime/ # Delete the bundled race detector objects. find ./src/runtime/race/ -name "race_*.syso" -exec rm {} \;