Gentoo Archives: gentoo-commits

From: Michael Orlitzky <mjo@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-php/maxmind-db-reader/files/, dev-php/maxmind-db-reader/
Date: Sun, 05 Nov 2017 23:03:50
Message-Id: 1509922661.80d52ea829aac43e9a067b6a8f3e010c221de717.mjo@gentoo
1 commit: 80d52ea829aac43e9a067b6a8f3e010c221de717
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Sun Nov 5 22:52:19 2017 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 5 22:57:41 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=80d52ea8
7
8 dev-php/maxmind-db-reader: new PHP interface to the MaxMind databases.
9
10 Add the new (Composer-based) PHP interface to the MaxMind binary
11 database format. This lets you query the newer "mmdb" files directly,
12 from PHP code. There is an optional C extension that can be built with
13 USE=extension, and which ostensibly (but I have not tested this)
14 improves performance through the use of dev-libs/libmaxminddb.
15
16 Thanks to Steffen Weber for the initial ebuild.
17
18 Reported-by: Steffen Weber
19 Closes: https://bugs.gentoo.org/511088
20 Package-Manager: Portage-2.3.8, Repoman-2.3.3
21
22 dev-php/maxmind-db-reader/Manifest | 1 +
23 dev-php/maxmind-db-reader/files/autoload.php | 6 ++
24 .../maxmind-db-reader-1.2.0.ebuild | 85 ++++++++++++++++++++++
25 dev-php/maxmind-db-reader/metadata.xml | 16 ++++
26 4 files changed, 108 insertions(+)
27
28 diff --git a/dev-php/maxmind-db-reader/Manifest b/dev-php/maxmind-db-reader/Manifest
29 new file mode 100644
30 index 00000000000..b4042bc7805
31 --- /dev/null
32 +++ b/dev-php/maxmind-db-reader/Manifest
33 @@ -0,0 +1 @@
34 +DIST MaxMind-DB-Reader-php-1.2.0.tar.gz 17488 SHA256 b1d0166ac9d7a2df2ec33c2fd3e2ccfcb556f013c8f58df3610e08bbf7e9c383 SHA512 2965c5348ec787e503c04322961b00fe7806cd95c5f711efd9833adc0acb21f0c40cab1983868f8ea0bb4e8576186d83e1e1913b203aab999f3870ea298a9b2a WHIRLPOOL 6059929c7b6e10ceafc4d50b7b2af2162c5a6e3b4dfc7390bd6b7adebca69de1847a01632e63c4b7de09581fdbd3c21dabe3c5182346d503228fd8e0112ad366
35
36 diff --git a/dev-php/maxmind-db-reader/files/autoload.php b/dev-php/maxmind-db-reader/files/autoload.php
37 new file mode 100644
38 index 00000000000..45e8c2dfba3
39 --- /dev/null
40 +++ b/dev-php/maxmind-db-reader/files/autoload.php
41 @@ -0,0 +1,6 @@
42 +<?php
43 +if (!class_exists('Fedora\\Autoloader\\Autoload', false)) {
44 + require_once '/usr/share/php/Fedora/Autoloader/autoload.php';
45 +}
46 +
47 +\Fedora\Autoloader\Autoload::addPsr4('MaxMind\\Db\\', __DIR__);
48
49 diff --git a/dev-php/maxmind-db-reader/maxmind-db-reader-1.2.0.ebuild b/dev-php/maxmind-db-reader/maxmind-db-reader-1.2.0.ebuild
50 new file mode 100644
51 index 00000000000..6d5d40ddc9c
52 --- /dev/null
53 +++ b/dev-php/maxmind-db-reader/maxmind-db-reader-1.2.0.ebuild
54 @@ -0,0 +1,85 @@
55 +# Copyright 1999-2017 Gentoo Foundation
56 +# Distributed under the terms of the GNU General Public License v2
57 +
58 +EAPI=6
59 +
60 +MY_PN="MaxMind-DB-Reader-php"
61 +MY_P="${MY_PN}-${PV}"
62 +S="${WORKDIR}/${MY_P}"
63 +PHP_EXT_S="${S}/ext"
64 +PHP_EXT_NAME="maxminddb"
65 +PHP_EXT_OPTIONAL_USE="extension"
66 +
67 +USE_PHP="php5-6 php7-0 php7-1"
68 +
69 +inherit php-ext-source-r3
70 +
71 +DESCRIPTION="PHP reader for the MaxMind database format"
72 +HOMEPAGE="https://github.com/maxmind/${MY_PN}"
73 +SRC_URI="${HOMEPAGE}/archive/v${PV}.tar.gz -> ${MY_P}.tar.gz"
74 +
75 +LICENSE="Apache-2.0"
76 +SLOT="0"
77 +KEYWORDS="~amd64"
78 +IUSE="extension test"
79 +
80 +COMMON_DEPEND="extension? ( dev-libs/libmaxminddb )"
81 +DEPEND="${COMMON_DEPEND}"
82 +RDEPEND="${COMMON_DEPEND}
83 + dev-php/fedora-autoloader"
84 +
85 +src_unpack() {
86 + # Don't make copies of the source tree if they won't be used.
87 + if use extension; then
88 + php-ext-source-r3_src_unpack
89 + else
90 + default
91 + fi
92 +}
93 +
94 +src_prepare(){
95 + # We need to call eapply_user ourselves, because it may be skipped
96 + # if either the "extension" USE flag is not set, or if the user's
97 + # PHP_TARGETS is essentially empty. In the latter case, the eclass
98 + # src_prepare does nothing. We only call the eclass phase conditionally
99 + # because the correct version of e.g. "phpize" may not be there
100 + # unless USE=extension is set.
101 + eapply_user
102 + use extension && php-ext-source-r3_src_prepare
103 +}
104 +
105 +src_configure() {
106 + # The eclass phase will try to run the ./configure script even if it
107 + # doesn't exist (in contrast to the default src_configure), so we
108 + # need to skip it if the eclass src_prepare (that creates said
109 + # script) is not run.
110 + use extension && php-ext-source-r3_src_configure
111 +}
112 +
113 +src_compile() {
114 + # Avoids the same problem as in src_configure.
115 + use extension && php-ext-source-r3_src_compile
116 +}
117 +
118 +src_install() {
119 + dodoc CHANGELOG.md README.md
120 + insinto /usr/share/php
121 + doins -r src/MaxMind
122 + insinto /usr/share/php/MaxMind/Db
123 + doins "${FILESDIR}/autoload.php"
124 +
125 + use extension && php-ext-source-r3_src_install
126 +}
127 +
128 +src_test() {
129 + # The PHP API has its own set of tests that isn't shipped with the
130 + # release tarballs at the moment (github issues 55).
131 + use extension && php-ext-source-r3_src_test
132 +}
133 +
134 +pkg_postinst(){
135 + elog "${PN} has been installed in /usr/share/php/MaxMind/Db/."
136 + elog "To use it in a script, require('MaxMind/Db/autoload.php'),"
137 + elog "and then most of the examples in the documentation should"
138 + elog "work without further modification."
139 +}
140
141 diff --git a/dev-php/maxmind-db-reader/metadata.xml b/dev-php/maxmind-db-reader/metadata.xml
142 new file mode 100644
143 index 00000000000..c6051cdbefb
144 --- /dev/null
145 +++ b/dev-php/maxmind-db-reader/metadata.xml
146 @@ -0,0 +1,16 @@
147 +<?xml version='1.0' encoding='UTF-8'?>
148 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
149 +<pkgmetadata>
150 + <maintainer type="project">
151 + <email>php-bugs@g.o</email>
152 + <name>PHP</name>
153 + </maintainer>
154 + <use>
155 + <flag name="extension">
156 + Build the C extension that uses <pkg>dev-libs/libmaxminddb</pkg>
157 + </flag>
158 + </use>
159 + <upstream>
160 + <remote-id type="github">maxmind/MaxMind-DB-Reader-php</remote-id>
161 + </upstream>
162 +</pkgmetadata>