%define bootstrap 0 %global forgeurl https://pagure.io/go-rpm-macros Version: 3.2.0 %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_future x86_64 %{arm} aarch64 ppc64le s390x %global golang_arches %{ix86} %{golang_arches_future} %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 # make Go devel packages archful %global gopath %{_datadir}/gocode ExclusiveArch: %{golang_arches} %{gccgo_arches} Name: go-rpm-macros Release: %mkrel 1 Summary: Build-stage rpm automation for Go packages Group: Development/Other License: GPLv3+ URL: https://pagure.io/go-rpm-macros Source: https://pagure.io/go-rpm-macros/archive/%{version}/go-rpm-macros-%{version}.tar.gz Requires: go-srpm-macros = %{version}-%{release} Requires: go-filesystem = %{version}-%{release} %if !%{bootstrap} Requires: golist %endif %ifarch %{golang_arches} Requires: golang Provides: compiler(golang) Provides: compiler(go-compiler) = 2 %endif %ifarch %{gccgo_arches} Requires: gcc-go Provides: compiler(gcc-go) Provides: compiler(go-compiler) = 1 %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: rpm-mageia-setup-build %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. %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} %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 golang_arches_future gccgo_arches gopath 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 %install install -m 0755 -vd %{buildroot}%{_rpmmacrodir} install -m 0755 -vd %{buildroot}%{_rpmluadir}/fedora/srpm install -m 0644 -vp rpm/lua/srpm/*lua \ %{buildroot}%{_rpmluadir}/fedora/srpm %ifarch %{golang_arches} %{gccgo_arches} # 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 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}%{_bindir} install -m 0755 bin/* %{buildroot}%{_bindir} install -m 0644 -vp rpm/macros.d/macros.go-*rpm* \ %{buildroot}%{_rpmmacrodir} 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/ install -m 0755 -vp rpm/*\.{prov,deps} \ %{buildroot}%{_rpmconfigdir}/ %else install -m 0644 -vp rpm/macros.d/macros.go-srpm \ %{buildroot}%{_rpmmacrodir} %endif %ifarch %{golang_arches} install -m 0644 -vp rpm/macros.d/macros.go-compilers-golang{,-pie} \ %{buildroot}%{_rpmconfigdir}/macros.d/ %endif %ifarch %{gccgo_arches} install -m 0644 -vp rpm/macros.d/macros.go-compilers-gcc \ %{buildroot}%{_rpmconfigdir}/macros.d/ %endif %ifarch %{golang_arches} %{gccgo_arches} %files %doc LICENSE.txt README.md %{_bindir}/* %{_rpmconfigdir}/fileattrs/*.attr %{_rpmconfigdir}/*.prov %{_rpmconfigdir}/*.deps %{_rpmmacrodir}/macros.go-rpm* %{_rpmmacrodir}/macros.go-compiler* %{_rpmluadir}/fedora/rpm/*.lua %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 %files -n go-filesystem %dir %{gopath} %dir %{gopath}/src %endif # we only build go-srpm-macros on all architectures %files -n go-srpm-macros %license LICENSE.txt %doc README.md %{_rpmmacrodir}/macros.go-srpm %{_rpmluadir}/fedora/srpm/*.lua %changelog * Tue Sep 06 2022 guillomovitch <guillomovitch> 3.2.0-1.mga9 + Revision: 1884405 - new version 3.2.0 * Tue Aug 16 2022 guillomovitch <guillomovitch> 3.1.0-1.mga9 + Revision: 1878174 - new version 3.1.0 * Tue Mar 15 2022 umeabot <umeabot> 3.0.15-2.mga9 + Revision: 1793888 - Mageia 9 Mass Rebuild * Sat Feb 05 2022 guillomovitch <guillomovitch> 3.0.15-1.mga9 + Revision: 1771681 - new version 3.0.15 * Sun Jan 23 2022 guillomovitch <guillomovitch> 3.0.13-1.mga9 + Revision: 1769550 - new version 3.0.13 * Wed Jul 14 2021 guillomovitch <guillomovitch> 3.0.11-1.mga9 + Revision: 1735965 - new version 3.0.11 * Sat May 01 2021 guillomovitch <guillomovitch> 3.0.10-1.mga9 + Revision: 1720717 - new version 3.0.10 * Sat Aug 15 2020 guillomovitch <guillomovitch> 3.0.9-1.mga8 + Revision: 1614118 - new version 3.0.9 * Fri Mar 13 2020 guillomovitch <guillomovitch> 3.0.8-2.mga8 + Revision: 1555993 - non-bootstrap build - requires rpm-mageia-setup-build, not redhat-rpm-config - bootstrap build * Fri Dec 13 2019 guillomovitch <guillomovitch> 3.0.8-1.mga8 + Revision: 1466186 - imported package go-rpm-macros