File avarice.spec of Package wrightflyer

#
# spec file for package avarice.spec (Version 2.10)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# 
# http://en.opensuse.org/Packaging/SUSE_Package_Conventions/RPM_Style#1.2._norootforbuild
#
# FIXME: buildinsight.sh installs to /usr/local/avr without honoring 
#        build root. We allow this, and as a workaround we later move the 
#        tree into the buildroot. We cannot use $RPM_BUILD_ROOT/usr/local/avr
#        as this crashes /usr/lib/rpm/brp-rpath.
#        Workaround: RPM_BUILD_ROOT/opt/cross/avr and 
#        create a symlink in %post. I am not going to break my 
#        the packages just to satisfy LSB. I want to see them working 
#        first, and tend to LSB later.
#
# This specfile 
# with 'osc build --userootforbuild ....'
# needsrootforbuild

Name:           avarice
Version:	2.10
Release:        25jan2010
Summary:	Atmel AVR avarice with xmega support
BuildRequires:	chrpath gcc-c++ binutils-devel
BuildRequires:	texinfo expat libmpfr1 libexpat-devel expat
Source0:	http://downloads.sourceforge.net/avarice/avarice-2.10.tar.bz2
Source1:	buildavr-no-insight.sh
Source2:	avarice-2.10-bug2812023.patch

Patch1:		buildavr_chop.diff
Url:		http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=42631
Group:          Development/Libraries/C and C++
License:        BSD 3-Clause
AutoReqProv:    on
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
avarice built for Atmel AVR with the instrutions from wrightflyer.

%prep
%setup -c -T
cp %SOURCE0 .
cp %SOURCE1 .
cp %SOURCE2 .
%patch1 

mkdir -p /opt/cross/avr
## Fixme, this should not be run between building packages
rm -rf   /opt/cross/avr/*

%build
export CFLAGS="$RPM_OPT_FLAGS"
sed -i.orig -e 's@prefix=/usr/local@prefix=/opt/cross@' -e 's@CFLAGS@ORIG_CFLAGS@' buildavr-no-insight.sh

export BUILD_avarice=1
(echo y; echo y) | sh buildavr-no-insight.sh
rm -rf /opt/cross/avr/source /opt/cross/avr/build
chmod a-x buildavr-no-insight.sh

%install
install -d $RPM_BUILD_ROOT/opt/cross
## FIXME: why are we building a wish8.4 binary at all!
test -f /opt/cross/avr/bin/wish8.4 && chrpath -r /opt/cross/avr/lib /opt/cross/avr/bin/wish8.4
mv /opt/cross/avr $RPM_BUILD_ROOT/opt/cross

%post
mkdir -p /usr/local
ln -sf /opt/cross/avr /usr/local/avr

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr (-, root, root)
# %doc /usr/share/doc/packages/%{name}
%doc buildavr-no-insight.sh
/opt/cross

%changelog
* Tue Mar 02 2010 jw@suse.de
  - initial draught
openSUSE Build Service is sponsored by