#Packager: Dimitris Tzemos <dijemos~at~gmail~dot~com>

pkgname=perl-text-charwidth
pkgver=0.04
pkgrel=1dj
source=("https://www.cpan.org/authors/id/K/KU/KUBOTA/Text-CharWidth-${pkgver}.tar.gz")
docs=("Changes" "README")
url="http://search.cpan.org/dist/${_realname}/"

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"perl-Text-CharWidth (Column Computer)"
"This perl module, Text::CharWidth, gets number of occupied columns of"
"a string on a terminal."
"This module supplies features similar as wcwidth(3) and wcswidth(3)"
"in C language."
"It computes number of columns ocuuied on the terminal by a text"
"string, which is not always equal to its number of characters and"
"depends on the encoding used."
"Parameters are to be given in locale encoding, not always in UTF-8."
)


build() {
    cd Text-CharWidth-${pkgver}

  
perl Makefile.PL \
  PREFIX=/usr \
  INSTALLDIRS=vendor \
  INSTALLVENDORMAN3DIR=/usr/man/man3
make
make test
make install DESTDIR=$PKG

find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done

find $PKG -name perllocal.pod -o -name ".packlist" -o -name "*.bs" | xargs rm -f || true

find $PKG -depth -type d -empty -delete || true

} 
