# Copyright (C) 2012-2013 Dr. Alistair Ward
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
%define package %name-%version
%define tarBall %package.tar.gz
%define _bindir %prefix/bin
%define _sharedir %prefix/share
%define _docdir %_sharedir/doc/%package
%define _mandir %_sharedir/man
Summary: Finds the optimal subset of the specified files, to fit into a limited space, with minimal wastage
Name: squeeze
Version: 1.0.4.0
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
BuildRequires: ghc
%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
(cd $OLDPWD && runhaskell Setup sdist) && tar -zxf $OLDPWD/dist/%tarBall #Make a source-distribution & unpack it into the build-directory.
cd '%package/' && runhaskell Setup configure --user --prefix=%prefix #Configure to use the user's personal package-database & to generate an appropriate "Paths" module.
%build
cd '%package/' && runhaskell Setup build #Descend into the source-distribution and build according to the previously established configuration.
%install
cd '%package/' #Descend into the build-directory.
runhaskell Setup copy --destdir=%buildroot #Install the package in the target-directory.
mkdir -p -- '%buildroot%_docdir' && mv changelog copyright LICENSE '%buildroot%_docdir/'
mkdir -p -- '%buildroot%_mandir' && mv 'man/man1' '%buildroot%_mandir/'
%clean
make --directory='%package' clobber
rm -rf -- '%_builddir/%package/' '%buildroot'
%files
%attr(0755, root, root) %_bindir/%name
%attr(0644, root, root) %doc %_docdir/changelog
%attr(0644, root, root) %doc %_docdir/copyright
%attr(0644, root, root) %doc %_docdir/LICENSE
%attr(0644, root, root) %doc %_mandir/man1/%name.1.gz
%changelog
* Wed May 09 2012 Alistair Ward 1.0.2.4-1
Removed "rm -rf -- '%buildroot'" from build, for security.
Corrected "Paths" module, even though it's unused.