squeeze-1.0.1.4: squeeze.spec
%define package %name-%version
%define tarBall %package.tar.gz
%define _bindir %prefix/bin
%define _datadir %prefix/share/%package
%define _docdir %prefix/share/doc/%package
%define _mandir %prefix/share/man
Summary: Finds the optimal subset of the specified files, to fit into a limited space, with minimal wastage.
Name: squeeze
Version: 1.0.1.4
Release: 1
License: GPLv3
#From '/usr/share/doc/packages/rpm/GROUPS'.
Group: Applications/File
Source0: http://functionalley.eu/Downloads/sdist/%tarBall
URL: http://functionalley.eu
Prefix: /usr
%description
Returns progressively better subsets of the specified files, to fit into a limited space, without wasting more than the specific ratio.
%prep
#NB: we've changed directory to %_builddir
rm -rf -- '%package/'
CABAL_CONFIGURE_OPTIONS='--user' make --directory="$OLDPWD/" sdist && mv -- "$OLDPWD/dist/%tarBall" '%_sourcedir/' && tar -zxf '%_sourcedir/%tarBall' #Build & copy the tar-ball into the source-directory, then unpack it into the build-directory.
%build
%install
rm -rf -- '%buildroot' #Clean any previous build. CAVEAT: the user might have specified '--buildroot', for which I can't account.
CABAL_CONFIGURE_OPTIONS='--user --prefix=%buildroot%prefix/' make --directory='%package/' install #Which regrettably also builds 'Haddock', which then requires 'HsColour'.
mkdir -p -- '%buildroot%_mandir/' && mv -- '%_builddir/%package/man/man1' '%buildroot%_mandir/'
mkdir -p -- '%buildroot%_docdir/' && mv -- %_builddir/%package/{changelog,copyright,LICENSE} '%buildroot%_docdir/'
rm -rf -- '%buildroot%_docdir/html' #We don't need source-code documentation in a binary package.
%clean
make --directory='%package/' clobber
rm -- '%_sourcedir/%tarBall'
rm -rf -- '%_builddir/%package' '%buildroot'
%files
%attr(0755, root, root) %_bindir/squeeze
%attr(0644, root, root) %doc %_mandir/man1/*.1.gz
%attr(0644, root, root) %doc %_docdir/changelog
%attr(0644, root, root) %doc %_docdir/copyright
%attr(0644, root, root) %doc %_docdir/LICENSE