perl/perl-GD: Added (perl bindings for GD image library).

Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
This commit is contained in:
B. Watson 2016-08-21 23:59:25 +01:00 committed by David Spencer
parent 9b138f88f0
commit 91be75add6
5 changed files with 191 additions and 0 deletions

6
perl/perl-GD/README Normal file
View File

@ -0,0 +1,6 @@
perl-GD (perl bindings for GD image library)
GD.pm is a Perl interface to Thomas Boutell's gd graphics library
(version 2.01 or higher; see below). GD allows you to create color
drawings using a large number of graphics primitives, and emit the
drawings as PNG files.

View File

@ -0,0 +1,40 @@
diff -Naur GD-2.56/t/GD.t GD-2.56.patched/t/GD.t
--- GD-2.56/t/GD.t 2014-10-27 21:34:54.000000000 -0400
+++ GD-2.56.patched/t/GD.t 2016-08-21 18:24:24.469496848 -0400
@@ -7,8 +7,8 @@
use FindBin qw($Bin);
use lib "$Bin/../blib/lib","$Bin/../blib/arch","$Bin/../lib";
use constant FONT=>"$Bin/test_data/Generic.ttf";
-use constant IMAGE_TESTS => 7;
-use Test::More tests => 11;
+use constant IMAGE_TESTS => 6;
+use Test::More tests => 10;
use IO::Dir;
use_ok('GD',':DEFAULT',':cmp');
@@ -219,25 +219,6 @@
return $im;
}
-sub test7 {
- my $im = GD::Image->new(400,250);
- if (!$im) { printf("Test7: no image");};
- my($white,$black,$red,$blue,$yellow) =
- (
- $im->colorAllocate(255, 255, 255),
- $im->colorAllocate(0, 0, 0),
- $im->colorAllocate(255, 0, 0),
- $im->colorAllocate(0,0,255),
- $im->colorAllocate(255,250,205)
- );
-
- # Some TTFs
- $im->stringFT($black,FONT,12.0,0.0,20,20,"Hello world!") || warn $@;
- $im->stringFT($red,FONT,14.0,0.0,20,80,"Hello world!") || warn $@;
- $im->stringFT($blue,FONT,30.0,-0.5,60,100,"Goodbye cruel world!") || warn $@;
- return $im;
-}
-
sub run_image_regression_tests {
my $suffix = $ENV{GDIMAGETYPE} || 'gd2';
print STDERR "# Testing using $suffix support.\n";

View File

@ -0,0 +1,116 @@
#!/bin/sh
# Slackware build script for perl-GD
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
PRGNAM=perl-GD
VERSION=${VERSION:-2.56}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
SRCNAM="GD"
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
cd $SRCNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# the "perl Makefile.PL" method fails to build the shared library,
# probably it's obsolete and the author forgot to remove Makefile.PL
# from the tarball.
# you might notice this in the build log:
# ** WARNING: found gd.h header file in /usr/X11R6/include/gd.h
# this isn't a real issue, since on Slackware /usr/X11R6/include
# is just a symlink to /usr/include.
# one of the tests in t/GD.t fails because it's using freetype to render
# text into images, then comparing pixel-for-pixel to reference images. it
# fails because the results are not pixel-exact, probably due to the
# author using a different version of freetype to generate the reference
# images... or even just different compiler flags used for building
# freetype... or even something as dumb as using a different CPU whose
# floating point returns slightly different results from the author's.
# if you modify the test code so it writes its result to a PNG file and
# then eyeball that next to the reference one (t/test_data/t07/7-00.png),
# you'll be hard-pressed to see the difference... but it's there.
# this patch disables just this one test:
patch -p1 < $CWD/no_ttf_test.diff
perl Build.PL
./Build
./Build test
./Build install \
--prefix /usr \
--installdirs vendor \
--destdir $PKG \
--install_path bindoc=/usr/man/man1 \
--install_path libdoc=/usr/man/man3
# this stuff gets erroneously installed to /usr/bin:
rm -f $PKG/usr/bin/README $PKG/usr/bin/*.PLS
# and this doesn't belong in the package either:
rm -f $PKG/usr/man/man?/*.PLS.*
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
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README* ChangeLog LICENSE $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

10
perl/perl-GD/perl-GD.info Normal file
View File

@ -0,0 +1,10 @@
PRGNAM="perl-GD"
VERSION="2.56"
HOMEPAGE="https://metacpan.org/pod/GD"
DOWNLOAD="https://cpan.metacpan.org/authors/id/L/LD/LDS/GD-2.56.tar.gz"
MD5SUM="c4b3afd98b2c4ce3c2e1027d101a8f1e"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="perl-Module-Build"
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"

19
perl/perl-GD/slack-desc Normal file
View File

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
perl-GD: perl-GD (perl bindings for GD image library)
perl-GD:
perl-GD: GD.pm is a Perl interface to Thomas Boutell's gd graphics library
perl-GD: (version 2.01 or higher; see below). GD allows you to create color
perl-GD: drawings using a large number of graphics primitives, and emit the
perl-GD: drawings as PNG files.
perl-GD:
perl-GD:
perl-GD:
perl-GD:
perl-GD: