aboutsummaryrefslogtreecommitdiffstats
path: root/testing/mongo-cxx-driver/APKBUILD
blob: 922a2dd17017f315ce1b69f894cb559a0cc90c20 (plain) (blame)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Contributor: Russ Webber <russ@rw.id.au>
# Maintainer: Russ Webber <russ@rw.id.au>
pkgname="mongo-cxx-driver"
pkgver="3.4.0"
_commit="131fa1a67acd45c0eebcbdcfee42b212af8d2e80" # master compiles with GCC8.3/CXX17
pkgrel=2
pkgdesc="C++ driver for MongoDB"
url="http://mongocxx.org/"
arch="all"
license="Apache-2.0"
makedepends="cmake mongo-c-driver-dev libbson-dev openssl-dev python3 snappy-dev"
subpackages="$pkgname-dev:_dev libbsoncxx libbsoncxx-dev"
source="mongo-cxx-driver-$pkgver.tar.gz::https://github.com/mongodb/mongo-cxx-driver/archive/$_commit.tar.gz
	01-dont-build-mongo-tests.patch"
builddir="$srcdir/mongo-cxx-driver-$_commit"

prepare() {
	mkdir -p "$builddir/build"
	default_prepare
}

build() {
	cd "$builddir/build"
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		-DCMAKE_CXX_STANDARD=17 \
		-DBSONCXX_POLY_USE_STD=ON \
		${CMAKE_CROSSOPTS} ..
	make
}

check() {
	# mongo tests require a running server, so they are disabled.
	# libbsoncxx tests are still ran
	cd "$builddir/build"
	make test
}

package() {
	cd "$builddir/build"
	make DESTDIR="$pkgdir" install
	rm -rf "$pkgdir"/usr/share/mongo-cxx-driver/
}

libbsoncxx() {
	pkgdesc="Building, parsing, and iterating BSON documents using C++"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libbsoncxx.so.* "$subpkgdir"/usr/lib/
}

_dev() {
	# This should be removed once abuild knows how to search for pkg-config
	# files that are in another subpackage that is also being created alongside
	# this one.
	depends_dev="libbsoncxx-dev"

	default_dev

	# libbsoncxx pkg-config files
	mkdir -p "$pkgdir"/usr/lib/pkgconfig
	mv "$subpkgdir"/usr/lib/pkgconfig/libbsoncxx.pc "$pkgdir"/usr/lib/pkgconfig

	# libbsoncxx solink
	mkdir -p "$pkgdir"/usr/lib
	mv "$subpkgdir"/usr/lib/libbsoncxx.so "$pkgdir"/usr/lib

	# libbsoncxx cmake file
	mkdir -p "$pkgdir"/usr/lib/cmake
	mv "$subpkgdir"/usr/lib/cmake/libbsoncxx-* "$pkgdir"/usr/lib/cmake

	# libbsoncxx include files
	mkdir -p "$pkgdir"/usr/include
	mv "$subpkgdir"/usr/include/bsoncxx "$pkgdir"/usr/include
}

sha512sums="271807e0906ba82912c1249571e3784e600c80f0aeb7d5dc927a5784fe3584b35f830677c1634afa1818310243d4b1ae694f32e44c7c36641a4904e4236756e4  mongo-cxx-driver-3.4.0.tar.gz
2d5aa9adb75e3e9244f8b4b2769b0e3f6c92aff8b8f04bd55a0eb2c788e5e4ff24487e94c6680f37d485cd989ec4219edef942b2592e05b80c187611e225ba4f  01-dont-build-mongo-tests.patch"