#!/bin/bash
# package is installed here with the $pkg_make_install comand from the port/conf file
# $pkg_name_version contains portname-portversion
# $pkg_name contains portname
# $pkg_version contains portversion

# $pkg_maintainer_name contains the maintainer's realname
# $pkg_description contains the ports's description

# function omit_dirs {
#	while read filename ; do
#		[ -d $filename ] || echo $filename
#	done
# }


echo "===> building deb package ($pkg_name)"

origdir=$PWD 

cd $portdir/heap
mkdir DEBIAN

exec 9> DEBIAN/control
echo -e "Package: $pkg_name" 1>&9
echo -e "Version: $pkg_version" 1>&9
echo -e "Architecture: "`dpkg --print-architecture ` 1>&9
echo -e "Maintainer: $pkg_maintainer_name" 1>&9
echo -e "Description: $pkg_description" 1>&9
exec 9>&1

test -d $ports_dir/packages/$compile_arch/ || mkdir $ports_dir/packages/$compile_arch/


dpkg-deb --build $portdir/heap $ports_dir/packages/$compile_arch > /dev/null

cd $origdir
