aboutsummaryrefslogtreecommitdiff
path: root/graphics/gd/Makefile
blob: bb6a34d8bd78b615f6e0b31bfe88dbba2c557b35 (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Created by: jeff@cetlink.net
# $FreeBSD$

PORTNAME=	libgd
PORTVERSION=	2.1.0
PORTREVISION?=	1
PORTEPOCH=	1
CATEGORIES+=	graphics
MASTER_SITES=	http://cdn.bitbucket.org/libgd/gd-libgd/downloads/

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

LIB_DEPENDS=	jpeg:${PORTSDIR}/graphics/jpeg \
		tiff:${PORTSDIR}/graphics/tiff \
		png15:${PORTSDIR}/graphics/png \
		freetype:${PORTSDIR}/print/freetype2

CONFLICTS=	bazaar-1.*

USE_XZ=		yes
USES=		pkgconfig
GNU_CONFIGURE=	yes
GNU_CONFIGURE_ENV=	PKG_CONFIG_LIBDIR=${LOCALBASE}/libdata/pkgconfig
GNU_CONFIGURE_ARGS=
USE_LDCONFIG=	yes

OPTIONS_DEFINE=	FONTCONFIG ICONV VPX XPM
OPTIONS_DEFAULT=FONTCONFIG
NO_OPTIONS_SORT=yes

NO_STAGE=	yes
.include <bsd.port.options.mk>

PKGCONFIGDIR?=	${LOCALBASE}/libdata/pkgconfig
# force gdlib-config --ldflags
LDFLAGS+=	-L${LOCALBASE}/lib

.if ${PORT_OPTIONS:MFONTCONFIG}
LIB_DEPENDS+=	fontconfig:${PORTSDIR}/x11-fonts/fontconfig
.else
GNU_CONFIGURE_ARGS+=	--with-fontconfig=no
.endif

.if ${PORT_OPTIONS:MICONV}
USES+=		iconv
GNU_CONFIGURE_ARGS+=	${ICONV_CONFIGURE_ARG}
.else
GNU_CONFIGURE_ARGS+=	--without-libiconv
GNU_CONFIGURE_ARGS+=	--with-libiconv-prefix=no
.endif

.if ${PORT_OPTIONS:MVPX}
LIB_DEPENDS+=	vpx:${PORTSDIR}/multimedia/libvpx
.else
CONFIGURE_ARGS+=	--without-vpx
.endif

# honor global WITHOUT_X11
.if !defined(WITHOUT_X11)
.if ${PORT_OPTIONS:MXPM}
USE_XORG=	xpm x11
GNU_CONFIGURE_ARGS+=	--with-x
.else
GNU_CONFIGURE_ARGS+=	--with-xpm=no
.endif
.endif

# The GD_FONTS environment variable can be set to specify the gzipped
# tar-ball containing the fonts in bdf format and the bdf file names.
# The tarball is the first argument, the tiny, small, medium-bold,
# large, and giant fonts follow.
#
# For example:
# GD_FONTS="/usr/ports/distfiles/x-koi8u.tgz koi6x10.bdf koi8x13.bdf \
#       koi9x15.bdf koi12x24.bdf koi10x20.bdf"
#
.if defined(GD_FONTS)
USES+=		perl5
USE_PERL5=	build
WRKFONTS=	${WRKSRC}/src
.endif

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

post-extract:
.if defined(GD_FONTS)
	cd ${WRKFONTS} && ${SH} ${FILESDIR}/makefonts extract ${GD_FONTS}
.endif

pre-configure:
.if defined(GD_FONTS)
	cd ${WRKFONTS} && ${SH} ${FILESDIR}/makefonts configure ${GD_FONTS}
.endif
	# force PKGCONFIGDIR
	${REINPLACE_CMD} \
		-e 's|^pkgconfigdir =.*|pkgconfigdir = ${PKGCONFIGDIR}|' \
		${WRKSRC}/config/Makefile.in
	# bump shlib version
	${REINPLACE_CMD} \
		-e 's|GDLIB_CURRENT=.*|GDLIB_CURRENT=5|' \
		${WRKSRC}/configure
	# workaround for broken configure
.if ! ${PORT_OPTIONS:MICONV}
	${REINPLACE_CMD} \
		-e 's|iconv|noiconv|' \
		${WRKSRC}/configure
.endif
.if ! ${PORT_OPTIONS:MXPM}
	${REINPLACE_CMD} \
		-e 's|xpm|noxpm|' \
		${WRKSRC}/configure
.endif
.if ! ${PORT_OPTIONS:MFONTCONFIG}
	${REINPLACE_CMD} \
		-e 's|fontconfig|nofontconfig|' \
		${WRKSRC}/configure
.endif

.if defined(GD_FONTS)
pre-build:
	cd ${WRKFONTS} && ${SH} ${FILESDIR}/makefonts build ${GD_FONTS}
.endif

post-install:
	${INSTALL_DATA} ${WRKSRC}/src/gdhelpers.h \
		${PREFIX}/include/

.include <bsd.port.mk>