| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| 5 |
5 |
|
|
6 |
# update based on third_party_release
|
|
7 |
OPENTELEMETRY_PROTO="1.8.0"
|
|
8 |
|
| 6 |
9 |
inherit cmake
|
| 7 |
10 |
|
| 8 |
11 |
DESCRIPTION="The OpenTelemetry C++ Client"
|
| 9 |
12 |
HOMEPAGE="
|
| 10 |
13 |
https://opentelemetry.io/
|
| 11 |
|
https://github.com/open-telemetry/opentelemetry-cpp
|
|
14 |
https://github.com/open-telemetry/opentelemetry-cpp/
|
|
15 |
"
|
|
16 |
SRC_URI="
|
|
17 |
https://github.com/open-telemetry/${PN}/archive/refs/tags/v${PV}.tar.gz
|
|
18 |
-> ${P}.tar.gz
|
|
19 |
otlp? (
|
|
20 |
https://github.com/open-telemetry/opentelemetry-proto/archive/refs/tags/v${OPENTELEMETRY_PROTO}.tar.gz
|
|
21 |
-> opentelemetry-proto-${OPENTELEMETRY_PROTO}.tar.gz
|
|
22 |
)
|
| 12 |
23 |
"
|
| 13 |
|
SRC_URI="https://github.com/open-telemetry/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
|
| 14 |
24 |
|
| 15 |
25 |
LICENSE="Apache-2.0"
|
| 16 |
|
SLOT="0"
|
| 17 |
|
KEYWORDS="amd64 ~arm64 ~ppc64"
|
| 18 |
|
IUSE="+jaeger prometheus test"
|
|
26 |
SLOT="0/1"
|
|
27 |
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
|
|
28 |
|
|
29 |
IUSE="elasticsearch grpc http otlp prometheus test"
|
|
30 |
REQUIRED_USE="
|
|
31 |
grpc? ( otlp )
|
|
32 |
http? ( otlp )
|
|
33 |
"
|
|
34 |
RESTRICT="!test? ( test )"
|
| 19 |
35 |
|
| 20 |
36 |
RDEPEND="
|
| 21 |
|
net-misc/curl:=
|
| 22 |
|
dev-libs/thrift:=
|
| 23 |
|
dev-libs/boost:=
|
|
37 |
http? (
|
|
38 |
net-misc/curl
|
|
39 |
virtual/zlib:=
|
|
40 |
)
|
|
41 |
elasticsearch? (
|
|
42 |
dev-cpp/nlohmann_json
|
|
43 |
net-misc/curl
|
|
44 |
)
|
|
45 |
grpc? ( net-libs/grpc:= )
|
|
46 |
otlp? (
|
|
47 |
dev-cpp/abseil-cpp:=
|
|
48 |
dev-libs/protobuf:=[libprotoc(+)]
|
|
49 |
dev-cpp/nlohmann_json
|
|
50 |
)
|
| 24 |
51 |
prometheus? ( dev-cpp/prometheus-cpp )
|
| 25 |
52 |
"
|
| 26 |
53 |
DEPEND="
|
| 27 |
54 |
${RDEPEND}
|
| 28 |
55 |
test? ( dev-cpp/gtest )
|
| 29 |
56 |
"
|
|
57 |
BDEPEND="
|
|
58 |
virtual/pkgconfig
|
|
59 |
otlp? ( dev-libs/protobuf[protoc(+)] )
|
|
60 |
"
|
| 30 |
61 |
|
| 31 |
|
RESTRICT="!test? ( test )"
|
|
62 |
src_configure() {
|
|
63 |
# sanity check subslot to kick would be drive by bumpers
|
|
64 |
# https://github.com/open-telemetry/opentelemetry-cpp/blob/main/docs/abi-version-policy.md
|
|
65 |
local detected_abi
|
|
66 |
detected_abi="$(sed -n -e 's/^# define OPENTELEMETRY_ABI_VERSION_NO \(.*\)/\1/p' \
|
|
67 |
api/include/opentelemetry/version.h)"
|
|
68 |
detected_abi="${detected_abi}"
|
|
69 |
if [[ "${SLOT}" != "0/${detected_abi}" ]]; then
|
|
70 |
die "SLOT ${SLOT} doesn't match upstream specified ABI ${detected_abi}."
|
|
71 |
fi
|
| 32 |
72 |
|
| 33 |
|
PATCHES=(
|
| 34 |
|
# bug #865029
|
| 35 |
|
"${FILESDIR}/opentelemetry-cpp-1.6.0-dont-install-nosend.patch"
|
| 36 |
|
"${FILESDIR}/opentelemetry-cpp-1.6.0-cmake4.patch"
|
| 37 |
|
"${FILESDIR}/opentelemetry-cpp-1.6.0-gcc13.patch"
|
| 38 |
|
"${FILESDIR}/opentelemetry-cpp-1.6.0-add-benchmark-option.patch"
|
| 39 |
|
)
|
|
73 |
local detected_proto_ver
|
|
74 |
detected_proto_ver="$(sed -n -e '/^opentelemetry-proto=/p' third_party_release)"
|
|
75 |
if [[ "${OPENTELEMETRY_PROTO}" != "${detected_proto_ver#opentelemetry-proto=v}" ]]; then
|
|
76 |
die "OPENTELEMETRY_PROTO=${OPENTELEMETRY_PROTO} doesn't match upstream specified ${detected_proto_ver}"
|
|
77 |
fi
|
| 40 |
78 |
|
| 41 |
|
src_configure() {
|
| 42 |
79 |
local mycmakeargs=(
|
| 43 |
|
-DBUILD_TESTING:BOOL=$(usex test)
|
|
80 |
-DBUILD_TESTING=$(usex test)
|
| 44 |
81 |
-DWITH_BENCHMARK=OFF # benchmark tests dont make sense in ebuilds
|
| 45 |
82 |
-DBUILD_W3CTRACECONTEXT_TEST=OFF # network-sandbox breaking tests
|
|
83 |
-DWITH_FUNC_TESTS=ON
|
|
84 |
|
|
85 |
-DOTELCPP_VERSIONED_LIBS=ON
|
|
86 |
-DOTELCPP_MAINTAINER_MODE=OFF
|
|
87 |
-DOPENTELEMETRY_INSTALL=ON
|
|
88 |
# Modifies ABI and some project expect the non C++ std reliant ABI specifically
|
|
89 |
-DWITH_STL=OFF
|
|
90 |
-DWITH_GSL=OFF
|
|
91 |
|
|
92 |
-DWITH_API_ONLY=OFF
|
|
93 |
|
|
94 |
-DWITH_CONFIGURATION=OFF # experimental, vendored rapidyaml
|
| 46 |
95 |
|
| 47 |
|
-DWITH_JAEGER=$(usex jaeger)
|
|
96 |
-DWITH_ELASTICSEARCH=$(usex elasticsearch)
|
| 48 |
97 |
-DWITH_PROMETHEUS=$(usex prometheus)
|
|
98 |
-DWITH_OPENTRACING=OFF # unpackaged
|
|
99 |
-DWITH_ZIPKIN=OFF # unpackaged
|
|
100 |
-DWITH_ETW=OFF # unpackaged
|
|
101 |
|
|
102 |
# https://github.com/open-telemetry/opentelemetry-cpp/blob/main/exporters/otlp/README.md
|
|
103 |
# file exporter can be built separately to the other exporter.
|
|
104 |
# Its just simpler dependency wise to have a "otlp" use flag that the other exporter require.
|
|
105 |
-DWITH_OTLP_FILE=$(usex otlp)
|
|
106 |
-DWITH_OTLP_GRPC=$(usex grpc)
|
|
107 |
-DWITH_OTLP_HTTP=$(usex http)
|
|
108 |
-DWITH_OTLP_HTTP_COMPRESSION=ON # zlib is in the system set
|
| 49 |
109 |
)
|
|
110 |
use otlp && mycmakeargs+=( -DOTELCPP_PROTO_PATH="${WORKDIR}"/opentelemetry-proto-${OPENTELEMETRY_PROTO} )
|
| 50 |
111 |
|
| 51 |
112 |
cmake_src_configure
|
| 52 |
113 |
}
|
| 53 |
114 |
|
| 54 |
115 |
src_test() {
|
|
116 |
local CMAKE_SKIP_TESTS=(
|
|
117 |
# needs a running prometheus instance
|
|
118 |
exporter.PrometheusExporter.ShutdownSetsIsShutdownToTrue
|
|
119 |
)
|
|
120 |
|
| 55 |
121 |
# curl tests fragile
|
| 56 |
122 |
cmake_src_test -j1
|
| 57 |
123 |
}
|
| 58 |
|
|
| 59 |
|
src_install() {
|
| 60 |
|
cmake_src_install
|
| 61 |
|
|
| 62 |
|
if use prometheus; then
|
| 63 |
|
sed '/^# Create imported target opentelemetry-cpp::prometheus_exporter/i\find_dependency(prometheus-cpp REQUIRED)\n' \
|
| 64 |
|
-i "${ED}/usr/$(get_libdir)/cmake/opentelemetry-cpp/opentelemetry-cpp-target.cmake" || die
|
| 65 |
|
fi
|
| 66 |
|
}
|