aboutsummaryrefslogtreecommitdiffstats
path: root/graphics/gd/Makefile
blob: 1f30c8644f94b53125759ff0e93f6a73c51b1c65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# New ports collection makefile for:    gd
# Date created:             27 Mar 1998
# Whom:                 jeff@cetlink.net
#
# $FreeBSD$
#

PORTNAME=   gd
PORTVERSION=    2.0.35
PORTREVISION?=  7
PORTEPOCH=  1
CATEGORIES+=    graphics
MASTER_SITES=   http://www.libgd.org/releases/ \
        ${MASTER_SITE_RINGSERVER}
MASTER_SITE_SUBDIR= graphics/gd
PKGNAMESUFFIX?= ${NOX11_SUFFIX}${PKGNAMESUFFIX2}

MAINTAINER?=    dinoex@FreeBSD.org
COMMENT?=   A graphics library for fast creation of images

LIB_DEPENDS=    jpeg.11:${PORTSDIR}/graphics/jpeg \
        png.6:${PORTSDIR}/graphics/png \
        freetype.9:${PORTSDIR}/print/freetype2

CONFLICTS=  bazaar-1.*

USE_BZIP2=  yes
SCRIPTDIR=  ${FILESDIR}
MAKE_ENV=   WRKSRC="${WRKSRC}"
MAKEFILE=   ${FILESDIR}/Makefile.bsd
CPPFLAGS+=  -DHAVE_ERRNO_H -DHAVE_FT2BUILD_H -DHAVE_LIBFREETYPE -DHAVE_LIBJPEG -DHAVE_LIBPNG \
        -DHAVE_LIBZ -DHAVE_STDDEF_H -DHAVE_STDINT_H -DHAVE_STDLIB_H
LDFLAGS+=   -L${WRKSRC}
LDFLAGS2=   -L${PREFIX}/lib -L${LOCALBASE}/lib
FEATURES=   GD_JPEG GD_FREETYPE GD_PNG GD_GIF GD_GIFANIM GD_OPENPOLYGON
USE_LDCONFIG=   yes
WANT_PERL=  yes

OPTIONS=    X11 "X11 support" off \
        XPM "XPM color bitmap loading support (requires X11)" off \
        FONTCONFIG "fontconfig library support (requires X11)" on \
        ICONV "iconv support" off

.include <bsd.port.pre.mk>

.if !defined(WITHOUT_X11)
.if defined(WITH_XPM)
USE_XORG=   xpm x11
CPPFLAGS+=  -I${LOCALBASE}/include/X11 -I${LOCALBASE}/include -DHAVE_LIBXPM
LDFLAGS+=   -L${LOCALBASE}/lib -lXpm -lX11
LDFLAGS2+=  -L${LOCALBASE}/lib
FEATURES+=  GD_XPM
.endif
.endif

.if !defined(WITHOUT_FONTCONFIG)
LIB_DEPENDS+=   fontconfig.1:${PORTSDIR}/x11-fonts/fontconfig
CPPFLAGS+=  -I${LOCALBASE}/include -DHAVE_LIBFONTCONFIG -DHAVE_PTHREAD ${PTHREAD_CFLAGS}
LDFLAGS+=   ${PTHREAD_LIBS} -L${LOCALBASE}/lib -lfontconfig
LDFLAGS2+=  ${PTHREAD_LIBS} -L${LOCALBASE}/lib
FEATURES+=  GD_FONTCONFIG
.endif

.if defined(WITH_ICONV)
USE_ICONV=  yes
CPPFLAGS+=  -DHAVE_ICONV -DHAVE_ICONV_H -DHAVE_ICONV_T_DEF
LDFLAGS+=   -L${LOCALBASE}/lib -liconv
.endif

.if defined(GD_FONTS)
USE_PERL5_BUILD=    yes
SCRIPTS_ENV+=   GD_FONTS="${GD_FONTS}"
.endif

FONTBASE=   ${LOCALBASE}/lib/X11/fonts

pre-extract::
    @${ECHO_MSG} ""
    @${ECHO_MSG} "GD_FONTS can be set to specify an alternative list of .bdf files"
    @${ECHO_MSG} ""

post-configure:
    ${SED} -e 's|@libdir@|${PREFIX}/lib|' \
        -e 's|@includedir@|${PREFIX}/include|' \
        -e 's|@VERSION@|${PORTVERSION}|' \
        -e 's|@GDLIB_MAJOR@|${PORTVERSION:C/([0-9]*).*/\1/1}|' \
        -e 's|@GDLIB_MINOR@|${PORTVERSION:C/[0-9]*[.]([0-9]).*/\1/1}|' \
        -e 's|@GDLIB_REVISION@|${PORTVERSION:C/.*[.]([0-9]*)/\1/1}|' \
        -e 's|@LDFLAGS@|${LDFLAGS2}|' \
        -e 's|@LIBS@|-lgd|' \
        -e 's|@LIBICONV@|${LIBICONV}|' \
        -e 's|@FEATURES@|${FEATURES}|' \
        ${WRKSRC}/config/gdlib-config.in \
        > ${WRKDIR}/gdlib-config
    ${REINPLACE_CMD} \
    -e 's|#define DEFAULT_FONTPATH .*|#define DEFAULT_FONTPATH "${FONTBASE}/TTF:${FONTBASE}/Type1:${FONTBASE}"|' \
        ${WRKSRC}/gd.h

post-install:
    ${INSTALL_DATA} ${WRKSRC}/gdfx.h ${WRKSRC}/gdhelpers.h \
        ${PREFIX}/include/
    ${INSTALL_SCRIPT} ${WRKDIR}/gdlib-config ${PREFIX}/bin/
.if !defined(NOPORTDOCS)
    @${MKDIR} ${DOCSDIR}
    ${INSTALL_DATA} ${WRKSRC}/index.html ${DOCSDIR}
.endif

.include <bsd.port.post.mk>