File cross-avr-insight.spec of Package wrightflyer

#
# spec file for package cross-avr-insight.spec (Version 6.8)
#
# 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:           cross-avr-insight
Version:	6.8
Release:        25jan2010
Summary:	insight is a debugging tool
BuildRequires:	texinfo expat libmpfr1 libexpat-devel expat
BuildRequires:	tcl >= 8.4, tk >= 8.4, ncurses-devel, xorg-x11-libX11-devel
BuildRequires:	chrpath
Source0:	ftp://sourceware.org/pub/insight/releases/insight-6.8.tar.bz2
Source1:	buildinsight.sh
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
insight built for Atmel AVR with the instrutions from wrightflyer.

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

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@' buildinsight.sh
(echo y; echo y) | sh buildinsight.sh
rm -rf /opt/cross/avr/source /opt/cross/avr/build

%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 buildinsight.sh
/opt/cross

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