|
|
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 |
|
|
|
92f5a5 |
# whether to bundle golist or require it as a dependency
|
|
|
92f5a5 |
%global bundle_golist 1
|
|
|
92f5a5 |
|
|
|
92f5a5 |
%if 0%{?bundle_golist}
|
|
|
92f5a5 |
# do not create debuginfo packages when we add a build section
|
|
|
92f5a5 |
%global debug_package %{nil}
|
|
|
92f5a5 |
%global golist_version 0.10.1
|
|
|
92f5a5 |
%global golist_builddir %{_builddir}/golist-%{golist_version}/_build
|
|
|
92f5a5 |
%global golist_goipath pagure.io/golist
|
|
|
92f5a5 |
# where to bundle the golist executable
|
|
|
92f5a5 |
%global golist_execdir %{_libexecdir}/go-rpm-macros/
|
|
|
92f5a5 |
# define gobuild to avoid this package requiring itself to build
|
|
|
92f5a5 |
%define gobuild(o:) GO111MODULE=off go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v %{?**};
|
|
|
92f5a5 |
%endif
|
|
|
92f5a5 |
|
|
|
92bf05 |
ExclusiveArch: %{golang_arches} %{gccgo_arches}
|
|
|
92bf05 |
|
|
|
92bf05 |
Name: go-rpm-macros
|
|
|
92f5a5 |
Release: 9%{?dist}
|
|
|
92bf05 |
Summary: Build-stage rpm automation for Go packages
|
|
|
92bf05 |
|
|
|
92bf05 |
License: GPLv3+
|
|
|
92bf05 |
URL: %{forgeurl}
|
|
|
92f5a5 |
Source0: %{forgesource}
|
|
|
92f5a5 |
%if 0%{?bundle_golist}
|
|
|
92f5a5 |
Source1: https://pagure.io/golist/archive/v%{golist_version}/golist-%{golist_version}.tar.gz
|
|
|
92f5a5 |
%endif
|
|
|
92bf05 |
|
|
|
92bf05 |
Requires: go-srpm-macros = %{version}-%{release}
|
|
|
92bf05 |
Requires: go-filesystem = %{version}-%{release}
|
|
|
92bf05 |
|
|
|
92f5a5 |
%if 0%{?bundle_golist}
|
|
|
92f5a5 |
BuildRequires: golang
|
|
|
92f5a5 |
%else
|
|
|
92f5a5 |
Requires: golist
|
|
|
92f5a5 |
%endif
|
|
|
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 |
|
|
|
92f5a5 |
Patch0: update-default-gobuild-args.patch
|
|
|
92f5a5 |
# Replace golang-github-urfave-cli with a minimal
|
|
|
92f5a5 |
# command line parser backend to bootstrap golist
|
|
|
92f5a5 |
# without dependencies.
|
|
|
92f5a5 |
Patch1: golist-bootstrap-cli-no-vendor.patch
|
|
|
92f5a5 |
|
|
|
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 |
%forgesetup
|
|
|
92bf05 |
|
|
|
92bf05 |
%patch0 -p1
|
|
|
92bf05 |
|
|
|
92bf05 |
%writevars -f rpm/macros.d/macros.go-srpm golang_arches gccgo_arches gopath
|
|
|
92f5a5 |
for template in templates/rpm/*\.spec ; do
|
|
|
92f5a5 |
target=$(echo "${template}" | sed "s|^\(.*\)\.spec$|\1-bare.spec|g")
|
|
|
92f5a5 |
grep -v '^#' "${template}" > "${target}"
|
|
|
92f5a5 |
touch -r "${template}" "${target}"
|
|
|
92f5a5 |
done
|
|
|
92f5a5 |
|
|
|
92f5a5 |
# unpack golist and patch
|
|
|
92f5a5 |
%if 0%{?bundle_golist}
|
|
|
92f5a5 |
pushd %{_builddir}
|
|
|
92f5a5 |
tar -xf %{_sourcedir}/golist-%{golist_version}.tar.gz
|
|
|
92f5a5 |
cd golist-%{golist_version}
|
|
|
92f5a5 |
%patch1 -p1
|
|
|
92f5a5 |
cp %{_builddir}/golist-%{golist_version}/LICENSE %{_builddir}/go-rpm-macros-%{version}/LICENSE-golist
|
|
|
92f5a5 |
popd
|
|
|
92f5a5 |
|
|
|
92f5a5 |
# create directory structure for a Go build
|
|
|
92f5a5 |
if [[ ! -e %{golist_builddir}/bin ]]; then
|
|
|
92f5a5 |
install -m 0755 -vd %{golist_builddir}/bin
|
|
|
92f5a5 |
export GOPATH=%{golist_builddir}:${GOPATH:+${GOPATH}:}/usr/share/gocode
|
|
|
92f5a5 |
fi
|
|
|
92f5a5 |
if [[ ! -e %{golist_builddir}/src/%{golist_goipath} ]]; then
|
|
|
92f5a5 |
install -m 0755 -vd %{golist_builddir}/src/pagure.io
|
|
|
92f5a5 |
ln -sf $(dirname %{golist_builddir}) %{golist_builddir}/src/%{golist_goipath}
|
|
|
92f5a5 |
|
|
|
92bf05 |
fi
|
|
|
92f5a5 |
%endif
|
|
|
92f5a5 |
|
|
|
92f5a5 |
%build
|
|
|
92f5a5 |
# build golist
|
|
|
92f5a5 |
%if 0%{?bundle_golist}
|
|
|
92f5a5 |
pushd %{golist_builddir}/src/%{golist_goipath}
|
|
|
92f5a5 |
export GOPATH=%{golist_builddir}:${GOPATH:+${GOPATH}:}/usr/share/gocode
|
|
|
92f5a5 |
for cmd in cmd/* ; do
|
|
|
92f5a5 |
%gobuild -o %{golist_builddir}/bin/$(basename $cmd) %{golist_goipath}/$cmd
|
|
|
92f5a5 |
done
|
|
|
92f5a5 |
popd
|
|
|
92f5a5 |
%endif
|
|
|
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 |
|
|
|
92f5a5 |
install -m 0755 -vd %{buildroot}%{_bindir}
|
|
|
92f5a5 |
install -m 0755 bin/* %{buildroot}%{_bindir}
|
|
|
92f5a5 |
|
|
|
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/
|
|
|
92f5a5 |
install -m 0755 -vp rpm/*\.{prov,deps} \
|
|
|
92f5a5 |
%{buildroot}%{_rpmconfigdir}/
|
|
|
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 |
|
|
|
92f5a5 |
# install golist
|
|
|
92f5a5 |
%if 0%{?bundle_golist}
|
|
|
92f5a5 |
install -m 0755 -vd %{buildroot}%{golist_execdir}
|
|
|
92f5a5 |
install -m 0755 -vp %{golist_builddir}/bin/* %{buildroot}%{golist_execdir}/
|
|
|
92f5a5 |
sed -i "s,golist,%{golist_execdir}/golist,g" %{buildroot}%{_bindir}/go-rpm-integration
|
|
|
92f5a5 |
%endif
|
|
|
92f5a5 |
|
|
|
92bf05 |
%files
|
|
|
92f5a5 |
%license LICENSE.txt LICENSE-golist
|
|
|
92bf05 |
%doc README.md
|
|
|
92f5a5 |
%{_bindir}/*
|
|
|
92bf05 |
%{_rpmconfigdir}/fileattrs/*.attr
|
|
|
92f5a5 |
%{_rpmconfigdir}/*.prov
|
|
|
92f5a5 |
%{_rpmconfigdir}/*.deps
|
|
|
92bf05 |
%{_rpmconfigdir}/macros.d/macros.go-rpm*
|
|
|
92bf05 |
%{_rpmconfigdir}/macros.d/macros.go-compiler*
|
|
|
92bf05 |
%{_rpmluadir}/fedora/rpm/*.lua
|
|
|
92f5a5 |
# package golist
|
|
|
92f5a5 |
%if 0%{?bundle_golist}
|
|
|
92f5a5 |
%{golist_execdir}/golist
|
|
|
92f5a5 |
%endif
|
|
|
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}
|
|
|
92f5a5 |
%{_spectemplatedir}/*.spec
|
|
|
92bf05 |
|
|
|
92bf05 |
%changelog
|
|
|
92f5a5 |
* Tue Jan 18 2022 David Benoit <dbenoit@redhat.com> 3.0.9-9
|
|
|
92f5a5 |
- Delete remove-fedora-dependency-automation.patch
|
|
|
92f5a5 |
- Bundle golist in /usr/libexec
|
|
|
92f5a5 |
- Related: rhbz#2043107
|
|
|
92f5a5 |
|
|
|
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 |
|
|
|
92f5a5 |
* Tue 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
|