File cross-avr-gcc.spec of Package wrightflyer

#
# spec file for package cross-avr-gcc.spec (Version 4.3.4)
#
# 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-gcc
Version:	4.3.3
Release:        25jan2010
Summary:	atmel avr compiler with xmega support
BuildRequires:	chrpath 
BuildRequires:	texinfo expat libmpfr1 libexpat-devel expat
Source0:	ftp://ftp.dkuug.dk/pub/gnu/ftp/gnu/gcc/gcc-4.3.3/gcc-4.3.3.tar.bz2
Source1:	http://www.mpfr.org/mpfr-current/mpfr-2.4.1.tar.bz2
Source2:	http://ftp.sunet.se/pub/gnu/gmp/gmp-4.3.1.tar.bz2
Source3:	buildavr-no-insight.sh
Source4:	gcc-patch-avr-libgcc.S.diff
Source5:	gcc-patch-libiberty-Makefile.in.diff
Source6:	gcc-patch-bug11259.diff
Source7:	gcc-patch-newdevices.diff
Source8:	gcc-patch-bug19636-24894-31644-31786.diff
Source9:	gcc-patch-xmega.diff
Source10:	gcc-patch-bug33009.diff
Source11:	gcc-patch-xx-os_main.diff
Source12:	gcc-patch-bug34210-35508.diff
Source13:	gcc-patch-bug35013.diff
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
gcc built for Atmel AVR with the instrutions from wrightflyer.

%prep
%setup -c -T
cp %SOURCE0 .
cp %SOURCE1 .
cp %SOURCE2 .
cp %SOURCE3 .
cp %SOURCE4 .
cp %SOURCE5 .
cp %SOURCE6 .
cp %SOURCE7 .
cp %SOURCE8 .
cp %SOURCE9 .
cp %SOURCE10 .
cp %SOURCE11 .
cp %SOURCE12 .
cp %SOURCE13 .
%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_GCC=1 BUILD_mpfr=1 BUILD_GMP=1
(echo y; echo y) | sh buildavr-no-insight.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 buildavr-no-insight.sh
/opt/cross

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