# No tests on x86 because tests require dev-db/mongodb which don't support
# x86 anymore (bug #645994)
RESTRICT="x86? ( test )
!test? (test)"
RDEPEND="app-arch/snappy:=
app-arch/zstd:=
>=dev-libs/libbson-${PV}[static-libs?]
>=dev-libs/libutf8proc-2.8.0:=[static-libs?]
dev-python/sphinx
sys-libs/zlib:=
sasl? ( dev-libs/cyrus-sasl:=)
ssl? (
dev-libs/openssl:=
)"
DEPEND="${RDEPEND}
test? (
dev-db/mongodb
dev-libs/libbson[static-libs]
>=dev-libs/libutf8proc-2.8.0:=[static-libs]
)"
src_prepare(){
cmake_src_prepare
# copy private headers for tests since we don't build libbson
if use test;then
mkdir -p src/libbson/tests/bson || die
cp src/libbson/src/bson/bson-*.h src/libbson/tests/bson/ || die
fi
# remove doc files
sed -i '/^\s*install\s*(FILES COPYING NEWS/,/^\s*)/{d}' CMakeLists.txt || die
# enable tests
sed -i '/message (STATUS "disabling test-libmongoc since using system libbson")/{d}' CMakeLists.txt || die
sed -i '/SET (ENABLE_TESTS OFF)/{d}' CMakeLists.txt || die
sed -i 's/message (FATAL_ERROR "System libbson built without static library target")/message (STATUS "System libbson built without static library target")/' CMakeLists.txt || die
sed -i 's#<bson/bson-private.h>#"bson/bson-private.h"#' src/libbson/tests/test-bson.c || die