File binutils.spec of Package binutils

%define targetarch @BUILD_FLAVOR@

Summary: Binutils for the %{targetarch} architecture
Name: cross-%{targetarch}-binutils
Version: 2.43.1
Release: 0
License: GPL-2.0-or-later
Group: Development/Cross
URL: http://ftp.gnu.org/gnu/binutils
Source0: http://ftp.gnu.org/gnu/binutils/binutils-%{version}.tar.xz
BuildRequires:	bison
BuildRequires:	c++_compiler
BuildRequires:	makeinfo
%if "%{targetarch}" == ""
ExclusiveArch:	do_not_build
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

%description 
This package contains the binutils that can operate on 
%{targetarch} programs.

%prep
%setup -q -n binutils-%{version}

%build
./configure --prefix=%{cross_prefix} --build=`arch`-suse-linux \
    --target=%{targetarch} --with-sysroot=%{cross_prefix}/%{targetarch}/%{sysroot}
make %_smp_mflags

%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
perl -pi \
  -e "s,SEARCH_DIR.*,SEARCH_DIR(\"%{cross_prefix}/%{targetarch}/lib\");,g;" \
  $RPM_BUILD_ROOT%{cross_prefix}/%{targetarch}/lib/ldscripts/*

rm -rf $RPM_BUILD_ROOT%{cross_prefix}/info $RPM_BUILD_ROOT%{cross_prefix}/lib*/libiberty.a 
rm -rf $RPM_BUILD_ROOT%{cross_prefix}/man $RPM_BUILD_ROOT%{cross_prefix}/share/locale
rm -rf $RPM_BUILD_ROOT%{cross_prefix}/share/info/dir
# Try to not put build platform binaries into the proposed target root.
# unfortunately some Makefiles depend on this.
#rm -rf $RPM_BUILD_ROOT%{cross_prefix}/%{targetarch}/bin/*

%files
%defattr(-,root,root,-)
%if "%{cross_prefix}" != "/usr"
%dir %{cross_prefix}
%endif
%{cross_prefix}/*

%changelog
openSUSE Build Service is sponsored by