%global forgeurl https://pagure.io/go-rpm-macros Version: 3.0.9 %forgemeta #https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51 %global _spectemplatedir %{_datadir}/rpmdevtools/fedora %global _docdir_fmt %{name} # Master definition that will be written to macro files %global golang_arches %{ix86} x86_64 %{arm} aarch64 ppc64le s390x %global gccgo_arches %{mips} %if 0%{?rhel} >= 9 %global golang_arches x86_64 aarch64 ppc64le s390x %endif # Go sources can contain arch-specific files and our macros will package the # correct files for each architecture. Therefore, move gopath to _libdir and # make Go devel packages archful %global gopath %{_datadir}/gocode ExclusiveArch: %{golang_arches} %{gccgo_arches} Name: go-rpm-macros Release: 9%{?dist} Summary: Build-stage rpm automation for Go packages License: GPLv3+ URL: %{forgeurl} Source: %{forgesource} Requires: go-srpm-macros = %{version}-%{release} Requires: go-filesystem = %{version}-%{release} %if (0%{?epel} || 0%{?fedora}) Requires: go-bundling-macros = %{version}-%{release} %endif # Refactor bundling related macros into their own files Patch0: factor-bundling-automation.patch %ifarch %{golang_arches} Requires: golang Provides: compiler(golang) Provides: compiler(go-compiler) = 2 Obsoletes: go-compilers-golang-compiler < %{version}-%{release} %endif %ifarch %{gccgo_arches} Requires: gcc-go Provides: compiler(gcc-go) Provides: compiler(go-compiler) = 1 Obsoletes: go-compilers-gcc-go-compiler < %{version}-%{release} %endif %description This package provides build-stage rpm automation to simplify the creation of Go language (golang) packages. It does not need to be included in the default build root: go-srpm-macros will pull it in for Go packages only. %package -n go-srpm-macros Summary: Source-stage rpm automation for Go packages BuildArch: noarch Requires: redhat-rpm-config %description -n go-srpm-macros This package provides SRPM-stage rpm automation to simplify the creation of Go language (golang) packages. It limits itself to the automation subset required to create Go SRPM packages and needs to be included in the default build root. The rest of the automation is provided by the go-rpm-macros package, that go-srpm-macros will pull in for Go packages only. %if (0%{?epel} || 0%{?fedora}) %package -n go-bundling-macros Summary: Macros for bundled subpackage generation License: GPLv3+ Requires: golist %description -n go-bundling-macros This package contains macros for generating subpackages for bundled Go dependencies. %endif %package -n go-filesystem Summary: Directories used by Go packages License: Public Domain %description -n go-filesystem This package contains the basic directory layout used by Go packages. %package -n go-rpm-templates Summary: RPM spec templates for Go packages License: MIT BuildArch: noarch Requires: go-rpm-macros = %{version}-%{release} #https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51 #Requires: redhat-rpm-templates %description -n go-rpm-templates This package contains documented rpm spec templates showcasing how to use the macros provided by go-rpm-macros to create Go packages. %prep %forgesetup %writevars -f rpm/macros.d/macros.go-srpm golang_arches gccgo_arches gopath if ls templates/rpm/*\.spec; then for template in templates/rpm/*\.spec ; do target=$(echo "${template}" | sed "s|^\(.*\)\.spec$|\1-bare.spec|g") grep -v '^#' "${template}" > "${target}" touch -r "${template}" "${target}" done fi %patch0 -p1 %install # Some of those probably do not work with gcc-go right now # This is not intentional, but mips is not a primary Fedora architecture # Patches and PRs are welcome %if ! (0%{?epel} || 0%{?fedora}) rm bin/* rm rpm/*.prov rm rpm/*.deps rm rpm/fileattrs/gobundled.attr rm rpm/fileattrs/gosymlink.attr rm rpm/fileattrs/go-bundle.attr rm rpm/macros.d/macros.go-bundle-rpm rm rpm/macros.d/macros.go-bundle-srpm rm rpm/macros.d/macros.go-compilers-golang-nopie rm rpm/macros.d/macros.go-compilers-golang-pie rm rpm/macros.d/macros.go-rpm.internal rm rpm/lua/rpm/go-bundle.lua rm rpm/lua/srpm/go-bundle.lua %endif install -m 0755 -vd %{buildroot}%{gopath}/src install -m 0755 -vd %{buildroot}%{_spectemplatedir} install -m 0644 -vp templates/rpm/*spec \ %{buildroot}%{_spectemplatedir} install -m 0755 -vd %{buildroot}%{rpmmacrodir} install -m 0644 -vp rpm/macros.d/macros.go-* \ %{buildroot}%{rpmmacrodir} install -m 0755 -vd %{buildroot}%{_rpmluadir}/fedora/srpm install -m 0644 -vp rpm/lua/srpm/*lua \ %{buildroot}%{_rpmluadir}/fedora/srpm install -m 0755 -vd %{buildroot}%{_rpmluadir}/fedora/rpm install -m 0644 -vp rpm/lua/rpm/*lua \ %{buildroot}%{_rpmluadir}/fedora/rpm install -m 0755 -vd %{buildroot}%{_rpmconfigdir}/fileattrs install -m 0644 -vp rpm/fileattrs/*.attr \ %{buildroot}%{_rpmconfigdir}/fileattrs/ %if (0%{?epel} || 0%{?fedora}) install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 bin/* %{buildroot}%{_bindir} install -m 0755 -vp rpm/*\.{prov,deps} \ %{buildroot}%{_rpmconfigdir}/ %endif %ifarch %{golang_arches} install -m 0644 -vp rpm/macros.d/macros.go-compilers-golang \ %{buildroot}%{_rpmconfigdir}/macros.d/macros.go-compiler-golang %endif %ifarch %{gccgo_arches} install -m 0644 -vp rpm/macros.d/macros.go-compilers-gcc \ %{buildroot}%{_rpmconfigdir}/macros.d/macros.go-compiler-gcc %endif %files %license LICENSE.txt %doc README.md %{_rpmconfigdir}/fileattrs/*.attr %{_rpmconfigdir}/macros.d/macros.go-rpm* %{_rpmconfigdir}/macros.d/macros.go-compiler* %{_rpmluadir}/fedora/rpm/*.lua %if (0%{?epel} || 0%{?fedora}) %exclude %{_rpmconfigdir}/fileattrs/go-bundle.attr %exclude %{_rpmconfigdir}/macros.d/macros.go-compilers-golang-nopie %exclude %{_rpmconfigdir}/macros.d/macros.go-compilers-golang-pie %exclude %{_rpmconfigdir}/macros.d/macros.go-rpm.internal %exclude %{_rpmluadir}/fedora/rpm/go-bundle.lua %exclude %{_rpmconfigdir}/macros.d/macros.go-bundle-rpm %exclude %{_rpmconfigdir}/macros.d/macros.go-bundle-srpm %exclude %{_rpmconfigdir}/fileattrs/gobundled.attr %exclude %{_rpmconfigdir}/fileattrs/gosymlink.attr %endif %files -n go-srpm-macros %license LICENSE.txt %doc README.md %{_rpmconfigdir}/macros.d/macros.go-srpm %{_rpmluadir}/fedora/srpm/*.lua %exclude %{_rpmluadir}/fedora/srpm/go-bundle.lua %files -n go-filesystem %dir %{gopath} %dir %{gopath}/src %files -n go-rpm-templates %license LICENSE-templates.txt %doc README.md # https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/51 %dir %{dirname:%{_spectemplatedir}} %dir %{_spectemplatedir} %{_spectemplatedir}/*.spec %if (0%{?epel} || 0%{?fedora}) %files -n go-bundling-macros %license LICENSE.txt %doc README.md %{_bindir}/* %{_rpmconfigdir}/*.prov %{_rpmconfigdir}/*.deps %{_rpmconfigdir}/fileattrs/gobundled.attr %{_rpmconfigdir}/fileattrs/gosymlink.attr %{_rpmconfigdir}/macros.d/macros.go-compilers-golang-nopie %{_rpmconfigdir}/macros.d/macros.go-compilers-golang-pie %{_rpmconfigdir}/macros.d/macros.go-rpm.internal %{_rpmconfigdir}/fileattrs/go-bundle.attr %{_rpmluadir}/fedora/rpm/go-bundle.lua %{_rpmluadir}/fedora/srpm/go-bundle.lua %{_rpmconfigdir}/macros.d/macros.go-bundle-rpm %{_rpmconfigdir}/macros.d/macros.go-bundle-srpm %endif %changelog * Wed Dec 22 2021 David Benoit 3.0.9-9 - Factor bundling automation into optional subpackage - Related: rhbz#1999335 * Mon Aug 09 2021 Mohan Boddu - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688 * Tue Aug 03 2021 David Benoit 3.0.9-7 - Escape quotation marks in gobuildflags - Resolves: rhbz#1988717 * Tue Jul 27 2021 David Benoit 3.0.9-6 - Remove arch conditional on gocompilerflags - Related: rhbz#1982298 * Fri Jul 23 2021 David Benoit 3.0.9-5 - Remove fedora-specific Go dependency automation macros - Remove dependency on golist - Temporarily remove incompatible template spec files - Update gobuild flags - Resolves: rhbz#1982298 * Thu Apr 15 2021 Mohan Boddu - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 * Thu Feb 11 2021 Jeff Law - 3.0.9-3 - Drop 32 bit arches in EL 9 (originally from Petr Sabata) * Tue Jan 26 2021 Fedora Release Engineering - 3.0.9-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild * Thu Aug 13 2020 Neal Gompa - 3.0.9-1 - Update to 3.0.9 * Mon Jul 27 2020 Fedora Release Engineering - 3.0.8-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild * Tue Jan 28 2020 Fedora Release Engineering - 3.0.8-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild * Thu Jul 25 2019 Fedora Release Engineering - 3.0.8-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild * Wed Jun 05 2019 Nicolas Mailhot - 3.0.8-3 - initial Fedora import, for golist 0.10.0 and redhat-rpm-config 130