The commit message in the second patch has details of key rationale for this change. Essentially though in libvirt, we are integrating Go code for parts of our project and this code is built by our existing build system. It is not possible to have RPM directly run "go build", so we need to pass Go build flags to make.
Along with these patches, the Fedora rawhide go-rpm-macros spec file would need the following change
diff --git a/go-rpm-macros.spec b/go-rpm-macros.specindex 83e02d7..8de41a6 100644--- a/go-rpm-macros.spec+++ b/go-rpm-macros.spec@@ -7,7 +7,9 @@ Version: 3.0.8%global _docdir_fmt %{name}
# Master definition that will be written to macro files
-%global golang_arches %{ix86} x86_64 %{arm} aarch64 ppc64le s390x+%global golang_pie_arches %{ix86} x86_64 %{arm} aarch64 s390x+%global golang_nopie_arches ppc64le+%global golang_arches %{golang_pie_arches} %{golang_nopie_arches}%global gccgo_arches %{mips}
# Go sources can contain arch-specific files and our macros will package the
# correct files for each architecture. Therefore, move gopath to _libdir and
@@ -125,6 +127,12 @@ install -m 0755 -vp rpm/*\.{prov,deps} \%ifarch %{golang_arches}
install -m 0644 -vp rpm/macros.d/macros.go-compilers-golang \
%{buildroot}%{_rpmconfigdir}/macros.d/macros.go-compiler-golang
+%ifarch %{golang_pie_arches}+rm -f %{buildroot}/%{_rpmconfigdir}/macros.d/macros.go-compilers-golang-nopie+%endif+%ifarch %{golang_nopie_arches}+rm -f %{buildroot}/%{_rpmconfigdir}/macros.d/macros.go-compilers-golang-pie+%endif%endif
%ifarch %{gccgo_arches}
I've tested this with the trivial app using a specfile that does this:
The commit message in the second patch has details of key rationale for this change. Essentially though in libvirt, we are integrating Go code for parts of our project and this code is built by our existing build system. It is not possible to have RPM directly run "go build", so we need to pass Go build flags to make.
Along with these patches, the Fedora rawhide go-rpm-macros spec file would need the following change
I've tested this with the trivial app using a specfile that does this:
which calls a makefile which does this