File cross-avr-gcc.spec of Package cross-avr-gcc
#
# spec file for package cross-avr-gcc (Version 4.3.3)
#
# 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://old-en.opensuse.org/Packaging/SUSE_Package_Conventions/RPM_Style#1.2._norootforbuild
#
# norootforbuild
%define prefix /opt/cross
Name: cross-avr-gcc
Version: 5.4.0
Release: 0
Summary: The GNU C Compiler for Atmel AVR with xmega support
## build works without chrpath. Need to check if the built binaries actually work...
BuildRequires: chrpath
BuildRequires: texinfo libexpat-devel expat
BuildRequires: bison flex cross-avr-binutils gcc-c++
BuildRequires: gmp-devel >= 4.3.1 mpfr-devel >= 2.4.1 mpc-devel >= 0.8
BuildRequires: fdupes
Source0: http://ftp.gnu.org/gnu/gcc/gcc-%version/gcc-%version.tar.bz2
Source1: avr-gcc.sh
Patch1: gcc-fortify-decl
Patch2: gcc-patch-libiberty-Makefile.in.diff
Url: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=42631
Group: Development/Libraries/C and C++
License: GPL-3.0+
AutoReqProv: on
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
This compiler supports the C language on AVR microprocessors.
Also install cross-avr-binutils and avr-libc.
%prep
%setup -q -n gcc-%{version}
%patch1 -p1
%patch2 -p1
%build
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
export CXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
export target=avr
mkdir ../build
cd ../build
echo "RPM_OPT_FLAGS: $RPM_OPT_FLAGS"
echo "($0) configuring GCC source"
../gcc-%{version}/configure -v \
--target=${target} \
--disable-nls \
--mandir=%prefix/share/man \
--infodir=%prefix/share/info \
--program-prefix=avr- \
--prefix=%prefix \
--with-gnu-ld --with-gnu-as --enable-languages="c,c++" --disable-libssp --with-dwarf2
make %{?_smp_mflags} all LANGUAGES="c c++"
%install
cd ../build
make install LANGUAGES="c c++" DESTDIR=$RPM_BUILD_ROOT
gzip -f $RPM_BUILD_ROOT%prefix/share/man/man1/*.1
gzip -f $RPM_BUILD_ROOT%prefix/share/man/man7/*.7
%fdupes -s $RPM_BUILD_ROOT/%prefix/
## binutils has the same file. do not create conflicts.
## probably none of the two should be packaged, but a dir dile should rather be generated
## during %post
rm -f $RPM_BUILD_ROOT%prefix/share/info/dir
# Install the configured wrapper(s)
install -d $RPM_BUILD_ROOT/usr/bin
perl -p -e's,--PREFIX--,%prefix,g;' < %{SOURCE1} > $RPM_BUILD_ROOT/usr/bin/avr-gcc
chmod 755 $RPM_BUILD_ROOT/usr/bin/avr-gcc
for i in avr-c++ avr-cpp avr-g++
do
ln $RPM_BUILD_ROOT/usr/bin/avr-gcc $RPM_BUILD_ROOT/usr/bin/$i
done
# This enables LTO builds, provided that
# 1. avr-gcc / avr-g++ is used for the final link and
# 2. it is invoked (maybe via wrapper) as %prefix/bin/avr-...
mkdir -p $RPM_BUILD_ROOT/%prefix/lib/bfd-plugins
(cd $RPM_BUILD_ROOT/%prefix/lib/bfd-plugins &&
ln -sfn ../../libexec/gcc/avr/%version/liblto_plugin.so.*.*.* .)
install -d $RPM_BUILD_ROOT/usr/share/man/man1
for i in avr-cpp avr-g++ avr-gcc avr-gcov
do
ln -s %prefix/share/man/man1/$i.1.gz $RPM_BUILD_ROOT/usr/share/man/man1
done
# avoid file conflicts with other cross compilers
rm -rf $RPM_BUILD_ROOT/%prefix/share/man/man7
rm -rf $RPM_BUILD_ROOT/%prefix/share/info
# installed by mistake -- gcc Makefile bug:
rm -f $RPM_BUILD_ROOT/%prefix/lib*/libcc1* || true
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr (-, root, root)
%doc ChangeLog COPYING* LAST_UPDATED README NEWS
%prefix
/usr/bin/*
/usr/share/man/man1/*
%changelog
* Tue Mar 02 2010 jw@suse.de
- initial draught