%define mlton_bootstrap 0
Name: mlton
Version: 20061107
Release: 4%{?dist}
Summary: Optimizing compiler for Standard ML
Group: Development/Languages
License: MIT
URL: http://mlton.org/
Source0: mlton-%{version}.tar.bz2
%if %{mlton_bootstrap}
# taken from mlton_20060213-1 from Debian
Source1: mlton-bootstrap.i386.tar.bz2
Source2: mlton-bootstrap.ppc.tar.bz2
%endif
Patch0: mlton-20051202-pdf-docs.patch
Patch1: mlton-20061107-debuginfo.patch
Patch2: mlton-20061107-optflags.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gmp-devel htmldoc tetex-latex
%if ! %{mlton_bootstrap}
BuildRequires: mlton
%endif
Requires: gmp-devel gcc
# not yet available for 64-bit arch (#198764)
ExcludeArch: x86_64 ppc64
# description taken from the Debian package by Stephen Weeks
%description
MLton is a whole-program optimizing compiler for Standard ML. MLton
generates standalone executables with excellent runtime performance,
is SML 97 compliant, and has a complete basis library. MLton has
source-level profiling, a fast C FFI, an interface to the GNU
multiprecision library, and lots of useful libraries.
%prep
%setup -q
# instantiate version numbers
make version VERSION=%{version}
# build documentation as PDF
%patch -P 0 -p1 -b .pdf-docs
# disable strip so debuginfo packages work
%patch -P 1 -p1 -b .debuginfo
# enable RPM_OPT_FLAGS
%patch -P 2 -p1 -b .optflags
# set correct version of PDF guide until this is fixed upstream
sed -i 's/\(^version=\).*$/\1%{version}/g' bin/make-pdf-guide
%if %{mlton_bootstrap}
%ifarch i386
%setup -T -D -q -a 1
%endif
%ifarch ppc
%setup -T -D -q -a 2
%endif
sed -i 's/\(^lib=\).*$/\1\$MLTON_BOOTSTRAP_DIR\/usr\/lib\/mlton/g' \
bootstrap/usr/bin/mlton
%endif
%build
%if %{mlton_bootstrap}
export MLTON_BOOTSTRAP_DIR=$(pwd)/bootstrap
export PATH="${PATH}":$MLTON_BOOTSTRAP_DIR/usr/bin
%endif
make OPTFLAGS="$RPM_OPT_FLAGS"
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT MAN_PREFIX_EXTRA=/share \
TDOC=$RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
# remove unecessary regression test
rm -rf $RPM_BUILD_ROOT%{_libdir}/mlton/sml/ckit-lib/regression
# move some documentation around
mv $RPM_BUILD_ROOT%{_libdir}/mlton/sml/ckit-lib/doc \
$RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/ckit-lib
mv $RPM_BUILD_ROOT%{_libdir}/mlton/sml/smlnj-lib/Doc \
$RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/smlnj-lib
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc %{_docdir}/%{name}-%{version}
%{_bindir}/ml*
%{_libdir}/mlton
%{_mandir}/man1/*
%changelog
* Wed Aug 22 2007 Adam Goode <adam@spicenitz.org> - 20061107-4
- Exclude ppc64 for now
* Wed Aug 22 2007 Adam Goode <adam@spicenitz.org> - 20061107-3
- Update license tag
- Rebuild for buildid
* Fri Nov 24 2006 Adam Goode <adam@spicenitz.org> - 20061107-2
- Use RPM_OPT_FLAGS
- Correctly instantiate version
- Adjust patches
* Sun Nov 12 2006 Adam Goode <adam@spicenitz.org> - 20061107-1
- New release, taken from svn://mlton.org/mlton/tags/on-20061107
* Thu Aug 31 2006 Adam Goode <adam@spicenitz.org> - 20051202-8.1
- Mass rebuild
* Sun Jul 9 2006 Adam Goode <adam@spicenitz.org> - 20051202-8
- Conditionalize bootstrapping and disable it
* Sat Jul 1 2006 Adam Goode <adam@spicenitz.org> - 20051202-7
- Fix macro in changelog
- Remove mixed use of tabs and spaces
* Sun Jun 25 2006 Adam Goode <adam@spicenitz.org> - 20051202-6
- Build runtime with -g, but not -gstabs+
- Re-enable debuginfo packages
* Wed Jun 21 2006 Adam Goode <adam@spicenitz.org> - 20051202-5
- Disable empty debuginfo packages
* Wed Jun 21 2006 Adam Goode <adam@spicenitz.org> - 20051202-4
- Be more specific about license
- Add "which" to BuildRequires until everyone is running new mock
* Tue Jun 20 2006 Adam Goode <adam@spicenitz.org> - 20051202-3
- Create PDF documentation for mlyacc and mllex (instead of .ps.gz)
- Move ckit-lib/doc and smlnj-lib/Doc to %%{_docdir}
- Remove regression files from ckit
* Thu Jun 8 2006 Adam Goode <adam@spicenitz.org> - 20051202-2
- Change to use bootstrap
* Wed Jun 7 2006 Adam Goode <adam@spicenitz.org> - 20051202-1
- Initial release for FC5