Blob Blame History Raw
%global _dirname gambit-v4_8_4-devel

# Using -O2 on ppc64 triggers ICE with gcc < 4.6.4
# http://www.iro.umontreal.ca/~gambit/bugzilla/show_bug.cgi?id=155
# https://bugzilla.redhat.com/show_bug.cgi?id=808285
# Use --with ppc64opt2 when rebuilding to see if this is fixed
%bcond_with ppc64opt2

%if 0%{?el6}
%ifarch ppc64
%if ! %{with ppc64opt2}
%global disable_c_opt 1
%global optflags %(echo %{optflags} | sed 's/-O2 /-O1 /')
%endif
%endif # ppc64
%endif # el6

Name:           gambit-c
Version:        4.8.4
Release:        2%{?dist}
Summary:        Scheme programming system

Group:          Development/Languages
License:        ASL 2.0 or LGPLv2
URL:            http://gambitscheme.org/
Source0:        http://www.iro.umontreal.ca/~gambit/download/gambit/v4.8/source/%{_dirname}.tgz
Source1:        gambit-init.el
Patch0:         gambc-v4_2_8-modtime.patch
# from upstream https://github.com/feeley/gambit/commit/2d1792ce2c1c43efaa7369da4577787d92d9321d
Patch1:         %{name}-4.8.4-fix-flonum-fixnum-cast.patch

BuildRequires:  emacs
Requires:       gcc
Requires:       emacs-filesystem >= %{_emacs_version}
Obsoletes:      emacs-gambit    < 4.7.7-2
Obsoletes:      emacs-gambit-el < 4.7.7-2


%description
Gambit-C includes a Scheme interpreter and a Scheme compiler which can
be used to build standalone executables.  Because the compiler
generates portable C code it is fairly easy to port to any platform
with a decent C compiler.

The Gambit-C system conforms to the R4RS, R5RS and IEEE Scheme
standards.  The full numeric tower is implemented, including: infinite
precision integers (bignums), rationals, inexact reals (floating point
numbers), and complex numbers.


%package        doc
Summary:        Documentation for %{name}
Group:          Documentation

BuildArch:      noarch
Requires:       %{name} = %{version}-%{release}
Requires(post):  info
Requires(preun): info
# switch to noarch
Obsoletes:      gambit-c-doc < %{version}-%{release}

%description    doc
Gambit-C includes a Scheme interpreter and a Scheme compiler which can
be used to build standalone executables.  Because the compiler
generates portable C code it is fairly easy to port to any platform
with a decent C compiler.

This package contains the Gambit-C user manual in HTML and PDF formats.


%prep
%autosetup -n %{_dirname} -p1

