dev-python/click-default-group: arm64 keyworded (bug #700918)
[gentoo.git] / dev-php / PHPMailer / PHPMailer-6.1.2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 DESCRIPTION="Full-featured email creation and transfer class for PHP"
7 HOMEPAGE="https://github.com/PHPMailer/PHPMailer"
8 SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
9
10 LICENSE="LGPL-2.1"
11 SLOT="0"
12 KEYWORDS="~amd64 ~x86"
13
14 # To help out the Composer children, the tests and examples are missing
15 # from the release tarballs.
16 IUSE="doc idn ssl"
17
18 # The ctype and filter extensions get used unconditionally, with no
19 # fallback and no "extension missing" exception. All of the other
20 # extensions are technically optional, depending on how you use
21 # PHPMailer and whether or not you're willing to settle for fallback
22 # implementations.
23 #
24 # The insane dependency string is to prevent the ctype and filter
25 # extensions from being provided by one version (i.e. slot) of PHP,
26 # while intl and unicode are provided by another.
27 RDEPEND="
28         ssl? (
29                 idn?  ( dev-lang/php:*[ctype,filter,intl,ssl,unicode] )
30                 !idn? ( dev-lang/php:*[ctype,filter,ssl] )
31         )
32         !ssl? (
33                 idn?  ( dev-lang/php:*[ctype,filter,intl,unicode] )
34                 !idn? ( dev-lang/php:*[ctype,filter] )
35         )"
36 BDEPEND="doc? ( dev-php/phpDocumentor )"
37
38 src_prepare() {
39         # OAuth.php relies on a (now non-nonexistent) autoloader. We remove
40         # it early so that we don't generate documentation for it later on.
41         rm src/OAuth.php || die 'failed to remove src/OAuth.php'
42         eapply_user
43 }
44
45 src_compile() {
46         if use doc; then
47                 phpdoc --filename="src/*.php" \
48                            --target="./html" \
49                            --cache-folder="${T}" \
50                            --title="${PN}" \
51                            --sourcecode \
52                            --force \
53                            --progressbar \
54                            || die "failed to generate API documentation"
55         fi
56 }
57
58 src_install() {
59         # The PHPMailer class loads its language files
60         # using a relative path, so we need to keep the "src" here.
61         insinto "/usr/share/php/${PN}"
62         doins -r language src
63
64         dodoc README.md SECURITY.md
65         use doc && dodoc -r html/*
66 }
67
68 pkg_postinst() {
69         elog "${PN} has been installed in /usr/share/php/${PN}/."
70         elog "Upstream no longer provides an autoloader, so you will need"
71         elog "to include each source file (for example: PHPMailer.php,"
72         elog "Exception.php,...) that you need."
73 }