LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File avr-libc.spec of Package avr-libc (Project openSUSE:Dropped)

#
# spec file for package avr-libc (Version 1.7.0)
#
# 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/
#

# norootforbuild

%define into_opt_cross 1
%if %into_opt_cross
%define PREFIX /opt/cross/avr
%else
# FIXME:
# okay, FHS 2.2, if you forbid the obvious choices, can you also suggest a better place?
# avr-libc: "/usr/avr/{include,lib,...}" is not allowed anymore in FHS 2.2
# avr-libc: "/usr/local/avr/{include,lib,...}" is not allowed anymore in FHS 2.2
%define PREFIX /usr
%define PREFIX /usr/local
%endif

Name:           avr-libc
BuildRequires:  cross-avr-binutils = 2.19.1 cross-avr-gcc doxygen findutils netpbm
%if 0%{?suse_version} < 1100
BuildRequires:  libgmp3 libmpfr1
%endif
Version:        1.7.0
Release:        1
%define doc_vers %{version}
Url:            http://savannah.nongnu.org/projects/avr-libc
Group:          Development/Libraries/C and C++
License:        BSD3c(or similar)
Summary:        The C Runtime Library for AVR Microcontrollers
Source:         http://savannah.nongnu.org/download/%{name}/%{name}-%{version}.tar.bz2
Source1:        http://savannah.nongnu.org/download/%{name}/%{name}-user-manual-%{doc_vers}.tar.bz2
Source2:        http://savannah.nongnu.org/download/%{name}/%{name}-manpages-%{doc_vers}.tar.bz2
Source3:        logicp-1.01.tgz
Source100:      %{name}-rpmlintrc
AutoReqProv:    on
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       cross-avr-gcc
Requires:       cross-avr-binutils = 2.19.1
Recommends:     avr-example

%description
The C runtime library for the AVR family of microcontrollers for use
with the GNU toolset (cross-avr-binutils, cross-avr-gcc, uisp, etc.).



Authors:
--------
    Joerg Wunsch <j.gnu@uriah.heep.sax.de>
    Marek Michalkiewicz <marekm@amelek.gda.pl>
    Theodore A. Roth <troth@openavr.org>

%prep
%setup -b 3
# %patch1 -p1
# %ifarch x86_64 ia64 ppc64
# # avr-64bit datatypes fail on 64bit host architectures.
# # it is a bug, isn't it? 2007-01-08, jw
# %patch -p1
# %else
# %if "%(/bin/uname -i)" == "x86_64"
# # we come here with BUILD_DIST=i386 on a x86_64 machine.
# # we need to cover this case too, to make the selftests happy.
# %patch -p1
# %endif
# %endif

%build
export CFLAGS="$RPM_OPT_FLAGS"
export CXXFLAGS="$RPM_OPT_FLAGS"
# export NO_BRP_STRIP_DEBUG=true
## silly hack, to be removed when the target is no longer avr-elf but avr.
# for tool in as ar gcc ranlib; do
#   test -f %PREFIX/bin/avr-$tool || \
#   ln -s avr-elf-$tool %PREFIX/bin/avr-$tool
# done
./configure --prefix=%PREFIX --host=avr
make %{?jobs:-j%jobs}

%install

# ./domake DESTDIR=$RPM_BUILD_ROOT install
make DESTDIR=$RPM_BUILD_ROOT install
tar jxvf %{S:1}
mv %{name}-user-manual-%{doc_vers} user-manual-%{doc_vers}
mkdir -p $RPM_BUILD_ROOT/usr/share/doc/packages/%{name}
cp -pr AUTHORS ChangeLog INSTALL LICENSE NEWS user-manual-%{doc_vers} $RPM_BUILD_ROOT/usr/share/doc/packages/%{name}
ln -s /usr/share/doc/packages/%{name}/user-manual-%{doc_vers} $RPM_BUILD_ROOT/%PREFIX/share/doc/%{name}-%{version}/user-manual
ln -s %PREFIX/share/doc/%{name}-%{version}/examples $RPM_BUILD_ROOT/usr/share/doc/packages/%{name}
ln -s pages.html $RPM_BUILD_ROOT/usr/share/doc/packages/%{name}/user-manual-%{doc_vers}/00_index.html
cat >> $RPM_BUILD_ROOT/usr/share/doc/packages/%{name}/00_index.html <<EOF
<head><meta http-equiv="Refresh" content="0; user-manual-%{doc_vers}/pages.html"></head>
<a href="user-manual-%{doc_vers}/pages.html">user-manual-%{doc_vers}/pages.html</a>
EOF

tar jxvf %{S:2} -C $RPM_BUILD_ROOT/%PREFIX/share
# gzipped to make http://dist.suse.de/data/i386/lint/avr-libc happy.
find $RPM_BUILD_ROOT/%PREFIX/share/man -type f -print | xargs gzip

# do not run brp-strip-debug on our avr-elf objects.
export NO_BRP_STRIP_DEBUG=true

# # gcc looks here: /opt/cross/avr/lib/gcc/avr/4.3.3/../../../../avr/include
# # This is effectivly /opt/cross/avr/avr/include, which is not quite right.
# # no idea where it comes from. Lets make a compat symlink.
# ln -s ../include /opt/cross/avr/avr

%check
### selftest ###
cd ../logicp*
## how do we tell the linker that crt*.o is at a nonstandard location?
ln -s $RPM_BUILD_ROOT%PREFIX/avr/lib/crttn*.o .
ln -s $RPM_BUILD_ROOT%PREFIX/avr/lib/avr?/crtm*.o .
make test CFLAGS="-Wall -g -Os -mint8 -I$RPM_BUILD_ROOT%PREFIX/avr/include/ -L$RPM_BUILD_ROOT%PREFIX/avr/lib/avr4" CPU=mega8
make test CFLAGS="-Wall -g -Os -mint8 -I$RPM_BUILD_ROOT%PREFIX/avr/include/ -L$RPM_BUILD_ROOT%PREFIX/avr/lib/avr4" CPU=mega48
make test CFLAGS="-Wall -g -Os -mint8 -I$RPM_BUILD_ROOT%PREFIX/avr/include/ -L$RPM_BUILD_ROOT%PREFIX/avr/lib"      CPU=tiny2313

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr (-, root, root)
%doc /usr/share/doc/packages/%{name}
%if %into_opt_cross
/opt/*
%else
/usr/*
%endif
# %doc /usr/share/man/man?/*.*

%changelog