#touch -r doc/gambit-c.info-2{,.tstamp}
#iconv -f iso88591 -t utf8 doc/gambit-c.info-2 -o doc/gambit-c.info-2.utf8
#touch -r doc/gambit-c.info-2{,.utf8}
#mv doc/gambit-c.info-2{.utf8,}
# Permission fixes
chmod -x lib/*.{c,h}


%build
# disable expensive optimizations on specified platforms
# see INSTALL.txt
%ifarch s390 %{arm}
%global disable_gcc_opts 1
%endif

%if 0%{?fedora}
%if 0%{?fedora} <= 21
%global disable_gcc_opts 1
%endif
%endif

%if 0%{?rhel}
%if 0%{?rhel} <= 7
%global disable_gcc_opts 1
%endif
%endif

%configure --enable-single-host \
%if 0%{?disable_c_opt:1}
%else
           --enable-c-opt \
%endif
%if 0%{?disable_gcc_opts:1}
%else
           --enable-gcc-opts \
%endif
           --bindir=%{_libdir}/%{name}/bin \
           --libdir=%{_libdir}/%{name}

make %{?_smp_mflags}

# Compile emacs module
(cd misc && %{_emacs_bytecompile} gambit.el)


%check
make check


%install
make install DESTDIR=$RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_bindir}
for i in gsc gsi
do
  ln -sf ../%{_lib}/%{name}/bin/$i $RPM_BUILD_ROOT%{_bindir}/$i
done
cat > $RPM_BUILD_ROOT%{_bindir}/gsix <<EOF
#!/bin/sh
%{_libdir}/%{name}/bin/six $@
EOF
chmod +x $RPM_BUILD_ROOT%{_bindir}/gsix

# Remove duplicate docs
rm -rf $RPM_BUILD_ROOT%{_prefix}/doc

# Emacs mode files
mkdir -p $RPM_BUILD_ROOT%{_emacs_sitestartdir}
cp -p misc/gambit.elc $RPM_BUILD_ROOT%{_emacs_sitelispdir}
cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_emacs_sitestartdir}

# Link static libs
(cd $RPM_BUILD_ROOT%{_libdir} && ln -s %{name}/*.a .)


%post doc
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir 2>/dev/null || :


%preun doc
if [ $1 -eq 0 ]; then
  /sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir 2>/dev/null || :
fi


%files
%defattr(-,root,root,-)
%doc LGPL.txt LICENSE-2.0.txt README
%{_bindir}/*
%{_includedir}/*.h
%{_mandir}/man1/gsi.*
%{_libdir}/%{name}
%{_libdir}/*.a
%{_emacs_sitelispdir}/*.el
%{_emacs_sitelispdir}/*.elc
%{_emacs_sitestartdir}/gambit-init.el


%files doc
%defattr(-,root,root,-)
%doc doc/gambit.html doc/gambit.pdf
# don't package examples until makefiles are fixed
# examples
%{_infodir}/*



%changelog
* Sun Feb 28 2016 Michel Alexandre Salim <salimma@fedoraproject.org> - 4.8.4-2
- Re-enable ARM build with upstream cast fix

* Sun Feb 21 2016 Michel Alexandre Salim <salimma@fedoraproject.org> - 4.8.4-1
- Update to 4.8.4

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 4.7.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Sun Sep  6 2015 Michel Alexandre Salim <salimma@fedoraproject.org> - 4.7.9-1
- Update to 4.7.9
- Update home page link
- Adjust to new Emacs packaging guidelines, no longer shipping separate packages
- Further reduce expensive optimizations on resource-limited arches

* Tue Jul 28 2015 Peter Robinson <pbrobinson@fedoraproject.org> 4.7.7-1
- Update to 4.7.7

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.7.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sun May  3 2015 Peter Robinson <pbrobinson@fedoraproject.org> 4.7.5-1
- Update to 4.7.5

* Tue Nov 04 2014 Jakub ńĆajka <jcajka@redhat.com> - 4.7.3-2
- Fix build OOM on s390

* Thu Oct 30 2014 Michel Alexandre Salim <salimma@fedoraproject.org> - 4.7.3-1
- Update to 4.7.3

* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.7.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.7.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Fri Feb  7 2014 Michel Salim <salimma@fedoraproject.org> - 4.7.2-1
- Update to 4.7.2

* Tue Nov 05 2013 Kyle McMartin <kyle@fedoraproject.org>
- Fix FTBFS because of dirname macro, use _dirname instead.

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.6.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.6.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.6.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Tue Jun  5 2012 Michel Salim <salimma@fedoraproject.org> - 4.6.6-1
- Update to 4.6.6

* Sat Mar 31 2012 Michel Salim <salimma@fedoraproject.org> - 4.6.5-2
- Reduce optimization level on ppc64 to work around gcc compilation error

* Thu Mar 29 2012 Michel Salim <salimma@fedoraproject.org> - 4.6.5-1
- Update to 4.6.5
- Drop termite subpackages, they have been disabled for many releases
- Disable ppc64 target for now; broken since 4.6.4

* Wed Feb 15 2012 Michel Salim <salimma@fedoraproject.org> - 4.6.4-1
- Update to 4.6.4

* Wed Feb  1 2012 Michel Salim <salimma@fedoraproject.org> - 4.6.3-1
- Update to 4.6.3

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.6.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Wed Jul 27 2011 Michel Salim <salimma@fedoraproject.org> - 4.6.1-1
- Update to 4.6.1

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.6.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Mon Jul 12 2010 Michel Salim <salimma@fedoraproject.org> - 4.6.0-2
- noarch -doc subpackage properly obsoletes older, arched variant

* Mon Jul 12 2010 Michel Salim <salimma@fedoraproject.org> - 4.6.0-1
- Update to 4.6.0
- Bundle license text with independent Emacs subpackage

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.3.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.3.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Wed Jan 28 2009 Michel Salim <salimma@fedoraproject.org> - 4.3.2-2
- If termite packages are disabled, the corresponding gambit-c packages
  Provides: and Obsoletes: them

* Fri Dec 19 2008 Michel Salim <salimma@fedoraproject.org> - 4.3.2-1
- Update to 4.3.2

* Tue Oct 14 2008 Michel Salim <salimma@fedoraproject.org> - 4.2.9-1
- Update to 4.2.9
- Disable Termite for now; still broken
- When built on EL-5, depend directly on emacs binary rather than emacs(bin)

* Mon Jul 14 2008 Michel Salim <salimma@fedoraproject.org> - 4.2.8-6
- Put include files and libraries in standard paths

* Thu Jun 19 2008 Michel Salim <salimma@fedoraproject.org> - 4.2.8-5
- Package Termite as a module instead of bundling a custom Gambit-C with it

* Thu Jun 19 2008 Michel Salim <salimma@fedoraproject.org> - 4.2.8-4
- Permission fixes for Termite subpackage

* Wed Jun 18 2008 Michel Salim <salimma@fedoraproject.org> - 4.2.8-3
- Bundle Termite as a subpackage

* Sat Jun  7 2008 Michel Salim <salimma@fedoraproject.org> - 4.2.8-2
- Rename six symlink to avoid clash with existing six package

* Mon Jun  2 2008 Michel Salim <salimma@fedoraproject.org> - 4.2.8-1
- Update to 4.2.8
- Rename to gambit-c

* Fri Dec 28 2007 Gerard Milmeister <gemi@bluewin.ch> - 4.1.2-1
- new release 4.1.2

* Sat Apr 14 2007 Gerard Milmeister <gemi@bluewin.ch> - 4.0-1.b22
- new version 4.0b22

* Sun Oct 15 2006 Gerard Milmeister <gemi@bluewin.ch> - 4.0-1.b20
- new version 4.0b20

* Sat Feb  4 2006 Gerard Milmeister <gemi@bluewin.ch> - 4.0-1.b17
- new version 4.0b17

* Mon Nov  7 2005 Gerard Milmeister <gemi@bluewin.ch> - 4.0-1.b15
- New Version 4.0b15

* Fri Aug 12 2005 Gerard Milmeister <gemi@bluewin.ch> - 4.0-1.b14
- First Fedora release