File cross-avr-gdb.spec of Package cross-avr-gdb
%define realname gdb
%define realver 8.3.1
%define srcext tar.xz
%define prefix /opt/cross
%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-avr-%{realname}
Version: %{realver}
Release: wiz%{?extraver:0.}1%{?dist}
License: GPL-3.0
Group: Development/Tools/Debuggers
URL: http://www.gnu.org/software/gdb/
Summary: A GNU source-level debugger for C, C++, Java and other languages
# Install-time-parameters
%if 0%{?suse_version}
Suggests: %{?cross_target:cross-%{cross_cpu}-}binutils
%endif
# Build-time parameters
BuildRequires: xz
BuildRequires: gcc-c++
BuildRequires: zlib-devel
BuildRequires: ncurses-devel readline-devel
%if 0%{?suse_version}
BuildRequires: makeinfo
%else
BuildRequires: texinfo
%endif
BuildRoot: %{_tmppath}/%{name}-root
Source: http://ftp.gnu.org/gnu/gdb/%{realname}-%{realver}.%{srcext}
%description
GDB, the GNU debugger, allows you to debug programs written in C, C++,
Java, and other languages, by executing them in a controlled fashion
and printing their data.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
%build
_CFLAGS='%{optflags} %{?gcc_lto}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}'
%configure \
--mandir=%{_datadir}/man \
--infodir=%{_datadir}/info \
--target=%{build_target} \
--program-prefix=%{cross_cpu}- \
--disable-nls \
--disable-libquadmath \
--disable-lto \
--enable-host-shared \
--with-system-zlib \
--with-system-readline \
CFLAGS="$_CFLAGS" \
CXXFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}
%install
%{__make} install DESTDIR=%{buildroot}
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}%{_datadir}/info/*
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%doc COPYING* MAINTAINERS README
%{_bindir}/*
%{_datadir}/%{realname}/
%doc %{_datadir}/man/man1/*
%doc %{_datadir}/man/man5/*
%exclude %{_libdir}/*.a
%exclude %{_includedir}/gdb/jit-reader.h
%dir %{_prefix}
%dir %{_bindir}
%dir %{_datadir}
%dir %{_datadir}/man
%dir %{_datadir}/man/man1
%dir %{_datadir}/man/man5
%changelog