summaryrefslogtreecommitdiff
blob: 2210a19992fbd5bca6b9732b1ec6c197c508ba3f (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
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

DESCRIPTION="Full-featured email creation and transfer class for PHP"
HOMEPAGE="https://github.com/PHPMailer/PHPMailer"
SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="doc +examples test"

RDEPEND="dev-lang/php:*"
DEPEND="${RDEPEND}
	doc? ( dev-php/phpDocumentor )
	test? ( ${RDEPEND} dev-php/phpunit )"

# The test suite requires network access.
RESTRICT=test

src_compile(){
	if use doc; then
		phpdoc --filename="class.*.php" \
			   --target="./html" \
			   --cache-folder="${T}" \
			   --title="${PN}" \
			   --sourcecode \
			   --force \
			   --progressbar \
			   || die "failed to generate API documentation"
	fi
}

src_install(){
	insinto "/usr/share/php/${PN}"
	doins -r *.php language extras

	# Fixed in the next version, I hope.
	# https://github.com/PHPMailer/PHPMailer/issues/919
	#dodoc README.md SECURITY.md changelog.md
	#dodoc docs/*
	use examples && dodoc -r examples

	use doc && dodoc -r html/*
}

src_test(){
	cd test/ || die
	phpunit . || die "test suite failed"
}

pkg_postinst(){
	elog "${PN} has been installed in /usr/share/php/${PN}/."
	elog "To use it in a script, require('${PN}/${PN}Autoload.php'),"
	elog "and then use the ${PN} class normally. Most of the examples in"
	elog "the documentation should work without further modification."
}