File cross-arm-none-eabi-binutils-bootstrap.spec of Package cross-arm-none-eabi-binutils
#
# spec file for package cross-arm-none-eabi-binutils
#
# Copyright (c) 2022-2025 SUSE LLC
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global binutils_ver 2.44.0
%global processor_arch arm
%global target %{processor_arch}-none-eabi
%global cross_target cross-%{target}
%define DIST %(echo '%distribution' | sed 's/ (.*)//')
%define with_gdb 0
%define bootstrap 1
Name: %{cross_target}-binutils
Version: %{binutils_ver}
Release: 1
Summary: GNU Binutils for cross-compilation for %{target} target
Group: Development/Tools
# Most of the sources are licensed under GPLv3+ with these exceptions:
# LGPLv2+ bfd/hosts/x86-64linux.h, include/demangle.h, include/xregex2.h,
# GPLv2+ gprof/cg_print.h
# BSD gprof/cg_arcs.h, gprof/utils.c, ld/elf-hints-local.h,
# Public Domain libiberty/memmove.c
License: GPL-2.0+ and GPL-3.0+ and LGPL-2.0+ and BSD-2-Clause and BSD-3-Clause
URL: https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
Source0: binutils-gdb-%{version}.tar.bz2
BuildRequires: gcc-c++
BuildRequires: makeinfo
BuildRequires: flex
BuildRequires: bison
BuildRequires: gmp-devel >= 4.2
BuildRequires: mpfr-devel >= 3.1.0
BuildRequires: python3-devel
#BuildRequires: cloog-isl-devel
BuildRequires: ppl-devel
BuildRequires: chrpath
#BuildRequires: texinfo-tex
#BuildRequires: perl-podlators
Provides: %{target}-binutils = %{binutils_ver}
%description
This is a cross-compilation version of GNU Binutils, which can be used to
assemble and link binaries for the %{target} platform.
%if %{with_gdb}
%package -n %{cross_target}-gdb
Summary: The GNU Debugger for ARM EABI (bare-metal) targets
Group: Development/Debuggers
License: GPL-3.0+
BuildRequires: ncurses-devel
BuildRequires: python3-devel
BuildRequires: libexpat-devel
BuildRequires: readline-devel
Recommends: openocd
%description -n %{cross_target}-gdb
This is a version of GDB, the GNU Project debugger, for (remote)
debugging %{target} binaries. GDB allows you to see and modify what is
going on inside another program while it is executing.
%endif
%prep
%setup -q -n binutils-gdb-%{version}
%if !%{with_gdb}
rm -rf gdb sim
%endif
%define _sysroot %{_prefix}/%{target}
%build
./configure CFLAGS="$RPM_OPT_FLAGS" \
--target=%{target} \
--enable-interwork \
--enable-multilib \
--enable-plugins \
--enable-gold \
--disable-nls \
--disable-shared \
--disable-threads \
--disable-werror \
--with-gcc \
--with-gnu-as \
--with-gnu-ld \
--prefix=%{_prefix} \
--with-sysroot=%{_sysroot} \
--mandir=%{_mandir} \
--infodir=%{_infodir} \
%if %{with_gdb}
--with-python=/usr/bin/python3 \
--with-xml \
--with-expat \
--with-system-gdbinit=%{_sysroot}/etc/gdbinit.d \
--with-gdb-datadir=%{_sysroot}/share/gdb \
%endif
--without-doc \
--with-docdir=share/doc/%{name} \
--with-bugurl="http://bugs.opensuse.org/" \
--with-pkgversion="GNU Binutils; %{DIST}" \
--with-separate-debug-dir=%{_sysroot}/lib/debug
%make_build
%check
#make check
%install
%make_install
# we don't want these as this is a cross-compiler
rm -rf %{buildroot}%{_infodir} ||:
rm -rf %{buildroot}%{_mandir} ||:
rm -rf %{buildroot}%{_includedir} ||:
rm -f %{buildroot}%{_libdir}/libiberty.a ||:
rm -f %{buildroot}/usr/lib/libarm-none-eabi-sim.a ||:
rm -f %{buildroot}/usr/lib/bfd-plugins/libdep.a
%if %{with_gdb}
mkdir -p %{buildroot}%{_sysroot}/bin
install -m 0755 gdb/gdb %{buildroot}%{_sysroot}/bin/gdb
%if 0
install -m 0755 gdb/gdbserver/gdbserver %{buildroot}%{_bindir}/%{target}-gdbserver
install -m 0755 gdb/gdbserver/gdbreplay %{buildroot}%{_bindir}/%{target}-gdbreplay
%endif
# Get rid of the shared lib
rm -f %{buildroot}%{_libdir}/lib%{target}-sim.a ||:
# Non-linux targets don't have syscalls
rm -rf %{buildroot}%{_sysroot}/share/gdb/syscalls ||:
%endif
# Replace hard links by symlinks, so that rpmlint doesn't complain
T=$(basename %buildroot/usr/%{target})
for f in %buildroot/usr/$T/bin/* ; do
chrpath -d $f || :
ln -sf /usr/bin/$T-$(basename $f) $f
done
%if %{bootstrap}
mkdir -p %{buildroot}%{_sysroot}/usr/include
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%files
%license COPYING*
%dir %{_sysroot}
%dir %{_sysroot}/bin
%dir %{_sysroot}/lib
%{_sysroot}/bin/*
%{_sysroot}/lib/*
%{_bindir}/%{target}-*
%exclude %{_sysroot}/bin/gdb*
%exclude %{_bindir}/%{target}-gdb*
%if %{bootstrap}
%dir %{_sysroot}/usr
%dir %{_sysroot}/usr/include
%endif
%if %{with_gdb}
%files -n %{cross_target}-gdb
%{_sysroot}/bin/gdb*
%{_bindir}/%{target}-gdb*
%dir %{_sysroot}/share
%{_sysroot}/share/gdb*
%endif
%changelog