File avarice.spec of Package avarice

#
# spec file for package avarice
#
# Copyright (c) 2022 SUSE LLC
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# 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/
#


%define prefix /usr/avr

Name:           avarice
Version:        2.14+git20220120.5a125cd
Release:        0
Summary:        JTAG debugger for Atmel AVR
BuildRequires:  automake
BuildRequires:  binutils-devel
BuildRequires:  expat
BuildRequires:  gcc-c++
BuildRequires:  libexpat-devel
BuildRequires:  libhidapi-devel
BuildRequires:  libmpfr6
BuildRequires:  texinfo
Source0:        %{name}-%{version}.tar.gz
Source1:        buildavr-no-insight.sh
Source2:        getfiles.sh
Source3:        get-patches.sh
Source4:        %{name}.changes

URL:            https://github.com/avrdudes/avarice
Group:          Development/Libraries/C and C++
License:        GPL-2.0-only
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
AVaRICE is a program which interfaces the GNU Debugger GDB with the
AVR JTAG ICE available from Atmel. There are some third party clones
of the Atmel jtagice available for purchase via the web for prices
much less than the Atmel's offering.

Build instructions from
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=42631

%prep
%setup

exec 33< %SOURCE4
read dummy <&33; read changelog_tstamp <&33
sed -i.orig -e 's/__DATE__/"openSUSE"/' -e 's/__TIME__/"'"$changelog_tstamp"'"/' src/main.cc

cp %SOURCE1 .
cp %SOURCE2 .
cp %SOURCE3 .

%build
autoreconf -i
export CFLAGS="$RPM_OPT_FLAGS"
./configure -v --prefix=%prefix #--with-gnu-ld --with-gnu-as --quiet --enable-install-libbfd --with-dwarf2
make all

#
# export BUILD_avarice=1
# (echo y; echo y) | sh buildavr-no-insight.sh
chmod 644 buildavr-no-insight.sh

%install
make install DESTDIR=$RPM_BUILD_ROOT
gzip $RPM_BUILD_ROOT/%prefix/share/man/man1/*.1

install -d $RPM_BUILD_ROOT/usr/bin
for i in start-avarice ice-gdb ice-insight kill-avarice avarice; do
  ln -s %prefix/bin/$i $RPM_BUILD_ROOT/usr/bin
done

install -d $RPM_BUILD_ROOT/usr/share/man/man1
for i in ice-gdb ice-insight avarice; do
  ln -s %prefix/share/man/man1/$i.1.gz $RPM_BUILD_ROOT/usr/share/man/man1
done

%files
%defattr (-, root, root)
%license COPYING
%doc doc/*.txt ChangeLog NEWS AUTHORS
%doc get-patches.sh getfiles.sh buildavr-no-insight.sh
%prefix
/usr/bin/*
/usr/share/man/man1/*

%changelog
openSUSE Build Service is sponsored by