#!/bin/bash
#
# Build file for package TkKasse-Client
#
# (C) by Jan Kandziora <tkkasse@users.sf.net>
#
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#


PRISTINE_SOURCE_PATH=..
INSTALL_PATH=/opt/tkkasse
ETC_INSTALL_PATH=/etc/opt/tkkasse
MODULE_NAME=TkKasse-Client
SOURCE_PATH=~/src/packages/SOURCES
VERSION=1.2
RELEASE=6


rm -r $SOURCE_PATH/${MODULE_NAME}*
cp -R $PRISTINE_SOURCE_PATH/$MODULE_NAME $SOURCE_PATH/${MODULE_NAME}-$VERSION
tar -cj -f $SOURCE_PATH/${MODULE_NAME}-$VERSION.tar.bz2 --exclude '.*' --exclude CVS -C $SOURCE_PATH ${MODULE_NAME}-$VERSION
cat >$SOURCE_PATH/${MODULE_NAME}.spec <<EOT
AutoReqProv:   yes
BuildRequires: bash, binutils, bzip2, coreutils, diffutils, rpm, tar
BuildRoot:     %{_tmppath}/%{name}-%{version}-build
Group:         Productivity/Other
License:       GPL
Name:          $MODULE_NAME
Packager:      Jan Kandziora <tkkasse@users.sf.net>
#Patch:
Release:       $RELEASE
Requires:      bash, blt >= 2.4z-200, coreutils, itcl >= 3.3-408, iwidgets >= 4.0.1-225, tcl >= 8.4.6-26, tix >= 8.1.4-72, tk >= 8.4.6-37
Summary:       Client program for the TkKasse cash register system
Source:        http://prdownloads.sf.net/tkkasse/%{name}-%{version}.tar.bz2
URL:           http://tkkasse.sf.net/
Version:       $VERSION

%description
This is the client package for the Tkkasse cash register system.
It provides all files neccesary to connect to a tkkasse server,
except for localisation files. You have to install them seperately.

To get a working cash register system, you need the server package,
too, but you may install it on another system.

Author: Jan Kandziora <tkkasse@users.sf.net>

%prep
%setup -n %{name}-%{version}
#%patch

%build
rm -rf \$RPM_BUILD_ROOT

%install
rm -rf \$RPM_BUILD_ROOT
install -d -m 755 \$RPM_BUILD_ROOT$ETC_INSTALL_PATH
install -c -m 644 etc/client            \$RPM_BUILD_ROOT$ETC_INSTALL_PATH
install -d -m 755 \$RPM_BUILD_ROOT$INSTALL_PATH/lib/client
install -c -m 644 scripts/Apperance.tcl \$RPM_BUILD_ROOT$INSTALL_PATH/lib/client
install -c -m 644 scripts/Dialogs.tcl   \$RPM_BUILD_ROOT$INSTALL_PATH/lib/client
install -c -m 644 scripts/Main.tcl      \$RPM_BUILD_ROOT$INSTALL_PATH/lib/client
install -c -m 644 scripts/Widgets.tcl   \$RPM_BUILD_ROOT$INSTALL_PATH/lib/client
install -d -m 755 \$RPM_BUILD_ROOT$INSTALL_PATH/lib/client/i18n
install -c -m 644 i18n/de.msg           \$RPM_BUILD_ROOT$INSTALL_PATH/lib/client/i18n
install -c -m 644 i18n/en.msg           \$RPM_BUILD_ROOT$INSTALL_PATH/lib/client/i18n
install -d -m 755 \$RPM_BUILD_ROOT$INSTALL_PATH/bin
install -c -m 755 scripts/tkkasse       \$RPM_BUILD_ROOT$INSTALL_PATH/bin

%clean
rm -rf \$RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc COPYING ChangeLog PEOPLE README
%config $ETC_INSTALL_PATH/client
$INSTALL_PATH/lib/client/Apperance.tcl
$INSTALL_PATH/lib/client/Dialogs.tcl  
$INSTALL_PATH/lib/client/Main.tcl  
$INSTALL_PATH/lib/client/Widgets.tcl
$INSTALL_PATH/lib/client/i18n/de.msg
$INSTALL_PATH/lib/client/i18n/en.msg
$INSTALL_PATH/bin/tkkasse
EOT

rpmbuild -ba -v --target noarch $SOURCE_PATH/${MODULE_NAME}.spec

