Blob Blame History Raw
Name:           sdcc
Version:        2.6.0
Release:        12%{?dist}
Summary:        Small Device C Compiler

Group:          Applications/Engineering
License:        GPL
URL:            http://sdcc.sourceforge.net
Source0:        http://downloads.sourceforge.net/%{name}/%{name}-src-%{version}.tar.gz
Source1:        README.fedora
Patch0:         sdcc-2.6.0-configure.diff
Patch1:         sdcc-2.6.0-sdccman.lyx.patch 
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  flex
BuildRequires:  bison
BuildRequires:  lyx
BuildRequires:  latex2html
BuildRequires:  gc-devel


%description
SDCC is a C compiler for 8051 class and similar microcontrollers.
The package includes the compiler, assemblers and linkers, a device
simulator and a core library. The processors supported (to a varying
degree) include the 8051, ds390, z80, hc08, and PIC.


%package libc-sources
Summary:        Small Device C Compiler
Group:          Applications/Engineering
License:        GPL
Requires:       sdcc = %{version}-%{release}

%description libc-sources
SDCC is a C compiler for 8051 class and similar microcontrollers.
This package includes the sources for the C library, and is only neccessary
if you want to modify the C library or as reference of how it works.

%prep
%setup -q -n sdcc
%patch0 -p1
%patch1 -p1
find -name '*.[ch]' -exec chmod -x '{}' \;

# Extract %%__os_install_post into os_install_post~
cat << \EOF > os_install_post~
%__os_install_post
EOF

# Generate customized brp-*scripts
cat os_install_post~ | while read a x y; do
case $a in
# Prevent brp-strip* from trying to handle foreign binaries
*/brp-strip*)
  b=$(basename $a)
  sed -e 's,find $RPM_BUILD_ROOT,find $RPM_BUILD_ROOT%_bindir $RPM_BUILD_ROOT%_libexecdir,' $a > $b
  chmod a+x $b
  ;;
esac
done

sed -e 's,^[ ]*/usr/lib/rpm.*/brp-strip,./brp-strip,' \
< os_install_post~ > os_install_post 


%build
%configure --enable-doc --enable-libgc STRIP=:
make Q=


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT Q=
mv $RPM_BUILD_ROOT/%{_datadir}/%{name}/doc installed-docs
install -m 644 %SOURCE1 installed-docs
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/emacs/site-lisp
mv $RPM_BUILD_ROOT/%{_bindir}/*.el $RPM_BUILD_ROOT/%{_datadir}/emacs/site-lisp
find $RPM_BUILD_ROOT -type f -name \*.c -exec chmod a-x '{}' \;
mkdir -p $RPM_BUILD_ROOT/%{_libexecdir}/sdcc
mv $RPM_BUILD_ROOT/%{_bindir}/* $RPM_BUILD_ROOT/%{_libexecdir}/sdcc

# Creat lauch scripts in %{_bindir}
pushd $RPM_BUILD_ROOT/%{_bindir}
for x in ../libexec/sdcc/*; do 
echo "#!/bin/sh
PATH=/usr/libexec/sdcc:\$PATH
/usr/libexec/%{name}/$(basename $x) \"\$@\"" > %{name}-$(basename $x)
chmod 755 %{name}-$(basename $x)
done
popd

%define __os_install_post . ./os_install_post

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc installed-docs/*
%{_bindir}/*
%{_libexecdir}/%{name}
%{_datadir}/%{name}
%{_datadir}/emacs
%exclude %{_datadir}/%{name}/lib/src
%exclude %{_datadir}/%{name}/lib/*/*.asm


%files libc-sources
%defattr(-,root,root,-)
%{_datadir}/%{name}/lib/src
%{_datadir}/%{name}/lib/*/*.asm

%changelog
* Sun Mar 2  2008 Marek Mahut <mmahut@fedoraproject.org> - 2.6.0-12
- Fixing build problems under GCC 4.3

* Wed Feb 20 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 2.6.0-11
- Autorebuild for GCC 4.3

* Sat Apr 07 2007 Trond Danielsen <trond.danielsen@gmail.com> - 2.6.0-10
- Added patch to fix a problem with sdccman.lyx that caused lyx to fail.

* Fri Mar 23 2007 Trond Danielsen <trond.danielsen@gmail.com> - 2.6.0-9
- Removed symlinks, added scripts (solves bug #233385).

* Thu Feb 29 2007 Trond Danielsen <trond.danielsen@gmail.com> - 2.6.0-8
- Added Fedora specific README file.
- Corrected permissions on files in debuginfo package.

* Wed Feb 28 2007 Trond Danielsen <trond.danielsen@gmail.com> - 2.6.0-7
- Updated requirement for libc-source to include version and release number.

* Wed Feb 28 2007 Trond Danielsen <trond.danielsen@gmail.com> - 2.6.0-6
- Renamed source code package to libc-sources.
- Change BuildRequire from byacc to bison.
- Added "Require: sdcc" to libc-sources package.
- Empty %doc entry removed.
- Updated description of libc-sources package.

* Tue Feb 27 2007 Trond Danielsen <trond.danielsen@gmail.com> - 2.6.0-5
- Source URL updated.
- Separate src package created.
- Disabling stripping of binaries to get proper debuginfo package.

* Mon Feb 26 2007 Ralf Cors├ępius <rc040203@freenet.de> - 2.6.0-4
- Add sdcc-2.6.0-configure.diff.
- Pass Q= to make to make building verbose.
- Add __os_install_post post-hacks to prevent brp-strip from processing 
  foreign binaries.

* Mon Feb 26 2007 Trond Danielsen <trond.danielsen@gmail.com> - 2.6.0-3
- Broken symlinks fixed.

* Mon Feb 5 2007 Trond Danielsen <trond.danielsen@gmail.com> - 2.6.0-2
- Emacs scripts moved to the correct folder.
- Moved binaries to /urs/libexec/sdcc, added symlinks with sdcc- prefix in /usr/bin.
- Various rpmlint errors fixed. 

* Thu Feb 1 2007 Trond Danielsen <trond.danielsen@gmail.com> - 2.6.0-1
- Initial version.