File avrdude.spec of Package avrdude

#
# spec file for package avrdude (Version 5.11)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#

Name:           avrdude
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  libusb-devel
BuildRequires:  readline-devel
%if 0%{?suse_version} >= 1210
BuildRequires:  libftdi1-devel
%endif
BuildRequires:  libelf-devel
BuildRequires:  automake
BuildRequires:  texinfo
Version:        6.1
Release:        0
Url:            http://savannah.nongnu.org/projects/avrdude
Group:          Development/Tools/Other
License:        GPL-2.0+
Summary:        Upload tool for AVR microcontrollers
Source0:        %name-%version.tar.gz
Source3:        modprobe.avrdude_parport
Source4:        avrdude-usbdevices
Patch0:         avrdude-5.11-no-builddate.diff
Patch1:         avrdude-ipv6.patch
Provides:       avr-programmer
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         /bin/cat /sbin/modprobe
PreReq:         %install_info_prereq

%description
avrdude is a tool for avr microcontrollers and drives many hardware
in-system programmers. avrdude allows you to program your
microcontroller through USB or parallel port of your computer.

%prep 
%setup -q
# avrdude-5.11-no-builddate.diff
%patch0 -p1
%patch1
touch lexer.l

%build
./bootstrap
sed -i 's/--clean /--tidy /g' doc/Makefile.in
%configure \
        --enable-linuxgpio
make %{?_smp_mflags}
make -C doc info

%install
%makeinstall DOC_INST_DIR=%buildroot%_docdir/%name
make -C doc install-info DESTDIR=%buildroot
install -D -m 644 %{S:3} $RPM_BUILD_ROOT/etc/modprobe.d/50-avrdude_parport.conf

%if 0%{?suse_version} >= 1230
%global udevdir /usr/lib/udev
%global tag uaccess
%else
%global udevdir /etc/udev
%global tag udev-acl
%endif
RULESFILE=%buildroot%udevdir/rules.d/50-avrdude.rules
mkdir -p ${RULESFILE%/*}
echo 'KERNEL=="parport*", TAG+="%tag"' > $RULESFILE
while IFS=" " read major minor comment;do
    echo "# $comment"
    echo 'ATTRS{idVendor}=="'$major'", ATTRS{idProduct}=="'$minor'", TAG+="%tag"'
done <%{S:4} >> $RULESFILE
chmod 644 $RULESFILE

install -d -m 755 %buildroot%_docdir/%name
install -m 644 AUTHORS COPYING NEWS README %buildroot%_docdir/%name

%post
%if %{?suse_version:1}0
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz
if [ "$1" -eq 1 ]; then
  # $1==0 is binary uninstall.
  # $1==1 is binary install.
  # $1==2 is during build 
  if [  "$YAST_IS_RUNNING" = "yes" ]; then
    # make life trivial for yast users.
    /sbin/modprobe ppdev
  fi
fi
%endif

%postun
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz

%files
%defattr (-, root, root)
%_docdir/%name
%doc %_mandir/*/*
%doc %_infodir/%{name}.info.gz
%config /etc/avrdude.conf
%dir /etc/modprobe.d
%config /etc/modprobe.d/50-avrdude_parport.conf
%udevdir
%_bindir/*

%changelog
openSUSE Build Service is sponsored by