Index: app/dist/Makefile
===================================================================
--- app/dist/Makefile	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/dist/Makefile	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,61 @@
+# compile task doesn't compile sources, but just copy some files
+# this should be changed
+#
+
+# I put here some variables
+
+# path, where binaries are placed 
+# (they will be processed for making distribution)
+export _UTT_DIST_DIR=$(shell pwd)/bin
+# path, where distribution file should be placed
+export _UTT_DIST_OUTPUT=$(shell pwd)
+
+
+# -----------------------------------------------------------
+# default task should display options
+.PHONY: default
+defaul:
+	@echo "Using: make compile|tarball|rpm|deb"
+
+
+# -----------------------------------------------------------
+# -----------------------------------------------------------
+# this task should compile utt application
+.PHONY: compile
+compile:
+	if test -d ${_UTT_DIST_DIR}; then rm -fr ${_UTT_DIST_DIR}; fi
+	mkdir -p ${_UTT_DIST_DIR}
+	@# fake compilation
+	cp -r ../utt-0.9/* ${_UTT_DIST_DIR}/
+	@# we add some extra file (required during instalation)
+	cp common/create_utt_config.pl ${_UTT_DIST_DIR}/
+	chmod 700 ${_UTT_DIST_DIR}/create_utt_config.pl
+
+
+# -----------------------------------------------------------
+# this task should compile utt (if nesessery) and create tar.gz version
+.PHONY: tarball
+tarball: compile
+	cd tarball && make
+
+# -----------------------------------------------------------
+# this task should compile utt (if nesessery) and create rpm version
+.PHONY: rpm
+rpm: compile
+	@#we build rpm (see spec/README for details)
+	cd spec && make
+
+# -----------------------------------------------------------
+# this task should compile utt (if nesessery) and create deb version
+.PHONY: deb
+deb: compile
+	@#we build deb (see deb/README for details)
+	cd deb && make
+
+# -----------------------------------------------------------
+# this task should remove compiled files and directories
+.PHONY: clean
+clean:
+	# finally the line below should be uncomment
+	rm -fr ${_UTT_DIST_DIR}
+
Index: app/dist/common/description.def
===================================================================
--- app/dist/common/description.def	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/dist/common/description.def	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,1 @@
+I put here some description.
Index: app/dist/common/description.pl.def
===================================================================
--- app/dist/common/description.pl.def	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/dist/common/description.pl.def	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,1 @@
+Tu umieszczÄ opis po polsku.
Index: app/dist/common/release.def
===================================================================
--- app/dist/common/release.def	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/dist/common/release.def	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,1 @@
+1
Index: app/dist/common/utt_make_config.pl
===================================================================
--- app/dist/common/utt_make_config.pl	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/dist/common/utt_make_config.pl	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,53 @@
+#!/usr/bin/perl
+
+use Cwd 'abs_path';
+use File::Basename;
+use POSIX;
+
+my $cur_dir = dirname(abs_path($0));
+
+open(FILE, ">$cur_dir/conf/utt.conf");
+
+# we put some description into utt.conf file
+print FILE "# ************************************************************\n";
+print FILE "# * This file was created automatically during installation. *\n";
+print FILE "# * If you don't need do not change it.                      *\n";
+print FILE "# *                                                          *\n";
+print FILE "# * UAM Text Tools                                           *\n";
+print FILE "# * Adam Mickiewicz University, Poland                       *\n";
+print FILE "# * http://utt.amu.edu.pl                                    *\n";
+print FILE "# ************************************************************\n";
+print FILE "\n\n";
+
+# we need utt home directory
+print FILE "# absolute path to utt directory\n";
+print FILE "UTT_HOME=$cur_dir\n\n";
+
+
+# we need user default locale
+$best_locale = findLocale();
+print FILE "# user locale\n";
+print FILE "UTT_LOCALE=$best_locale\n";
+print FILE "\n";
+
+close FILE;
+
+
+
+sub findLocale() {
+	$cur_locale = setlocale(LC_CTYPE);
+
+	# we replace Latinx to ISO-8859-x
+	$cur_locale =~ s/(.+?)Latin(.+?)/$1ISO\-8859\-$2/g;
+
+	if($cur_locale =~ /\w+_\w+\.\S+/) {
+	  $best_locale = $cur_locale;
+	}
+	elsif($cur_locale =~ /\w+_\w+/) {
+	  $best_locale = $cur_locale.".UTF-8";
+	}
+	else {
+	  $best_locale = toupper($cur_locale).'_'.tolower($cur_locale).'.UTF-8';
+	}
+	return $best_locale;
+}
Index: app/dist/common/version.def
===================================================================
--- app/dist/common/version.def	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/dist/common/version.def	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,1 @@
+0.9
Index: app/dist/deb/Makefile
===================================================================
--- app/dist/deb/Makefile	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/dist/deb/Makefile	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,81 @@
+#default task
+
+# here there're few properties
+_PRODUCT_NAME=utt
+_BUILD_DIR=$(_UTT_BIN_DIR)
+_UTT_VER=$(shell cat ../common/version.def)
+_UTT_REL=$(shell cat ../common/release.def)
+_DEB_ROOT=$(shell pwd)/deb_root
+_INSTALL_DIR=/usr/local/$(_PRODUCT_NAME)/$(_UTT_VER)-$(_UTT_REL)
+
+.PHONY: default
+default:
+	# we need some extra configuration files
+	make_control
+	make_postinst
+
+	# first, we prepare some directory structure
+	mkdir -p $(_DEB_ROOT)/DEBIAN
+	mkdir -p $(_DEB_ROOT)$(_INSTALL_DIR)
+	mkdir -p $(_DEB_ROOT)/usr/share/man/man1
+	mkdir -p $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)
+
+	find $(_DEB_ROOT) -type d | xargs chmod 755   # this is necessary on Debian Woody, don't ask me why
+
+	# next, we copy necessary files
+	mv ./control $(_DEB_ROOT)/DEBIAN/
+	cp ./postinst $(_DEB_ROOT)/DEBIAN/
+	cp ./prerm $(_DEB_ROOT)/DEBIAN/
+#	cp -r $(_BUILD_DIR)/man/* $(_DEB_ROOT)/usr/share/man/
+	cp $(_BUILD_DIR)/COPYRIGHT $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/copyright
+#	cp $(_BUILD_DIR)/changelog $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/
+#	cp $(_BUILD_DIR)/changelog.Debian $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/
+
+
+	# next we make man/doc archives
+#	gzip --best $(_DEB_ROOT)/usr/share/man/man1/$(_PRODUCT_NAME).1
+#	gzip --best $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/changelog
+#	gzip --best $(_DEB_ROOT)/usr/share/doc/$(_PRODUCT_NAME)/changelog.Debian
+#	tar -cvvf control.tar.gz ${_DEB_ROOT}/DEBIAN/
+#	rm -fr ${_DEB_ROOT}/DEBIAN/
+
+	# and binaries
+	cp -rv $(_BUILD_DIR)/* $(_DEB_ROOT)$(_INSTALL_DIR)/
+#	tar -cvvf data.tar.gz ${_DEB_ROOT}/
+#	rm -fr ${_DEB_ROOT}/
+
+
+	# finally, we buid deb package
+	fakeroot dpkg-deb --build $(_DEB_ROOT)
+	mv $(_DEB_ROOT).deb $(_PRODUCT_NAME)_$(_UTT_VER)-$(_UTT_REL).all.deb
+
+
+.PHONY: make_control
+make_control:
+	echo "Package: $(_PRODUCT_NAME)" > control
+	echo "Version: $(_UTT_VER)" >> control
+	echo "Section: web" >> control
+	echo "Priority: optional" >> control
+	echo "Architecture: all" >> control
+	echo "Essential: no" >> control
+
+	echo "Depends: " >> control
+# here we read this information from file ../common/requirements.def
+	#libwww-perl, acme-base (>= 1.2)         <= wymagania pakietowe
+
+	echo "Pre-Depends: perl" >> control
+
+	echo "Maintainer: Adam Mickiewicz University" >> control
+	echo "Provides: $(_PRODUCT_NAME)" >> control
+	echo -n "Description: " >> control
+	cat ../common/description.def >> control
+
+.PHONY: make_postinst
+make_postinst:
+	echo "#!/bin/sh" > postinst
+	echo "$(_INSTALL_DIR)/create_utt_config.pl" >> postinst
+	echo "rm -f $(_INSTALL_DIR)/create_utt_config.pl" >> postinst
+
+.PHONY: make_prerm
+make_prerm:
+	echo "#!/bin/sh" > prerm
Index: app/dist/deb/README
===================================================================
--- app/dist/deb/README	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/dist/deb/README	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,3 @@
+This directory contains files necessery to create deb package.
+
+apt-get install dpkg-dev debhelper devscripts fakeroot linda
Index: app/dist/files/README
===================================================================
--- app/dist/files/README	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/dist/files/README	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,14 @@
+
+Installation:
+
+1) Run the command:
+
+    make install
+
+in this directory. This will install UTT in the directory '~/.utt'.
+
+2) Add the path
+
+    ~/.utt/bin
+    
+to your PATH variable to make UTT programs visible to your system.
Index: app/dist/spec/Makefile
===================================================================
--- app/dist/spec/Makefile	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/dist/spec/Makefile	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,15 @@
+# this makefile will build rpm
+
+DIR=$(shell pwd)
+
+ifndef _UTT_DIST_DIR
+	_UTT_DIST_DIR=${DIR}
+endif
+
+
+# default task
+.PHONY: rpm
+rpm:
+	cd ${_UTT_DIST_DIR}; rpmbuild -bb ${DIR}/utt.spec
+	
+
Index: app/dist/spec/README
===================================================================
--- app/dist/spec/README	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/dist/spec/README	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,16 @@
+This directory contains files necessary to produce rpm package.
+
+First, you must have variable _UTT_DIST_DIR defined properly.
+This variable should be defined by main Makefile.
+
+To create rpm file, just write:
+make
+
+The created package should appears in default RPM directory.
+(in my computer it is /usr/src/redhat/RPMS/$arch/ directory)
+
+To determine the rpm output directory, execute:
+rpm --showrc | grep _rmpdir
+
+You need access privilage to this directory to create rmp.
+
Index: app/dist/spec/utt.spec
===================================================================
--- app/dist/spec/utt.spec	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/dist/spec/utt.spec	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,106 @@
+#
+# Default RPM header.
+#
+# START_RPM_STD_HEADER:
+
+
+#
+# RPM properties
+#
+%define _this_product     UAM Text Tools
+%define _this_summary	  Some tools for text processing
+%define _this_name        utt
+%define _this_version	  %(cat ../common/version.def)
+%define _this_release	  %(cat ../common/release.def)
+%define _this_copyright   Adam Mickiewicz University, Poland
+
+#
+# We need some paths
+#
+# Directory with utt binaries
+%define _UTT_DIST_DIR	%(pwd)
+#Root directory in which utt will be installed
+%define _UTT_DIR		/usr/local/%_this_name
+#Directory for rpm
+%define _RPM_ROOT	%_UTT_DIST_DIR/../rpm_root
+
+#
+# Default RPM header.
+#
+# END_RPM_STD_HEADER:
+# --------------------------------------------------------------------
+
+Summary:     %_this_summary
+Name:        %_this_name
+Version:     %_this_version
+Release:     %_this_release
+#Copyright:   %_this_copyright
+License:	GPL
+Group:       Development/Tools
+URL:         http://utt.amu.edu.pl
+Vendor:      Adam Mickiewicz University
+BuildRoot:   %_RPM_ROOT
+#BuildArch: 	 i586
+# requirements for utt application
+#AutoReq: no
+#AutoReqProv: no
+
+#Requires: 	 glibc >= 2.1.3
+#Requires: 	 libgcc1 >= 3.0
+#Requires: 	 libgcc >= 3.0
+#Requires:    libstdc++6 >= 3.4.1
+#Requires:    libstdc++ >= 3.4.1
+
+%description
+%(cat ../common/description.def)
+
+%description -l pl
+%(cat ../common/description.pl.def)
+
+
+# -------------------------------------------------------------
+# preparing sources for compilation
+%prep
+
+# source compilation
+%build
+
+# rpm building
+%install
+%__mkdir_p $RPM_BUILD_ROOT%_UTT_DIR
+cp -fr %_UTT_DIST_DIR/* $RPM_BUILD_ROOT%_UTT_DIR/
+
+
+# cleaning after rpm build
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+# -------------------------------------------------------------
+#before installation
+%pre
+
+
+#after installation
+%post
+# we need to create utt.conf file
+%_UTT_DIR/create_utt_config.pl
+rm -f %_UTT_DIR/create_utt_config.pl
+# we need to create links in /usr/local/bin
+find %_UTT_DIR/bin/ -type f -exec ln -f {} /usr/local/bin \;
+
+
+#before uninstallation
+%preun
+# we delete links from /usr/local/bin
+for fn in `find %_UTT_DIR/bin/ -type f -exec basename {} \;`; do rm -f /usr/local/bin/$fn; done
+
+
+#after uninstallation
+%postun
+# we remove all extra files
+rm -fr %_UTT_DIR
+
+# -------------------------------------------------------------
+%files
+%defattr(-,root,root)
+/*
Index: app/dist/tarball/INSTALL
===================================================================
--- app/dist/tarball/INSTALL	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/dist/tarball/INSTALL	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,4 @@
+Here you can find some information about how to install utt.
+
+You should just unpack archive and then 
+execute create_utt_conf.pl and remove it.
Index: app/dist/tarball/Makefile
===================================================================
--- app/dist/tarball/Makefile	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/dist/tarball/Makefile	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,38 @@
+# This makefile allows build tarball distribution for utt.
+
+#
+# Some variables
+#
+
+# Directory with utt binaries
+ifndef _UTT_DIST_DIR
+	_UTT_DIST_DIR=${DIR}
+endif
+
+# Where put result
+ifndef _UTT_DIST_OUTPUT
+	_UTT_DIST_OUTPUT=${DIR}
+endif
+
+# Common info about version and release
+_UTT_VER=$(shell cat ../common/version.def)
+_UTT_REL=$(shell cat ../common/release.def)
+
+# Temp vars
+DIR=$(shell pwd)
+_TARBALL_ROOT=$(DIR)/utt_$(_UTT_VER)-$(_UTT_REL)
+_TAR_FILE_NAME=utt.$(_UTT_VER)_$(_UTT_REL).tar.gz
+
+#defualt task
+.PHONY: default
+default:
+	@echo Build dir is ${_UTT_DIST_DIR}
+	@echo Change output for tarball as ${_UTT_DIST_OUTPUT}
+	mkdir -p ${_TARBALL_ROOT}
+	cp -fr ${_UTT_DIST_DIR}/* ${_TARBALL_ROOT}
+	@# we add some extra files
+	cp ./INSTALL ${_TARBALL_ROOT}/
+
+	tar -czf ${_UTT_DIST_OUTPUT}/${_TAR_FILE_NAME} utt*
+
+	rm -rf ${_TARBALL_ROOT}
Index: app/dist/tarball/README
===================================================================
--- app/dist/tarball/README	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
+++ app/dist/tarball/README	(revision 25ae32e4c2354e0ed6756bbe1de83f39cd814652)
@@ -0,0 +1,6 @@
+This directory contains Makefile, which allows to create tar.gz archive.
+
+To create archive, just write:
+make
+
+Warning: you need define variable _UTT_DIST_DIR.
