summaryrefslogtreecommitdiff
blob: 4b2e018de5355d80b4148c0b39fd42568e43430f (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
61
62
63
64
65
66
67
68
69
70
71
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

SCONS_MIN_VERSION=2.3.0

inherit scons-utils toolchain-funcs

DESCRIPTION="C++ Driver for MongoDB"
HOMEPAGE="https://github.com/mongodb/mongo-cxx-driver"
SRC_URI="https://github.com/mongodb/${PN}/archive/legacy-${PV}.tar.gz"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="debug libressl sasl ssl static-libs"

RDEPEND="
	!dev-db/tokumx
	dev-libs/boost:=[threads(+)]
	sasl? ( dev-libs/cyrus-sasl )
	ssl? (
		!libressl? ( dev-libs/openssl:0= )
		libressl? ( dev-libs/libressl:0= )
	)"
DEPEND="${RDEPEND}"

# Maintainer notes
# TODO: enable test in IUSE with
# test? ( >=dev-cpp/gtest-1.7.0 dev-db/mongodb )

PATCHES=(
	"${FILESDIR}"/${PN}-1.1.0-fix-scons.patch
	"${FILESDIR}"/${PN}-1.1.2-boost-ref.patch
)

S="${WORKDIR}/${PN}-legacy-${PV}"

src_configure() {
	scons_opts=(
		--cc=$(tc-getCC)
		--cxx=$(tc-getCXX)
		--cpppath="${EPREFIX}"/usr/include
		--libpath="${EPREFIX}"/usr/$(get_libdir)
		--variant-dir=build
		--disable-warnings-as-errors
		--sharedclient
	)

	use debug && scons_opts+=( --dbg=on )
	use sasl && scons_opts+=( --use-sasl-client )
	use ssl && scons_opts+=( --ssl )
}

src_compile() {
	escons "${scons_opts[@]}"
}

src_install() {
	escons "${scons_opts[@]}" install --prefix="${ED%/}"/usr

	# fix multilib-strict QA failures
	mv "${ED%/}"/usr/{lib,$(get_libdir)} || die

	einstalldocs

	if ! use static-libs; then
		find "${D}" -name '*.a' -delete || die
	fi
}