summaryrefslogtreecommitdiff
blob: 800a1009536a5f9e6f754632a001c627661acced (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
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Released under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/dev-php/jpgraph/jpgraph-1.12.2.ebuild,v 1.2 2003/08/04 01:21:56 stuart Exp $
#
# Based on the ebuild submitted by ??

DESCRIPTION="JpGraph is a fully OO graph drawing library for PHP."
HOMEPAGE="http://www.aditus.nu/jpgraph/"
SRC_URI="http://www.aditus.nu/jpgraph/downloads/${P}.tar.gz"

# QPL license for non-commercial use, regular commercial license available
LICENSE="QPL-1.0"

IUSE="truetype"

SLOT="0"
KEYWORDS="~x86 ~ppc ~sparc ~alpha"
DEPEND=""
RDEPEND="virtual/php
	     >=media-libs/libgd-1.8"

S="${WORKDIR}/${P}"
JPGRAPH_CACHE_DIR="/var/cache/jpgraph"

inherit php-lib

# setup defaults in case we don't have a web server installed

HTTPD_USER=root
HTTPD_GROUP=root

has_version "net-www/apache" && USE_APACHE=1 && inherit webapp-apache
[ -n $"{USE_APACHE}" ] && webapp-detect || NO_WEBSERVER=1

pkg_setup ()
{
	if [ "${NO_WEBSERVER}" = "1" ]; then
		ewarn "No webserver detected - ${JPGRAPH_CACHE_DIR} will be"
		ewarn "owned by ${HTTPD_USER} instead"
	else
		einfo "Configuring cache dir ${JPGRAPH_CACHE_DIR} for ${WEBAPP_SERVER}"
	fi
}

src_install ()
{
	sed -i 's|DEFINE("CACHE_FILE_GROUP", "wwwadmin");|DEFINE("CACHE_FILE_GROUP", "${HTTPD_GROUP}";|' src/jpgraph.php
	sed -i 's|/tmp/jpgraph_cache/|${JPGRAPH_CACHE_DIR}/|g' src/jpgraph.php

	sed -i 's|DEFINE("USE_CACHE",false);|if (!defined("USE_CACHE")) DEFINE("USE_CACHE", false);|' src/jpgraph.php

	# install php files
	php-lib_src_install src `cd src ; find . -type f -print`

	# install documentation
	dodoc README src/Changelog
	dohtml -r docs/*

	# setup the cache dir
	# cachedir must be world-writable, because PHP/CLI doesn't run
	# as the apache user!

	keepdir "${JPGRAPH_CACHE_DIR}"
	fowners ${HTTPD_USER}.${HTTPD_GROUP} "${JPGRAPH_CACHE_DIR}"
	fperms 777 "${JPGRAPH_CACHE_DIR}"
}