blob: 1f86c39b4fadac7c0354f2aed6cac1b06a7ccfea (
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# Copyright 2022-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# update based on third_party_release
OPENTELEMETRY_PROTO="1.7.0"
inherit cmake
DESCRIPTION="The OpenTelemetry C++ Client"
HOMEPAGE="
https://opentelemetry.io/
https://github.com/open-telemetry/opentelemetry-cpp/
"
SRC_URI="
https://github.com/open-telemetry/${PN}/archive/refs/tags/v${PV}.tar.gz
-> ${P}.tar.gz
otlp? (
https://github.com/open-telemetry/opentelemetry-proto/archive/refs/tags/v${OPENTELEMETRY_PROTO}.tar.gz
-> opentelemetry-proto-${OPENTELEMETRY_PROTO}.tar.gz
)
"
LICENSE="Apache-2.0"
SLOT="0/1"
KEYWORDS="~amd64 ~arm64 ~ppc64"
IUSE="elasticsearch grpc http otlp prometheus test"
REQUIRED_USE="
grpc? ( otlp )
http? ( otlp )
"
RESTRICT="!test? ( test )"
RDEPEND="
http? (
net-misc/curl
virtual/zlib:=
)
elasticsearch? (
dev-cpp/nlohmann_json
net-misc/curl
)
grpc? ( net-libs/grpc:= )
otlp? (
dev-cpp/abseil-cpp:=
dev-libs/protobuf:=[libprotoc(+)]
dev-cpp/nlohmann_json
)
prometheus? ( dev-cpp/prometheus-cpp )
"
DEPEND="
${RDEPEND}
test? ( dev-cpp/gtest )
"
BDEPEND="
virtual/pkgconfig
otlp? ( dev-libs/protobuf[protoc(+)] )
"
src_configure() {
# sanity check subslot to kick would be drive by bumpers
# https://github.com/open-telemetry/opentelemetry-cpp/blob/main/docs/abi-version-policy.md
local detected_abi
detected_abi="$(sed -n -e 's/^# define OPENTELEMETRY_ABI_VERSION_NO \(.*\)/\1/p' \
api/include/opentelemetry/version.h)"
detected_abi="${detected_abi}"
if [[ "${SLOT}" != "0/${detected_abi}" ]]; then
die "SLOT ${SLOT} doesn't match upstream specified ABI ${detected_abi}."
fi
local detected_proto_ver
detected_proto_ver="$(sed -n -e '/^opentelemetry-proto=/p' third_party_release)"
if [[ "${OPENTELEMETRY_PROTO}" != "${detected_proto_ver#opentelemetry-proto=v}" ]]; then
die "OPENTELEMETRY_PROTO=${OPENTELEMETRY_PROTO} doesn't match upstream specified ${detected_proto_ver}"
fi
local mycmakeargs=(
-DBUILD_TESTING=$(usex test)
-DWITH_BENCHMARK=OFF # benchmark tests dont make sense in ebuilds
-DBUILD_W3CTRACECONTEXT_TEST=OFF # network-sandbox breaking tests
-DWITH_FUNC_TESTS=ON
-DOTELCPP_VERSIONED_LIBS=ON
-DOTELCPP_MAINTAINER_MODE=OFF
-DOPENTELEMETRY_INSTALL=ON
-DWITH_STL=ON
-DWITH_GSL=OFF
-DWITH_API_ONLY=OFF
-DWITH_ELASTICSEARCH=$(usex elasticsearch)
-DWITH_PROMETHEUS=$(usex prometheus)
-DWITH_OPENTRACING=OFF # unpackaged
-DWITH_ZIPKIN=OFF # unpackaged
-DWITH_ETW=OFF # unpackaged
# https://github.com/open-telemetry/opentelemetry-cpp/blob/main/exporters/otlp/README.md
# file exporter can be built separately to the other exporter.
# Its just simpler dependency wise to have a "otlp" use flag that the other exporter require.
-DWITH_OTLP_FILE=$(usex otlp)
-DWITH_OTLP_GRPC=$(usex grpc)
-DWITH_OTLP_HTTP=$(usex http)
-DWITH_OTLP_HTTP_COMPRESSION=ON # zlib is in the system set
)
use otlp && mycmakeargs+=( -DOTELCPP_PROTO_PATH="${WORKDIR}"/opentelemetry-proto-${OPENTELEMETRY_PROTO} )
cmake_src_configure
}
src_test() {
local CMAKE_SKIP_TESTS=(
# needs a running prometheus instance
exporter.PrometheusExporter.ShutdownSetsIsShutdownToTrue
)
# curl tests fragile
cmake_src_test -j1
}
|