summaryrefslogtreecommitdiff
blob: fe70946e38ca389a6af4d3cc6464ba28ee2069ef (plain)
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
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-libs/libgd/libgd-1.8.4.ebuild,v 1.7 2003/09/06 23:59:48 msterret Exp $

MY_P=${P/lib/}
S=${WORKDIR}/${MY_P}
DESCRIPTION="A graphics library for fast image creation"
SRC_URI="http://www.boutell.com/gd/http/${MY_P}.tar.gz"
HOMEPAGE="http://www.boutell.com/gd/"

SLOT="0"
LICENSE="as-is | BSD"
KEYWORDS="x86 ppc sparc hppa"
IUSE="X jpeg truetype"

DEPEND="media-libs/libpng
	X? ( virtual/x11 )
	jpeg? ( media-libs/jpeg )
	truetype? ( =media-libs/freetype-1.3* )"

src_unpack() {
	unpack ${A}
	cd ${S}

	local compopts
	local libsopts

	use alpha \
		&& [ "${CC}" == "ccc" ] && epatch ${FILESDIR}/gd-${PV}-dec-alpha-compiler.diff

	use X \
		&& compopts="${compopts} -DHAVE_XPM" \
		&& libsopts="${libsopts} -lXpm -lX11"

	use jpeg \
		&& compopts="${compopts} -DHAVE_LIBJPEG" \
		&& libsopts="${libsopts} -ljpeg"

	compopts="${compopts} -DHAVE_LIBPNG" \
	libsopts="${libsopts} -lpng"

	use truetype \
		&& compopts="${compopts} -DHAVE_LIBTTF" \
		&& libsopts="${libsopts} -lttf"

	mv Makefile Makefile.old || die
	if [ `use truetype` ]
	then
		sed -e "s:^\(CFLAGS\)=.*:\1=${CFLAGS} ${compopts} :" \
			-e "s:^\(LIBS\)=.*:\1=-lm -lgd -lz ${libsopts}:" \
			-e "s:^\(INCLUDEDIRS\)=:\1=-I/usr/include/freetype :" \
		Makefile.old > Makefile || die
	else
		sed -e "s:^\(CFLAGS\)=.*:\1=${CFLAGS} ${compopts} :" \
		-e "s:^\(LIBS\)=.*:\1=-lm -lgd -lz ${libsopts}:" \
		-e "s:\(COMPILER=\)gcc:\1${CC:-gcc}:" \
		Makefile.old > Makefile || die
	fi
}

src_compile() {
	emake || die
}

src_install() {
	dodir /usr/{bin,lib,include}

	make \
		INSTALL_LIB=${D}/usr/lib \
		INSTALL_BIN=${D}/usr/bin \
		INSTALL_INCLUDE=${D}/usr/include \
		install || die

	preplib /usr

	dodoc readme.txt
	dohtml -r ./
}