Blob Blame History Raw
%global bootstrap 0

Name:           chicken
Version:        4.8.0.4
Release:        3%{?dist}
Summary:        A practical and portable Scheme system

Group:          Development/Languages
License:        BSD
URL:            http://call-cc.org
Source0:        http://code.call-cc.org/releases/4.8.0/%{name}-%{version}.tar.gz
Patch0:         make_cflags_work.patch
BuildRequires:  chrpath

%if 0%{?rhel}
BuildRequires:  net-tools
%else
BuildRequires:  hostname
%endif

%if %{bootstrap} == 0
BuildRequires:  chicken
%endif

%description
CHICKEN is a compiler for the Scheme programming language.
CHICKEN produces portable, efficient C, supports almost all of the R5RS
Scheme language standard, and includes many enhancements and extensions.

%prep
%setup -q -n %{name}-%{version}
%patch0 -p1

%package doc
Summary: Documentation files for CHICKEN scheme.

%description doc
Documentation for CHICKEN (chicken-scheme).

%build
%if %{bootstrap} == 0

# This removes all C code from the repo, and leaves us only with Scheme code.
# Otherwise, it will try to compile C, defeating the point of bootstrapping.
make PLATFORM=linux spotless

# The above command nukes a necessary buildtag file, and there's no way that
# I can find to regenerate it - so instead we just generate it ourselves.
echo "#define C_BUILD_TAG \"compiled $(date '+%Y-%m-%d') on $(hostname)\"" > buildtag.h

%endif

# Chicken's build system is freaking horrible.
# So, Fedora requires that we use optflags here - makes sense, they contain
# some security related flags, etc. The issue is that Chicken uses the same
# flags that it was compiled with when it compiles code for the end-user.
# So if we pass -Wall here, it'll give the user a bunch of warnings when they
# compile anything at all with `csc`. So that's lovely. -codeblock
make CFLAGS="$(echo "%{optflags}" | sed 's/-Wall//')" \
     PREFIX=%{_prefix} \
     BINDIR=%{_bindir} \
     LIBDIR=%{_libdir} \
     DATADIR=%{_datadir}/chicken \
     INCLUDEDIR=%{_includedir}/chicken \
     INFODIR=%{_infodir}/chicken \
     TOPMANDIR=%{_mandir} \
     DOCDIR=%{_docdir}/chicken \
     PLATFORM=linux

%install
make CFLAGS="$(echo "%{optflags}" | sed 's/-Wall//')" \
     PREFIX=%{_prefix} \
     BINDIR=%{_bindir} \
     LIBDIR=%{_libdir} \
     DATADIR=%{_datadir}/chicken \
     INCLUDEDIR=%{_includedir}/chicken \
     INFODIR=%{_infodir}/chicken \
     TOPMANDIR=%{_mandir} \
     DOCDIR=%{_docdir}/chicken \
     DESTDIR=%{buildroot} \
     PLATFORM=linux install

rm -f %{buildroot}/%{_docdir}/%{name}/LICENSE %{buildroot}/%{_docdir}/%{name}/README

find %{buildroot} -name \*.so -exec chrpath --delete \{\} \;
find %{buildroot} -name \*.a -exec rm \{\} \;
chrpath --delete %{buildroot}/%{_bindir}/*

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%doc README LICENSE
%dir %{_datadir}/chicken
%{_datadir}/chicken/setup.defaults
%{_bindir}/chicken*
%{_bindir}/csc
%{_bindir}/csi
%dir %{_includedir}/chicken
%{_includedir}/chicken/chicken-config.h
%{_includedir}/chicken/chicken.h
%{_libdir}/libchicken.so
%{_libdir}/libchicken.so.6
%dir %{_libdir}/chicken
%dir %{_libdir}/chicken/6
%{_libdir}/chicken/6/*
%{_mandir}/man1/*

%files doc
%{_docdir}/chicken/manual

%changelog
* Mon Sep 02 2013 Ricky Elrod <codeblock@fedoraproject.org> - 4.8.0.4-3
- Nuke -Wall from optflags.

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

* Wed Jul 17 2013 Ricky Elrod <codeblock@fedoraproject.org> 4.8.0.4-1
- Upstream 4.8.0.4.

* Sat May 11 2013 Ricky Elrod <codeblock@fedoraproject.org> 4.8.0.3-4
- Bootstrap again, with working CFLAGS.

* Wed May 08 2013 Ricky Elrod <codeblock@fedoraproject.org> 4.8.0.3-3
- Bootstrap.

* Wed May 08 2013 Ricky Elrod <codeblock@fedoraproject.org> 4.8.0.3-2
- Fix BuildRequires for RHEL building.

* Sun May 05 2013 Ricky Elrod <codeblock@fedoraproject.org> 4.8.0.3-1
- Clean spec file up a lot.
- Bump to latest upstream release.

* Thu May 03 2012 J R Jones <fedora@zaniyah.org> 4.7.0-2
- Separated into separate sub-packages

* Thu May 03 2012 J R Jones <fedora@zaniyah.org> 4.7.0-1
- Specfile created.