aboutsummaryrefslogtreecommitdiffstats
path: root/graphics/gd1
diff options
context:
space:
mode:
authornork <nork@FreeBSD.org>2003-07-12 02:16:14 +0800
committernork <nork@FreeBSD.org>2003-07-12 02:16:14 +0800
commit07d4243107c7c11506a607480ffa2c5fbb716299 (patch)
tree8105e7b9bfe65fc36d1797e9690cdbdc1ba972ff /graphics/gd1
parentb928507d6b0aa80a3d71cc58c69fe7d62d53fc62 (diff)
downloadfreebsd-ports-gnome-07d4243107c7c11506a607480ffa2c5fbb716299.tar.gz
freebsd-ports-gnome-07d4243107c7c11506a607480ffa2c5fbb716299.tar.zst
freebsd-ports-gnome-07d4243107c7c11506a607480ffa2c5fbb716299.zip
o Change library name from libgd to libgd1.
o Do not install everything except headers and libraries (to avoid conflicting with graphics/gd2) o Fix dependency on new libgd1(for many ports). PR: ports/54100 Submitted by: Ports Fury
Diffstat (limited to 'graphics/gd1')
-rw-r--r--graphics/gd1/Makefile34
-rw-r--r--graphics/gd1/files/Makefile.lib36
-rw-r--r--graphics/gd1/files/gd_gif_in.c561
-rw-r--r--graphics/gd1/files/patch-ac188
-rw-r--r--graphics/gd1/files/patch-gdcache.h10
-rw-r--r--graphics/gd1/files/patch-gif4
-rw-r--r--graphics/gd1/pkg-plist16
7 files changed, 617 insertions, 232 deletions
diff --git a/graphics/gd1/Makefile b/graphics/gd1/Makefile
index 7f341cd7cd04..afc96e0f11ee 100644
--- a/graphics/gd1/Makefile
+++ b/graphics/gd1/Makefile
@@ -7,32 +7,22 @@
PORTNAME= gd
PORTVERSION= 1.8.4
-PORTREVISION= 6
+PORTREVISION= 7
PORTEPOCH= 1
CATEGORIES+= graphics
MASTER_SITES= http://www.boutell.com/gd/http/ \
ftp://ftp.boutell.com/pub/boutell/gd/ \
- http://virtual-estates.net/~mi/port-stuff/ \
${MASTER_SITE_RINGSERVER}
MASTER_SITE_SUBDIR= graphics/gd
-DISTFILES= ${DISTNAME}${EXTRACT_SUFX} gd_gif_in.c.bz2
-EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}
MAINTAINER?= ports@FreeBSD.org
-COMMENT?= A graphics library for fast image creation
-
-BUILD_DEPENDS= freetype-config:${PORTSDIR}/print/freetype2 # XXX
-LIB_DEPENDS= jpeg:${PORTSDIR}/graphics/jpeg \
- png:${PORTSDIR}/graphics/png \
- freetype:${PORTSDIR}/print/freetype2
-.if !exists(/usr/bin/bzip2)
-BUILD_DEPENDS+= bzip2:${PORTSDIR}/archivers/bzip2
-.endif
+COMMENT?= A graphics library for fast creation of images
-FREETYPE_CONFIG?= ${LOCALBASE}/bin/freetype-config
+LIB_DEPENDS= jpeg.9:${PORTSDIR}/graphics/jpeg \
+ png.5:${PORTSDIR}/graphics/png \
+ freetype.9:${PORTSDIR}/print/freetype2
-USE_REINPLACE= yes
-MAKE_ENV= FREETYPE_CONFIG="${FREETYPE_CONFIG}"
+MAKEFILE= ${FILESDIR}/Makefile.lib
INSTALLS_SHLIB= yes
.if defined(WITH_X11)
@@ -48,16 +38,6 @@ pre-everything::
.endif
post-extract:
- @${BZIP2_CMD} -dc ${DISTDIR}/${DIST_SUBDIR}/gd_gif_in.c.bz2 \
- > ${WRKSRC}/gd_gif_in.c
-
-post-patch:
- @${REINPLACE_CMD} -e 's|<malloc.h>|<stdlib.h>|g' ${WRKSRC}/gdcache.h
-
-post-install:
-.if !defined(NOPORTDOCS)
- @${MKDIR} ${DOCSDIR}
- ${INSTALL_DATA} ${WRKSRC}/index.html ${DOCSDIR}
-.endif
+ @${CP} ${FILESDIR}/gd_gif_in.c ${WRKSRC}
.include <bsd.port.mk>
diff --git a/graphics/gd1/files/Makefile.lib b/graphics/gd1/files/Makefile.lib
new file mode 100644
index 000000000000..8306444eb839
--- /dev/null
+++ b/graphics/gd1/files/Makefile.lib
@@ -0,0 +1,36 @@
+# $FreeBSD$
+
+PREFIX?= /usr/local
+SHLIB_VER?= 2
+
+LIB= gd1
+LIBDIR= ${PREFIX}/lib
+SHLIB_MAJOR= ${SHLIB_VER}
+SHLIB_MINOR= 0
+NOPROFILE= yes
+NOOBJ= yes
+
+INCS= gd.h gd_io.h gdcache.h gdfontg.h gdfontl.h gdfontmb.h \
+ gdfonts.h gdfontt.h
+INCSDIR= ${PREFIX}/include/gd
+INCDIR= ${INSCDIR} # for pre-bsd.incs.mk API
+
+SRCS= gd.c gd_gd.c gd_gd2.c gd_io.c gd_io_dp.c gd_io_file.c gd_ss.c \
+ gd_io_ss.c gd_png.c gd_jpeg.c gdxpm.c gdfontt.c gdfonts.c \
+ gdfontmb.c gdfontl.c gdfontg.c gdtables.c gdft.c gdttf.c \
+ gdcache.c gdkanji.c wbmp.c gd_wbmp.c gdhelpers.c gd_gif_in.c
+
+CFLAGS+= -I${.CURDIR} -I${LOCALBASE}/include/freetype2/freetype \
+ -I${LOCALBASE}/include/freetype2 -I${LOCALBASE}/include \
+ -DHAVE_LIBPNG -DHAVE_LIBJPEG -DHAVE_LIBFREETYPE -DHAVE_LIBZ
+LDADD= -L${LOCALBASE}/lib -lfreetype -ljpeg -lpng -lz
+
+.ifdef WITH_X11
+CFLAGS+= -I${X11BASE}/include/X11 -I${X11BASE}/include -DHAVE_LIBXPM
+LDADD+= -L${X11BASE}/lib -lXpm -lX11
+.endif
+
+beforeinstall:
+ mkdir -p ${INCSDIR}
+
+.include <bsd.lib.mk>
diff --git a/graphics/gd1/files/gd_gif_in.c b/graphics/gd1/files/gd_gif_in.c
new file mode 100644
index 000000000000..6e779c820963
--- /dev/null
+++ b/graphics/gd1/files/gd_gif_in.c
@@ -0,0 +1,561 @@
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <stdlib.h>
+#include "gd.h"
+
+/* Used only when debugging GIF compression code */
+/* #define DEBUGGING_ENVARS */
+
+#ifdef DEBUGGING_ENVARS
+
+static int verbose_set = 0;
+static int verbose;
+#define VERBOSE (verbose_set?verbose:set_verbose())
+
+static int set_verbose(void)
+{
+ verbose = !!getenv("GIF_VERBOSE");
+ verbose_set = 1;
+ return(verbose);
+}
+
+#else
+
+#define VERBOSE 0
+
+#endif
+
+
+#define MAXCOLORMAPSIZE 256
+
+#define TRUE 1
+#define FALSE 0
+
+#define CM_RED 0
+#define CM_GREEN 1
+#define CM_BLUE 2
+
+#define MAX_LWZ_BITS 12
+
+#define INTERLACE 0x40
+#define LOCALCOLORMAP 0x80
+#define BitSet(byte, bit) (((byte) & (bit)) == (bit))
+
+#define ReadOK(file,buffer,len) (gdGetBuf(buffer, len, file) != 0)
+
+#define LM_to_uint(a,b) (((b)<<8)|(a))
+
+/* We may eventually want to use this information, but def it out for now */
+#if 0
+static struct {
+ unsigned int Width;
+ unsigned int Height;
+ unsigned char ColorMap[3][MAXCOLORMAPSIZE];
+ unsigned int BitPixel;
+ unsigned int ColorResolution;
+ unsigned int Background;
+ unsigned int AspectRatio;
+} GifScreen;
+#endif
+
+static struct {
+ int transparent;
+ int delayTime;
+ int inputFlag;
+ int disposal;
+} Gif89 = { -1, -1, -1, 0 };
+
+static int ReadColorMap (gdIOCtx *fd, int number, unsigned char (*buffer)[256]);
+static int DoExtension (gdIOCtx *fd, int label, int *Transparent);
+static int GetDataBlock (gdIOCtx *fd, unsigned char *buf);
+static int GetCode (gdIOCtx *fd, int code_size, int flag);
+static int LWZReadByte (gdIOCtx *fd, int flag, int input_code_size);
+
+static void ReadImage (gdImagePtr im, gdIOCtx *fd, int len, int height, unsigned char (*cmap)[256], int interlace); /*1.4//, int ignore); */
+
+int ZeroDataBlock;
+
+gdImagePtr
+gdImageCreateFromGif(FILE *fdFile)
+{
+ gdIOCtx *fd = gdNewFileCtx(fdFile);
+ gdImagePtr im = 0;
+
+ im = gdImageCreateFromGifCtx(fd);
+
+ fd->free(fd);
+
+ return im;
+}
+
+gdImagePtr
+gdImageCreateFromGifCtx(gdIOCtxPtr fd)
+{
+ int imageNumber;
+ int BitPixel;
+ int ColorResolution;
+ int Background;
+ int AspectRatio;
+ int Transparent = (-1);
+ unsigned char buf[16];
+ unsigned char c;
+ unsigned char ColorMap[3][MAXCOLORMAPSIZE];
+ unsigned char localColorMap[3][MAXCOLORMAPSIZE];
+ int imw, imh;
+ int useGlobalColormap;
+ int bitPixel;
+ int i;
+ /*1.4//int imageCount = 0; */
+ char version[4];
+
+ gdImagePtr im = 0;
+ ZeroDataBlock = FALSE;
+
+ /*1.4//imageNumber = 1; */
+ if (! ReadOK(fd,buf,6)) {
+ return 0;
+ }
+ if (strncmp((char *)buf,"GIF",3) != 0) {
+ return 0;
+ }
+ strncpy(version, (char *)buf + 3, 3);
+ version[3] = '\0';
+
+ if ((strcmp(version, "87a") != 0) && (strcmp(version, "89a") != 0)) {
+ return 0;
+ }
+ if (! ReadOK(fd,buf,7)) {
+ return 0;
+ }
+ BitPixel = 2<<(buf[4]&0x07);
+ ColorResolution = (int) (((buf[4]&0x70)>>3)+1);
+ Background = buf[5];
+ AspectRatio = buf[6];
+
+ if (BitSet(buf[4], LOCALCOLORMAP)) { /* Global Colormap */
+ if (ReadColorMap(fd, BitPixel, ColorMap)) {
+ return 0;
+ }
+ }
+ for (;;) {
+ if (! ReadOK(fd,&c,1)) {
+ return 0;
+ }
+ if (c == ';') { /* GIF terminator */
+ goto terminated;
+ }
+
+ if (c == '!') { /* Extension */
+ if (! ReadOK(fd,&c,1)) {
+ return 0;
+ }
+ DoExtension(fd, c, &Transparent);
+ continue;
+ }
+
+ if (c != ',') { /* Not a valid start character */
+ continue;
+ }
+
+ /*1.4//++imageCount; */
+
+ if (! ReadOK(fd,buf,9)) {
+ return 0;
+ }
+
+ useGlobalColormap = ! BitSet(buf[8], LOCALCOLORMAP);
+
+ bitPixel = 1<<((buf[8]&0x07)+1);
+
+ imw = LM_to_uint(buf[4],buf[5]);
+ imh = LM_to_uint(buf[6],buf[7]);
+ if (!(im = gdImageCreate(imw, imh))) {
+ return 0;
+ }
+ im->interlace = BitSet(buf[8], INTERLACE);
+ if (! useGlobalColormap) {
+ if (ReadColorMap(fd, bitPixel, localColorMap)) {
+ return 0;
+ }
+ ReadImage(im, fd, imw, imh, localColorMap,
+ BitSet(buf[8], INTERLACE));
+ /*1.4//imageCount != imageNumber); */
+ } else {
+ ReadImage(im, fd, imw, imh,
+ ColorMap,
+ BitSet(buf[8], INTERLACE));
+ /*1.4//imageCount != imageNumber); */
+ }
+ if (Transparent != (-1)) {
+ gdImageColorTransparent(im, Transparent);
+ }
+ goto terminated;
+ }
+
+terminated:
+ /* Terminator before any image was declared! */
+ if (!im) {
+ return 0;
+ }
+ /* Check for open colors at the end, so
+ we can reduce colorsTotal and ultimately
+ BitsPerPixel */
+ for (i=((im->colorsTotal-1)); (i>=0); i--) {
+ if (im->open[i]) {
+ im->colorsTotal--;
+ } else {
+ break;
+ }
+ }
+ return im;
+}
+
+static int
+ReadColorMap(gdIOCtx *fd, int number, unsigned char (*buffer)[256])
+{
+ int i;
+ unsigned char rgb[3];
+
+
+ for (i = 0; i < number; ++i) {
+ if (! ReadOK(fd, rgb, sizeof(rgb))) {
+ return TRUE;
+ }
+ buffer[CM_RED][i] = rgb[0] ;
+ buffer[CM_GREEN][i] = rgb[1] ;
+ buffer[CM_BLUE][i] = rgb[2] ;
+ }
+
+
+ return FALSE;
+}
+
+static int
+DoExtension(gdIOCtx *fd, int label, int *Transparent)
+{
+ static unsigned char buf[256];
+
+ switch (label) {
+ case 0xf9: /* Graphic Control Extension */
+ (void) GetDataBlock(fd, (unsigned char*) buf);
+ Gif89.disposal = (buf[0] >> 2) & 0x7;
+ Gif89.inputFlag = (buf[0] >> 1) & 0x1;
+ Gif89.delayTime = LM_to_uint(buf[1],buf[2]);
+ if ((buf[0] & 0x1) != 0)
+ *Transparent = buf[3];
+
+ while (GetDataBlock(fd, (unsigned char*) buf) != 0)
+ ;
+ return FALSE;
+ default:
+ break;
+ }
+ while (GetDataBlock(fd, (unsigned char*) buf) != 0)
+ ;
+
+ return FALSE;
+}
+
+static int
+GetDataBlock_(gdIOCtx *fd, unsigned char *buf)
+{
+ unsigned char count;
+
+ if (! ReadOK(fd,&count,1)) {
+ return -1;
+ }
+
+ ZeroDataBlock = count == 0;
+
+ if ((count != 0) && (! ReadOK(fd, buf, count))) {
+ return -1;
+ }
+
+ return count;
+}
+
+static int
+GetDataBlock(gdIOCtx *fd, unsigned char *buf)
+{
+ int rv;
+ int i;
+
+ rv = GetDataBlock_(fd,buf);
+ if (VERBOSE)
+ { printf("[GetDataBlock returning %d",rv);
+ if (rv > 0)
+ { printf(":");
+ for (i=0;i<rv;i++) printf(" %02x",buf[i]);
+ }
+ printf("]\n");
+ }
+ return(rv);
+}
+
+static int
+GetCode_(gdIOCtx *fd, int code_size, int flag)
+{
+ static unsigned char buf[280];
+ static int curbit, lastbit, done, last_byte;
+ int i, j, ret;
+ unsigned char count;
+
+ if (flag) {
+ curbit = 0;
+ lastbit = 0;
+ done = FALSE;
+ return 0;
+ }
+
+ if ( (curbit+code_size) >= lastbit) {
+ if (done) {
+ if (curbit >= lastbit) {
+ /* Oh well */
+ }
+ return -1;
+ }
+ buf[0] = buf[last_byte-2];
+ buf[1] = buf[last_byte-1];
+
+ if ((count = GetDataBlock(fd, &buf[2])) == 0)
+ done = TRUE;
+
+ last_byte = 2 + count;
+ curbit = (curbit - lastbit) + 16;
+ lastbit = (2+count)*8 ;
+ }
+
+ ret = 0;
+ for (i = curbit, j = 0; j < code_size; ++i, ++j)
+ ret |= ((buf[ i / 8 ] & (1 << (i % 8))) != 0) << j;
+
+ curbit += code_size;
+ return ret;
+}
+
+static int
+GetCode(gdIOCtx *fd, int code_size, int flag)
+{
+ int rv;
+
+ rv = GetCode_(fd,code_size,flag);
+ if (VERBOSE) printf("[GetCode(,%d,%d) returning %d]\n",code_size,flag,rv);
+ return(rv);
+}
+
+#define STACK_SIZE ((1<<(MAX_LWZ_BITS))*2)
+static int
+LWZReadByte_(gdIOCtx *fd, int flag, int input_code_size)
+{
+ static int fresh = FALSE;
+ int code, incode;
+ static int code_size, set_code_size;
+ static int max_code, max_code_size;
+ static int firstcode, oldcode;
+ static int clear_code, end_code;
+ static int table[2][(1<< MAX_LWZ_BITS)];
+ static int stack[STACK_SIZE], *sp;
+ register int i;
+
+ if (flag) {
+ set_code_size = input_code_size;
+ code_size = set_code_size+1;
+ clear_code = 1 << set_code_size ;
+ end_code = clear_code + 1;
+ max_code_size = 2*clear_code;
+ max_code = clear_code+2;
+
+ GetCode(fd, 0, TRUE);
+
+ fresh = TRUE;
+
+ for (i = 0; i < clear_code; ++i) {
+ table[0][i] = 0;
+ table[1][i] = i;
+ }
+ for (; i < (1<<MAX_LWZ_BITS); ++i)
+ table[0][i] = table[1][0] = 0;
+
+ sp = stack;
+
+ return 0;
+ } else if (fresh) {
+ fresh = FALSE;
+ do {
+ firstcode = oldcode =
+ GetCode(fd, code_size, FALSE);
+ } while (firstcode == clear_code);
+ return firstcode;
+ }
+
+ if (sp > stack)
+ return *--sp;
+
+ while ((code = GetCode(fd, code_size, FALSE)) >= 0) {
+ if (code == clear_code) {
+ for (i = 0; i < clear_code; ++i) {
+ table[0][i] = 0;
+ table[1][i] = i;
+ }
+ for (; i < (1<<MAX_LWZ_BITS); ++i)
+ table[0][i] = table[1][i] = 0;
+ code_size = set_code_size+1;
+ max_code_size = 2*clear_code;
+ max_code = clear_code+2;
+ sp = stack;
+ firstcode = oldcode =
+ GetCode(fd, code_size, FALSE);
+ return firstcode;
+ } else if (code == end_code) {
+ int count;
+ unsigned char buf[260];
+
+ if (ZeroDataBlock)
+ return -2;
+
+ while ((count = GetDataBlock(fd, buf)) > 0)
+ ;
+
+ if (count != 0)
+ return -2;
+ }
+
+ incode = code;
+
+ if (sp == (stack + STACK_SIZE)) {
+ /* Bad compressed data stream */
+ return -1;
+ }
+
+ if (code >= max_code) {
+ *sp++ = firstcode;
+ code = oldcode;
+ }
+
+ while (code >= clear_code) {
+ if (sp == (stack + STACK_SIZE)) {
+ /* Bad compressed data stream */
+ return -1;
+ }
+ *sp++ = table[1][code];
+ if (code == table[0][code]) {
+ /* Oh well */
+ }
+ code = table[0][code];
+ }
+
+ *sp++ = firstcode = table[1][code];
+
+ if ((code = max_code) <(1<<MAX_LWZ_BITS)) {
+ table[0][code] = oldcode;
+ table[1][code] = firstcode;
+ ++max_code;
+ if ((max_code >= max_code_size) &&
+ (max_code_size < (1<<MAX_LWZ_BITS))) {
+ max_code_size *= 2;
+ ++code_size;
+ }
+ }
+
+ oldcode = incode;
+
+ if (sp > stack)
+ return *--sp;
+ }
+ return code;
+}
+
+static int
+LWZReadByte(gdIOCtx *fd, int flag, int input_code_size)
+{
+ int rv;
+
+ rv = LWZReadByte_(fd,flag,input_code_size);
+ if (VERBOSE) printf("[LWZReadByte(,%d,%d) returning %d]\n",flag,input_code_size,rv);
+ return(rv);
+}
+
+static void
+ReadImage(gdImagePtr im, gdIOCtx *fd, int len, int height, unsigned char (*cmap)[256], int interlace) /*1.4//, int ignore) */
+{
+ unsigned char c;
+ int v;
+ int xpos = 0, ypos = 0, pass = 0;
+ int i;
+ /* Stash the color map into the image */
+ for (i=0; (i<gdMaxColors); i++) {
+ im->red[i] = cmap[CM_RED][i];
+ im->green[i] = cmap[CM_GREEN][i];
+ im->blue[i] = cmap[CM_BLUE][i];
+ im->open[i] = 1;
+ }
+ /* Many (perhaps most) of these colors will remain marked open. */
+ im->colorsTotal = gdMaxColors;
+ /*
+ ** Initialize the Compression routines
+ */
+ if (! ReadOK(fd,&c,1)) {
+ return;
+ }
+ if (LWZReadByte(fd, TRUE, c) < 0) {
+ return;
+ }
+
+ /*
+ ** If this is an "uninteresting picture" ignore it.
+ ** REMOVED For 1.4
+ */
+ /*if (ignore) { */
+ /* while (LWZReadByte(fd, FALSE, c) >= 0) */
+ /* ; */
+ /* return; */
+ /*} */
+
+ while ((v = LWZReadByte(fd,FALSE,c)) >= 0 ) {
+ /* This how we recognize which colors are actually used. */
+ if (im->open[v]) {
+ im->open[v] = 0;
+ }
+ gdImageSetPixel(im, xpos, ypos, v);
+ ++xpos;
+ if (xpos == len) {
+ xpos = 0;
+ if (interlace) {
+ switch (pass) {
+ case 0:
+ case 1:
+ ypos += 8; break;
+ case 2:
+ ypos += 4; break;
+ case 3:
+ ypos += 2; break;
+ }
+
+ if (ypos >= height) {
+ ++pass;
+ switch (pass) {
+ case 1:
+ ypos = 4; break;
+ case 2:
+ ypos = 2; break;
+ case 3:
+ ypos = 1; break;
+ default:
+ goto fini;
+ }
+ }
+ } else {
+ ++ypos;
+ }
+ }
+ if (ypos >= height)
+ break;
+ }
+
+fini:
+ if (LWZReadByte(fd,FALSE,c)>=0) {
+ /* Ignore extra */
+ }
+}
+
diff --git a/graphics/gd1/files/patch-ac b/graphics/gd1/files/patch-ac
deleted file mode 100644
index 9d63cb3d8eb1..000000000000
--- a/graphics/gd1/files/patch-ac
+++ /dev/null
@@ -1,188 +0,0 @@
---- Makefile.orig Thu Feb 22 19:03:43 2001
-+++ Makefile Sun Dec 16 05:57:07 2001
-@@ -3,22 +3,30 @@
- #If you do not have gcc, change the setting for COMPILER, but you must
- #use an ANSI standard C compiler (NOT the old SunOS 4.1.3 cc
- #compiler; get gcc if you are still using it).
--COMPILER=gcc
-+COMPILER=${CC}
-
- #If the ar command fails on your system, consult the ar manpage
- #for your system.
--AR=ar
-+#AR=ar
-
- #If you don't have FreeType, libjpeg and/or Xpm installed, including the
- #header files, uncomment this (default). You really must install
- #libpng and zlib to get anywhere if you wish to create PNG images.
--CFLAGS=-O -DHAVE_LIBPNG -DHAVE_LIBJPEG
-+CFLAGS+=-DHAVE_LIBPNG -DHAVE_LIBJPEG -DHAVE_LIBFREETYPE
-
- #If you do have FreeType, libjpeg and/or Xpm fully installed, uncomment a
- #variation of this and comment out the line above. See also LIBS below.
- #CFLAGS=-O -DHAVE_LIBXPM -DHAVE_LIBPNG -DHAVE_LIBJPEG \
- # -DHAVE_LIBFREETYPE -DHAVE_LIBTTF
-
-+.if defined(WITH_X11)
-+CFLAGS+=-DHAVE_XPM
-+.endif
-+
-+.if defined(JISX0208)
-+CFLAGS+=-DJISX0208
-+.endif
-+
- #To use the old FreeType 1.x library, add this additional #define
- #to the line above
- #-DHAVE_LIBTTF
-@@ -30,7 +38,7 @@
- #Some systems are very picky about link order. They don't all agree
- #on the right order, either.
-
--LIBS=-lgd -lpng -lz -lm
-+LIBS=-lgd -lpng -lz -ljpeg -lm `$(FREETYPE_CONFIG) --libs`
-
- #If you do have FreeType, JPEG and/or Xpm fully installed, uncomment a
- #variation of this and comment out the line above. Note that
-@@ -38,6 +46,10 @@
-
- #LIBS=-lgd -lpng -lz -ljpeg -lfreetype -lm -lttf
-
-+.if defined(WITH_X11)
-+LIBS+=-lXpm -lX11
-+.endif
-+
- #Note: for Freetype 1.x, use DHAVE_LIBTTF and -lttf instead.
-
- #Typical install locations for freetype, zlib, xpm, libjpeg and libpng header
-@@ -45,7 +57,11 @@
- #ensure that the version of gd you are installing is used, and not an
- #older release in your directory tree somewhere.
-
--INCLUDEDIRS=-I. -I/usr/include/freetype2 -I/usr/include/X11 -I/usr/X11R6/include/X11 -I/usr/local/include
-+INCLUDEDIRS=-I. `$(FREETYPE_CONFIG) --cflags` -I${LOCALBASE}/include
-+
-+.if defined(WITH_X11)
-+INCLUDEDIRS+=-I${X11BASE}/include/X11 -I${X11BASE}/include
-+.endif
-
- #Typical install locations for freetype, zlib, xpm and libpng libraries.
- #If yours are somewhere else, other than a standard location
-@@ -55,16 +71,20 @@
- #on your system can't cause conflicts while building a new one.
- #This line shouldn't hurt if you don't actually have some of the
- #optional libraries and directories.
--LIBDIRS=-L. -L/usr/local/lib -L/usr/lib/X11 -L/usr/X11R6/lib
-+LIBDIRS=-L. -L${LOCALBASE}/lib -Wl,--rpath,${LOCALBASE}/lib
-+
-+.if defined(WITH_X11)
-+LIBDIRS+=-L${X11BASE}/lib -Wl,--rpath,${X11BASE}/lib
-+.endif
-
- #Location where libgd.a should be installed by "make install".
--INSTALL_LIB=/usr/local/lib
-+INSTALL_LIB=${PREFIX}/lib
-
- #Location where .h files should be installed by "make install".
--INSTALL_INCLUDE=/usr/local/include
-+INSTALL_INCLUDE=${PREFIX}/include/gd
-
- #Location where useful non-test programs should be installed by "make install".
--INSTALL_BIN=/usr/local/bin
-+INSTALL_BIN=${PREFIX}/bin
-
- #
- #
-@@ -74,34 +94,43 @@
-
- VERSION=1.8.4
-
--CC=$(COMPILER) $(INCLUDEDIRS)
--LINK=$(CC) $(LIBDIRS) $(LIBS)
-+CFLAGS+=$(INCLUDEDIRS)
-
- PROGRAMS=$(BIN_PROGRAMS) $(TEST_PROGRAMS)
-
- BIN_PROGRAMS=pngtogd pngtogd2 gdtopng gd2topng gd2copypal gdparttopng webpng
- TEST_PROGRAMS=gdtest gddemo gd2time gdtestft gdtestttf
-
--all: libgd.a $(PROGRAMS)
-+SOVER=2
-+
-+.SUFFIXES: .c .so .o
-
--install: libgd.a $(BIN_PROGRAMS)
-- sh ./install-item 644 libgd.a $(INSTALL_LIB)/libgd.a
-- sh ./install-item 755 pngtogd $(INSTALL_BIN)/pngtogd
-- sh ./install-item 755 pngtogd2 $(INSTALL_BIN)/pngtogd2
-- sh ./install-item 755 gdtopng $(INSTALL_BIN)/gdtopng
-- sh ./install-item 755 gd2topng $(INSTALL_BIN)/gd2topng
-- sh ./install-item 755 gd2copypal $(INSTALL_BIN)/gd2copypal
-- sh ./install-item 755 gdparttopng $(INSTALL_BIN)/gdparttopng
-- sh ./install-item 755 webpng $(INSTALL_BIN)/webpng
-- sh ./install-item 755 bdftogd $(INSTALL_BIN)/bdftogd
-- sh ./install-item 644 gd.h $(INSTALL_INCLUDE)/gd.h
-- sh ./install-item 644 gdcache.h $(INSTALL_INCLUDE)/gdcache.h
-- sh ./install-item 644 gd_io.h $(INSTALL_INCLUDE)/gd_io.h
-- sh ./install-item 644 gdfontg.h $(INSTALL_INCLUDE)/gdfontg.h
-- sh ./install-item 644 gdfontl.h $(INSTALL_INCLUDE)/gdfontl.h
-- sh ./install-item 644 gdfontmb.h $(INSTALL_INCLUDE)/gdfontmb.h
-- sh ./install-item 644 gdfonts.h $(INSTALL_INCLUDE)/gdfonts.h
-- sh ./install-item 644 gdfontt.h $(INSTALL_INCLUDE)/gdfontt.h
-+.c.so:
-+ $(CC) -fpic -DPIC $(CFLAGS) -o $@ -c $<
-+
-+all: libgd.a libgd.so.$(SOVER) $(PROGRAMS)
-+
-+install: libgd.a libgd.so.$(SOVER) $(BIN_PROGRAMS)
-+ -mkdir -p $(INSTALL_LIB) $(INSTALL_INCLUDE) $(INSTALL_BIN)
-+ ${BSD_INSTALL_DATA} libgd.a $(INSTALL_LIB)/libgd.a
-+ ${BSD_INSTALL_DATA} libgd.so.$(SOVER) $(INSTALL_LIB)/libgd.so.$(SOVER)
-+ -ln -sf libgd.so.$(SOVER) $(INSTALL_LIB)/libgd.so
-+ ${BSD_INSTALL_PROGRAM} pngtogd $(INSTALL_BIN)/pngtogd
-+ ${BSD_INSTALL_PROGRAM} pngtogd2 $(INSTALL_BIN)/pngtogd2
-+ ${BSD_INSTALL_PROGRAM} gdtopng $(INSTALL_BIN)/gdtopng
-+ ${BSD_INSTALL_PROGRAM} gd2topng $(INSTALL_BIN)/gd2topng
-+ ${BSD_INSTALL_PROGRAM} gd2copypal $(INSTALL_BIN)/gd2copypal
-+ ${BSD_INSTALL_PROGRAM} gdparttopng $(INSTALL_BIN)/gdparttopng
-+ ${BSD_INSTALL_PROGRAM} webpng $(INSTALL_BIN)/webpng
-+ ${BSD_INSTALL_SCRIPT} bdftogd $(INSTALL_BIN)/bdftogd
-+ ${BSD_INSTALL_DATA} gd.h $(INSTALL_INCLUDE)/gd.h
-+ ${BSD_INSTALL_DATA} gdcache.h $(INSTALL_INCLUDE)/gdcache.h
-+ ${BSD_INSTALL_DATA} gd_io.h $(INSTALL_INCLUDE)/gd_io.h
-+ ${BSD_INSTALL_DATA} gdfontg.h $(INSTALL_INCLUDE)/gdfontg.h
-+ ${BSD_INSTALL_DATA} gdfontl.h $(INSTALL_INCLUDE)/gdfontl.h
-+ ${BSD_INSTALL_DATA} gdfontmb.h $(INSTALL_INCLUDE)/gdfontmb.h
-+ ${BSD_INSTALL_DATA} gdfonts.h $(INSTALL_INCLUDE)/gdfonts.h
-+ ${BSD_INSTALL_DATA} gdfontt.h $(INSTALL_INCLUDE)/gdfontt.h
-
- gddemo: gddemo.o libgd.a
- $(CC) gddemo.o -o gddemo $(LIBDIRS) $(LIBS)
-@@ -138,18 +167,21 @@
- gdtestttf: gdtestttf.o libgd.a
- $(CC) --verbose gdtestttf.o -o gdtestttf $(LIBDIRS) $(LIBS)
-
--libgd.a: gd.o gd_gd.o gd_gd2.o gd_io.o gd_io_dp.o gd_io_file.o gd_ss.o \
-+OBJS= gd.o gd_gd.o gd_gd2.o gd_io.o gd_io_dp.o gd_io_file.o gd_ss.o \
- gd_io_ss.o gd_png.o gd_jpeg.o gdxpm.o gdfontt.o gdfonts.o gdfontmb.o gdfontl.o \
- gdfontg.o gdtables.o gdft.o gdttf.o gdcache.o gdkanji.o wbmp.o \
-- gd_wbmp.o gdhelpers.o gd.h gdfontt.h gdfonts.h gdfontmb.h gdfontl.h \
-+ gd_wbmp.o gdhelpers.o gd_gif_in.o
-+INCS= gd.h gdfontt.h gdfonts.h gdfontmb.h gdfontl.h \
- gdfontg.h gdhelpers.h
-+
-+libgd.a: $(INCS) $(OBJS)
- rm -f libgd.a
-- $(AR) rc libgd.a gd.o gd_gd.o gd_gd2.o gd_io.o gd_io_dp.o \
-- gd_io_file.o gd_ss.o gd_io_ss.o gd_png.o gd_jpeg.o gdxpm.o \
-- gdfontt.o gdfonts.o gdfontmb.o gdfontl.o gdfontg.o \
-- gdtables.o gdft.o gdttf.o gdcache.o gdkanji.o wbmp.o \
-- gd_wbmp.o gdhelpers.o
-+ $(AR) rc libgd.a $(OBJS)
- -ranlib libgd.a
-+
-+libgd.so.$(SOVER): $(INCS) $(OBJS:.o=.so)
-+ $(CC) -shared -Wl,-x,-soname,$@ -o $@ $(OBJS:.o=.so) $(LIBDIRS) $(LIBS)
-+ ln -sf libgd.so.$(SOVER) libgd.so
-
- clean:
- rm -f *.o *.a ${PROGRAMS} test/gdtest.jpg test/gdtest.wbmp
diff --git a/graphics/gd1/files/patch-gdcache.h b/graphics/gd1/files/patch-gdcache.h
new file mode 100644
index 000000000000..408a96443de6
--- /dev/null
+++ b/graphics/gd1/files/patch-gdcache.h
@@ -0,0 +1,10 @@
+--- gdcache.h.orig Wed Feb 7 04:44:02 2001
++++ gdcache.h Fri Jul 4 21:58:32 2003
+@@ -40,7 +40,6 @@
+ /* header */
+ /*********************************************************/
+
+-#include <malloc.h>
+ #ifndef NULL
+ #define NULL (void *)0
+ #endif
diff --git a/graphics/gd1/files/patch-gif b/graphics/gd1/files/patch-gif
index e156fa2dd01f..e78b1e350e3f 100644
--- a/graphics/gd1/files/patch-gif
+++ b/graphics/gd1/files/patch-gif
@@ -9,7 +9,3 @@ images is troubled because of Unisys' zeal in patent enforcement.
+gdImagePtr gdImageCreateFromGif(FILE *fd);
+gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr in);
gdImagePtr gdImageCreateFromPng(FILE *fd);
---- gd_gif_in.c Fri Jul 27 16:13:45 2001
-+++ gd_gif_in.c Fri Jul 27 16:14:46 2001
-@@ -6,1 +6,0 @@
--#include "io.h"
diff --git a/graphics/gd1/pkg-plist b/graphics/gd1/pkg-plist
index 8a33dbcbf553..b0daddfa56ee 100644
--- a/graphics/gd1/pkg-plist
+++ b/graphics/gd1/pkg-plist
@@ -1,11 +1,3 @@
-bin/bdftogd
-bin/gd2copypal
-bin/gd2topng
-bin/gdparttopng
-bin/gdtopng
-bin/pngtogd
-bin/pngtogd2
-bin/webpng
include/gd/gd.h
include/gd/gd_io.h
include/gd/gdcache.h
@@ -14,9 +6,7 @@ include/gd/gdfontl.h
include/gd/gdfontmb.h
include/gd/gdfonts.h
include/gd/gdfontt.h
-lib/libgd.a
-lib/libgd.so
-lib/libgd.so.2
-%%PORTDOCS%%share/doc/gd/index.html
-%%PORTDOCS%%@dirrm share/doc/gd
+lib/libgd1.a
+lib/libgd1.so
+lib/libgd1.so.2
@dirrm include/gd