binutils/spec.binutils.cross

97 lines
2.9 KiB
Plaintext
Raw Normal View History

# Note - this is an rpm spec file, but it has been renamed in order to avoid
# conflict with the real binutils.spec file.
#
# Its only use is intened to be to build a cross-binutils rpm by installing it
# into an rpmbuild tree where the binutils source rpm has already been placed.
# It should be run as:
#
# rpmbuild -bb spec.binutils.cross
Summary: A meta collection of GNU binutils executables for cross builds
Name: cross-binutils
# Note: KEEP THE Version and Release fields IN SYNC with binutils.spec
Version: 2.35.1
Release: 14%{?dist}
License: GPLv3+
URL: https://sourceware.org/binutils
Source: binutils.spec
# Provides: bundled(libiberty)
BuildRequires: autoconf automake
BuildRequires: perl, sed, coreutils
BuildRequires: gcc
BuildRequires: gettext, flex, zlib-devel
BuildRequires: findutils
BuildRequires: dejagnu, zlib-static, glibc-static, sharutils, bc
BuildRequires: elfutils-debuginfod-client-devel
BuildRequires: rpm-build
Requires(post): %{_sbindir}/alternatives
Requires(post): coreutils
Requires(preun): %{_sbindir}/alternatives
#----------------------------------------------------------------------------
%description
Provides a collection of cross built binutils for the targets
supported by RHEL (aarch64, i686, ppc64le, s390x).
# Note - this list assumes that we are building on an x86_64-linux-gnu host.
%define arch_list aarch64-linux-gnu i686-linux-gnu ppc64le-linux-gnu s390x-linux-gnu
#----------------------------------------------------------------------------
%prep
#----------------------------------------------------------------------------
%build
# Build each set of cross binutils individually.
for f in %{arch_list}; do
rpmbuild -bb --define "binutils_target $f" %{_specdir}/binutils.spec --without testsuite
done
# Then unpack them ...
# FIXME: There are two possible destinations for built rpms...
# FIXME: Handle this more cleanly than the duplicated for loops below.
if [ -d %{_rpmdir}/%{_arch} ] ; then
for f in %{arch_list}; do
rpm2cpio %{_rpmdir}/%{_arch}/$f-binutils-%{version}-%{release}.%{_arch}.rpm | cpio -idmv
done
else
for f in %{arch_list}; do
rpm2cpio %{_rpmdir}/$f-binutils-%{version}-%{release}.%{_arch}.rpm | cpio -idmv
done
fi
#----------------------------------------------------------------------------
%install
# Take all of the unpacked executables and put them together in one place.
# FIXME: This ought to make use of %%{_bindir}
mkdir -p %{_buildrootdir}/cross-binutils-%{version}-%{release}.%{_arch}/usr/bin
mv usr/bin/* %{_buildrootdir}/cross-binutils-%{version}-%{release}.%{_arch}/usr/bin
#----------------------------------------------------------------------------
%files
%{_bindir}/aarch64-linux-gnu-*
%{_bindir}/i686-linux-gnu-*
%{_bindir}/ppc64le-linux-gnu-*
%{_bindir}/s390x-linux-gnu-*
#----------------------------------------------------------------------------
%changelog
* Wed Nov 11 2020 Nick Clifton <nickc@redhat.com> - 2.35.1-14
- First release of cross binutils rpm.