+#
+# Conditional build:
+%bcond_with bootstrap # use foreign (non-rpm) ghc
+#
Summary: A lexical analyser generator for Haskell
-Summary(pl): Generator analizatorów sk³adniowych dla Haskella
+Summary(pl.UTF-8): Generator analizatorów składniowych dla Haskella
Name: alex
-Version: 2.0.1
-Release: 1
+Version: 3.1.3
+Release: 2
License: BSD-like w/o adv. clause
Group: Development/Tools
-Source0: http://www.haskell.org/alex/dist/%{name}-%{version}-src.tar.gz
-# Source0-md5: edb62560e29c8de23913c65c52adbf19
-Patch0: %{name}-DESTDIR.patch
+#Source0Download: http://hackage.haskell.org/package/alex
+Source0: http://hackage.haskell.org/package/alex-%{version}/%{name}-%{version}.tar.gz
+# Source0-md5: 525e570cb0e84fd856f9c53605ec9e98
URL: http://www.haskell.org/alex/
-BuildRequires: autoconf
-BuildRequires: automake
-BuildRequires: docbook-dtd31-sgml
-BuildRequires: docbook-style-dsssl
-BuildRequires: ghc >= 5.04
+BuildRequires: autoconf >= 2.50
+BuildRequires: docbook-dtd42-xml
+BuildRequires: docbook-style-xsl
+%{!?with_bootstrap:BuildRequires: ghc >= 6.6}
+BuildRequires: ghc-QuickCheck >= 2
BuildRequires: gmp-devel
-BuildRequires: jadetex
-BuildRequires: openjade
-BuildRequires: tetex-dvips
+%{!?with_bootstrap:BuildRequires: happy}
+BuildRequires: libxslt-progs
+#For generating documentation in PDF: fop or xmltex
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
description of the tokens to be recognised in the form of regular
expressions. It is similar to the tool lex or flex for C/C++.
-%description -l pl
-Alex to narzêdzie do generowania analizatorów sk³adniowych w Haskellu
-na podstawie opisu tokenów do rozpoznawania w postaci wyra¿eñ
-regularnych. Jest podobne do narzêdzi lex lub flex dla C/C++.
+%description -l pl.UTF-8
+Alex to narzędzie do generowania analizatorów składniowych w Haskellu
+na podstawie opisu tokenów do rozpoznawania w postaci wyrażeń
+regularnych. Jest podobne do narzędzi lex lub flex dla C/C++.
%prep
%setup -q
%build
-chmod u+w configure*
-%{__aclocal}
+%{?with_bootstrap:PATH=$PATH:/usr/local/bin}
+runhaskell Setup.lhs configure --prefix=%{_prefix}
+runhaskell Setup.lhs build
+
+cd doc
%{__autoconf}
-cp -f /usr/share/automake/config.sub .
%configure
-%{__make} depend
-%{__make}
-%{__make} html -C alex/doc
+%{__make} html
+cd ..
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_bindir},%{_examplesdir}/%{name}-%{version}}
+%{?with_bootstrap:PATH=$PATH:/usr/local/bin}
+runhaskell Setup.lhs copy --destdir=$RPM_BUILD_ROOT
-%{__make} install \
- bindir=$RPM_BUILD_ROOT%{_bindir} \
- libdir=$RPM_BUILD_ROOT%{_libdir}/%{name}-%{version}
+install -d $RPM_BUILD_ROOT%{_examplesdir}
+cp -a examples $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
-cp -a alex/examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}/
+# work around automatic haddock docs installation
+%{__rm} -rf %{name}-%{version}-doc
+cp -a $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version} %{name}-%{version}-doc
+%{__rm} -r $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc alex/{ANNOUNCE,LICENSE,README} alex/doc/alex docs/building/building docs/docbook-cheat-sheet/docbook-cheat-sheet
-%attr(755,root,root) %{_bindir}/*
-%dir %{_libdir}/%{name}-%{version}
-%{_libdir}/%{name}-%{version}/A*
-%attr(755,root,root) %{_libdir}/%{name}-%{version}/alex.bin
+%doc ANNOUNCE README TODO doc/alex
+%attr(755,root,root) %{_bindir}/alex
+%{_datadir}/%{name}-%{version}
%{_examplesdir}/%{name}-%{version}