A new user interface for you!

File cross-arm-none-eabi-binutils.spec of Package cross-arm-none-eabi-binutils

%global binutils_ver   2.26.51
%global processor_arch arm
%global target         %{processor_arch}-none-eabi
%global cross_target   cross-%{target}

%define DIST %(echo '%distribution' | sed 's/ (.*)//')

%define with_gdb 1
%define bootstrap 0

Name:           %{cross_target}-binutils
Version:        2.26.51
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:            http://www.codesourcery.com/sgpp/lite/%{processor_arch}
Source0:        binutils-%{version}.tar.bz2
BuildRequires:  gcc-c++
BuildRequires:  makeinfo
BuildRequires:  flex
BuildRequires:  bison
#BuildRequires:  cloog-isl-devel
BuildRequires:  ppl-devel
BuildRequires:  chrpath
#BuildRequires:  texinfo-tex
#BuildRequires:  perl-podlators
Provides:       %{target}-binutils = %{binutils_ver}

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:	python-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.


%setup -q -n binutils

%if !%{with_gdb}
rm -rf gdb sim

%define _sysroot %{_prefix}/%{target} 

./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 \
		    --with-xml \
		    --with-expat \
		    --with-system-gdbinit=%{_sysroot}/etc/gdbinit.d \
			--with-gdb-datadir=%{_sysroot}/share/gdb \
		    --without-doc \
            --with-docdir=share/doc/%{name} \
        	--with-bugurl="http://bugs.opensuse.org/" \
	        --with-pkgversion="GNU Binutils; %{DIST}" \

make %{?_smp_mflags}

#make check 

make install DESTDIR=%{buildroot}

# 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 ||:

%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

# 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 ||:


# 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

%if %{bootstrap}
mkdir -p %{buildroot}%{_sysroot}/usr/include


%dir %{_sysroot}
%dir %{_sysroot}/bin
%dir %{_sysroot}/lib
%exclude %{_sysroot}/bin/gdb*
%exclude %{_bindir}/%{target}-gdb*

%if %{bootstrap}
%dir %{_sysroot}/usr
%dir %{_sysroot}/usr/include

%if %{with_gdb}

%files -n %{cross_target}-gdb
%dir %{_sysroot}/share