Blame SPECS/go-rpm-macros.spec

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