File cross-avr-binutils.spec of Package cross-avr-binutils
%define realname binutils
%define realver 2.38
%define srcext tar.bz2
%define prefix %_prefix
%define cross_cpu avr
%define cross_target %{cross_cpu}
%define build_target %{cross_target}
%define platform_dir %{prefix}/%{build_target}
%define platform_ld %{build_target}-ld
# Common info
Name: %{?cross_target:cross-%{cross_cpu}-}%{realname}
Version: %{realver}
Release: wiz%{?extraver:0.}1%{?dist}
License: GFDL-1.3 and GPL-3.0+
Group: Development/Tools/Building
URL: http://www.gnu.org/software/binutils/
Summary: GNU binutils
# Build-time parameters
BuildRequires: binutils gcc cpp bison flex gettext zlib-devel
BuildRequires: gcc-c++ libstdc++-devel
%if 0%{?suse_version}
BuildRequires: makeinfo
%else
BuildRequires: texinfo
%endif
BuildRoot: %{_tmppath}/%{name}-root
Source: http://ftp.gnu.org/gnu/binutils/%{realname}-%{realver}%{?extraver}.%{srcext}
%description
These are the GNU binutils. These are utilities of use when dealing
with binary files, either object files or executables. These tools
consist of the linker (ld), the assembler (gas), and the profiler
(gprof) each of which have their own sub-directory named after them.
There is also a collection of other binary tools, including the
disassembler (objdump) in this directory. These tools make use of a
pair of libraries (bfd and opcodes) and a common set of header files
(include).
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
# Do copying instead of hardlinking
sed -i '/DESTDIR/ s/ln /cp /' binutils/Makefile.in
sed -i '/DESTDIR/ s/ln /cp /' gas/Makefile.in
sed -i '/DESTDIR/ s/ln /cp /' gold/Makefile.in
sed -i '/DESTDIR/ s/ln /cp /' ld/Makefile.in
%build
_CFLAGS='%{optflags}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro'
%configure \
--program-prefix=%{build_target}- \
--libdir=%{platform_dir}/%{_lib} \
--target=%{build_target} \
--disable-static \
--enable-lto \
\
--disable-nls \
--with-system-zlib \
--enable-threads \
\
--with-lib-path=/%{_lib}:%{_libdir} \
CFLAGS="$_CFLAGS" \
CXXFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS" \
|| cat config.log
%{__make} %{?_smp_mflags}
%install
%{__make} install DESTDIR=%{buildroot} target_header_dir=%{_includedir}
# Handle file duplicates
for binary in %{buildroot}%{platform_dir}/bin/*; do
%{__ln_s} -fn ../../bin/%{build_target}-${binary##*/} $binary
done
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%license COPYING*
%doc MAINTAINERS binutils/NEWS binutils/README
%{_bindir}/*
%{platform_dir}/
%doc %{_mandir}/man1/*
%exclude %{_infodir}/*
%changelog