dev-libs/kuserfeedback: x86 stable wrt bug #721452
[gentoo.git] / dev-libs / mongo-c-driver / mongo-c-driver-0.98.2.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit autotools eutils
7
8 DESCRIPTION="A high-performance MongoDB driver for C"
9 HOMEPAGE="https://github.com/mongodb/mongo-c-driver"
10 SRC_URI="https://github.com/mongodb/${PN}/releases/download/${PV}/${P}.tar.gz"
11
12 LICENSE="BSD"
13 SLOT="0"
14 KEYWORDS="~amd64 ~hppa ~s390 ~x86"
15 IUSE="debug examples libressl sasl ssl static-libs test"
16
17 RDEPEND=">=dev-libs/libbson-0.98.0
18         sasl? ( dev-libs/cyrus-sasl )
19         ssl? (
20                 !libressl? ( dev-libs/openssl:0= )
21                 libressl? ( dev-libs/libressl:0= )
22         )"
23 DEPEND="${RDEPEND}
24         test? ( dev-db/mongodb )"
25
26 DOCS=( NEWS README.rst TUTORIAL.md )
27
28 # No tests on x86 because tests require dev-db/mongodb which don't support
29 # x86 anymore (bug #645994)
30 RESTRICT="!test? ( test ) x86? ( test )"
31
32 src_prepare() {
33         # https://github.com/mongodb/mongo-c-driver/issues/54
34         sed -i -e "s/PTHREAD_LIBS/PTHREAD_CFLAGS/g" src/Makefile.am \
35                 tests/Makefile.am || die
36         eautoreconf
37 }
38
39 src_configure() {
40         econf --disable-hardening \
41                 --disable-optimizations \
42                 --disable-examples \
43                 $(use_enable sasl) \
44                 $(use_enable ssl) \
45                 $(use_enable debug) \
46                 $(use_enable static-libs static)
47 }
48
49 src_install() {
50         emake DESTDIR="${D}" install
51         doman doc/*.3
52
53         use static-libs || find "${D}" -name '*.la' -delete
54
55         if use examples; then
56                 insinto /usr/share/${PF}/examples
57                 doins -r examples/*.c examples/aggregation examples/bulk
58         fi
59 }
60
61 src_test() {
62         # Avoid allocating too much disk space by using server.smallFiles = 1
63         echo -e "storage:\n    smallFiles: true" > "${T}/mongod.conf"
64         local PORT=27099
65         mongod --port ${PORT} --bind_ip 127.0.0.1 --nounixsocket --fork \
66                 -f "${T}/mongod.conf" --dbpath="${T}" \
67                 --logpath="${T}/mongod.log" || die
68         MONGOC_TEST_HOST="127.0.0.1:${PORT}" emake test
69         kill `cat "${T}/mongod.lock"`
70 }