1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 MY_PN="MaxMind-DB-Reader-php"
10 PHP_EXT_NAME="maxminddb"
11 PHP_EXT_OPTIONAL_USE="extension"
13 USE_PHP="php5-6 php7-1 php7-2 php7-3"
15 inherit php-ext-source-r3
17 DESCRIPTION="PHP reader for the MaxMind database format"
18 HOMEPAGE="https://github.com/maxmind/${MY_PN}"
19 SRC_URI="https://github.com/maxmind/${MY_PN}/archive/v${PV}.tar.gz -> ${MY_P}.tar.gz"
25 RESTRICT="!test? ( test )"
27 DEPEND="extension? ( dev-libs/libmaxminddb )"
31 # We need to call eapply_user ourselves, because it may be skipped
32 # if either the "extension" USE flag is not set, or if the user's
33 # PHP_TARGETS is essentially empty. In the latter case, the eclass
34 # src_prepare does nothing. We only call the eclass phase conditionally
35 # because the correct version of e.g. "phpize" may not be there
36 # unless USE=extension is set.
37 if use extension ; then
38 php-ext-source-r3_src_prepare
45 # The eclass phase will try to run the ./configure script even if it
46 # doesn't exist (in contrast to the default src_configure), so we
47 # need to skip it if the eclass src_prepare (that creates said
49 use extension && php-ext-source-r3_src_configure
53 # Avoids the same problem as in src_configure.
54 use extension && php-ext-source-r3_src_compile
58 dodoc CHANGELOG.md README.md
59 insinto /usr/share/php
61 insinto /usr/share/php/MaxMind/Db
64 use extension && php-ext-source-r3_src_install
68 # The PHP API has its own set of tests that isn't shipped with the
69 # release tarballs at the moment (github issues 55).
70 use extension && php-ext-source-r3_src_test
74 elog "${PN} has been installed in /usr/share/php/MaxMind/Db/."
75 elog "To use it in a script, require('MaxMind/Db/autoload.php'),"
76 elog "and then most of the examples in the documentation should"
77 elog "work without further modification."