drop static and common subpackages; reenable tests

This commit is contained in:
Jens Petersen 2017-01-20 21:31:21 +09:00
parent 9e954fed86
commit dcc25d3648
1 changed files with 10 additions and 103 deletions

113
alex.spec
View File

@ -1,14 +1,11 @@
# generated by cabal-rpm-0.11
# https://fedoraproject.org/wiki/Packaging:Haskell
# should get fixed in 3.1.5
# https://github.com/simonmar/alex/issues/62
%bcond_with tests
%bcond_without static
%bcond_without tests
Name: alex
# part of haskell-platform
Version: 3.1.7
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Tool for generating lexical analysers in Haskell
License: BSD
@ -29,11 +26,9 @@ BuildRequires: ghc-process-devel
BuildRequires: autoconf
BuildRequires: docbook-style-xsl
BuildRequires: libxslt
%if %{with static}
Requires: %{name}-common = %{version}-%{release}
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%endif
# added for F26
Obsoletes: %{name}-common < %{version}-%{release}
Obsoletes: %{name}-static < %{version}-%{release}
%description
Alex is a tool for generating lexical analysers in Haskell. It takes a
@ -42,36 +37,11 @@ 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 %{name}
%description common
This provides the common files for %{name}.
%package static
Summary: Static Haskell build
Requires: %{name}-common = %{version}-%{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
@ -83,12 +53,6 @@ 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}
mv %{buildroot}%{_defaultlicensedir}/%{name}{,-common}
%endif
install -D -m 0644 doc/alex.1 %{buildroot}%{_mandir}/man1/alex.1
@ -97,76 +61,19 @@ install -D -m 0644 doc/alex.1 %{buildroot}%{_mandir}/man1/alex.1
%cabal_test
%if %{with static}
# avoid rpm ghost keeping pre-alternatives binary around
%pre
if [ $1 -gt 1 ] ; then
if [ -f %{_bindir}/%{name} -a ! -L %{_bindir}/%{name} ]; then
rm %{_bindir}/%{name}
fi
fi
%post
%{_sbindir}/update-alternatives --install %{_bindir}/%{name} \
%{name} %{_bindir}/%{name}.dynamic 70
%postun
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove %{name} %{_bindir}/%{name}.dynamic
fi
# avoid rpm ghost keeping pre-alternatives binary around
%pre static
if [ $1 -gt 1 ] ; then
if [ -f %{_bindir}/%{name} -a ! -L %{_bindir}/%{name} ]; then
rm %{_bindir}/%{name}
fi
fi
%post static
%{_sbindir}/update-alternatives --install %{_bindir}/%{name} \
%{name} %{_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
%license LICENSE
%doc CHANGELOG.md README TODO doc/alex examples
%{_bindir}/%{name}
%{_datadir}/%{name}-%{version}
%{_mandir}/man1/alex.1*
%endif
%if %{with static}
%files common
%license LICENSE
%doc CHANGELOG.md README TODO doc/alex examples
%{_datadir}/%{name}-%{version}
%{_mandir}/man1/alex.1*
%files static
%ghost %{_bindir}/%{name}
%{_bindir}/%{name}.static
%endif
%changelog
* Fri Jan 20 2017 Jens Petersen <petersen@redhat.com> - 3.1.7-2
- re-enable tests
- remove and obsolete static and common subpackages
* Thu Jun 23 2016 Jens Petersen <petersen@redhat.com> - 3.1.7-1
- update to 3.1.7
- install manpage