diff --git a/alex.spec b/alex.spec index 86c4e94..13b64e1 100644 --- a/alex.spec +++ b/alex.spec @@ -1,6 +1,7 @@ # https://fedoraproject.org/wiki/Packaging:Haskell %bcond_without tests +%bcond_without static # no useful debuginfo for Haskell packages without C sources %global debug_package %{nil} @@ -8,7 +9,7 @@ Name: alex # part of haskell-platform Version: 3.1.3 -Release: 2%{?dist} +Release: 1%{?dist} Summary: Tool for generating lexical analysers in Haskell License: BSD @@ -29,6 +30,11 @@ BuildRequires: ghc-process-devel BuildRequires: autoconf BuildRequires: docbook-style-xsl BuildRequires: libxslt +%if %{with static} +Requires: %{name}-common = %{release} +Requires(post): %{_sbindir}/update-alternatives +Requires(postun): %{_sbindir}/update-alternatives +%endif %description Alex is a tool for generating lexical analysers in Haskell. It takes a @@ -37,11 +43,36 @@ module containing code for scanning text efficiently. It is similar to the tool lex or flex for C/C++. +%if %{with static} +%package common +Summary: Common files for alex + +%description common +This provides the common files for alex. + + +%package static +Summary: Static Haskell build +Requires: %{name}-common = %{release} +Requires(post): %{_sbindir}/update-alternatives +Requires(postun): %{_sbindir}/update-alternatives + +%description static +This provides a build with Haskell libraries statically linked. +%endif + + %prep %setup -q %build +%if %{with static} +%define ghc_without_dynamic 1 +%ghc_bin_build +mv dist/build/%{name}/%{name}{,.static} +%undefine ghc_without_dynamic +%endif %ghc_bin_build cd doc @@ -53,6 +84,13 @@ cd .. %install %ghc_bin_install +%if %{with static} +mv %{buildroot}%{_bindir}/%{name}{,.dynamic} +install dist/build/%{name}/%{name}.static %{buildroot}%{_bindir} +touch %{buildroot}%{_bindir}/%{name} +%endif + +rm %{buildroot}%{_pkgdocdir}/LICENSE %check @@ -61,18 +99,57 @@ cd .. %endif +%if %{with static} +%post +%{_sbindir}/update-alternatives --install %{_bindir}/%{name} \ + %{name} %{_bindir}/%{_bindir}/%{name}.dynamic 70 + + +%postun +if [ $1 -eq 0 ] ; then + %{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{name}.dynamic +fi + + +%post static +%{_sbindir}/update-alternatives --install %{_bindir}/%{name} \ + %{name} %{_bindir}/%{_bindir}/%{name}.static 30 + + +%postun static +if [ $1 -eq 0 ] ; then + %{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{name}.static +fi +%endif + + %files +%if %{with static} +%ghost %{_bindir}/%{name} +%{_bindir}/%{name}.dynamic +%else %doc ANNOUNCE LICENSE README TODO doc/alex examples %{_bindir}/%{name} %{_datadir}/%{name}-%{version} +%endif -%changelog -* Fri Aug 15 2014 Fedora Release Engineering - 3.1.3-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild +%if %{with static} +%files common +%doc ANNOUNCE LICENSE README TODO doc/alex examples +%{_datadir}/%{name}-%{version} + +%files static +%ghost %{_bindir}/%{name} +%{_bindir}/%{name}.static +%endif + + +%changelog * Sun Aug 3 2014 Jens Petersen - 3.1.3-1 - update to 3.1.3 +- add static and common subpackages * Tue Jun 10 2014 Jens Petersen - 3.0.5-37 - update to cblrpm-0.8.11