File opentelemetry-cpp-181.spec of Package opentelemetry-cpp-181

#
# spec file for package opentelemetry-cpp-181
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define build_ldflags -pthread

Name:           opentelemetry-cpp_181
Version:        1.8.1
Release:        0
Summary:        The C++ OpenTelemetry client library
License:        Apache-2.0
Group:          System/Libraries
URL:            https://github.com/open-telemetry/opentelemetry-cpp.git
Source0:        opentelemetry-cpp-%{version}.tar
Patch0:         dymaminc-proto-library.patch

%define MAJOR_VERSION %(echo %{version} | cut -d. -f1)
%define MINOR_VERSION %(echo %{version} | cut -d. -f2 | cut -d+ -f1)
%define RELEASE_VERSION %(echo %{version} | cut -d. -f3 | cut -d+ -f1)

%define _libname lib-opentelemetry-cpp%{MAJOR_VERSION}_%{MINOR_VERSION}_%{RELEASE_VERSION}

BuildRequires:  abseil-cpp-devel
BuildRequires:  benchmark-devel
BuildRequires:  boost-devel
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gmock
BuildRequires:  grpc-devel
BuildRequires:  gtest
BuildRequires:  libcurl-devel
BuildRequires:  libthrift-devel
BuildRequires:  opentracing-cpp-devel
BuildRequires:  pkg-config
BuildRequires:  protobuf21-devel
BuildRequires:  cmake(Microsoft.GSL)
BuildRequires:  cmake(nlohmann_json)
BuildRequires:  cmake(prometheus-cpp)

%description
OpenTelemetry C++ is under active development.

The API and SDK packages are not yet generally available, and
releases are not guaranteed to conform to a specific version of the specification.

%package -n %{_libname}
Summary:        The C++ OpenTelemetry client library
Group:          System/Libraries

%description -n %{_libname}
OpenTelemetry C++ is under active development.

The API and SDK packages are not yet generally available, and
releases are not guaranteed to conform to a specific version of the specification.

%package devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{_libname} = %{version}

%description devel
Headers and libraries to program against %{name}.

%prep
%autosetup -p1 -n opentelemetry-cpp-%{version}

%build
#export CXXFLAGS="-Walloc-size-larger-than=18446744073709551615"
%cmake \
  -DCMAKE_POLICY_DEFAULT_CMP0167=OLD \
  -DCMAKE_POLICY_DEFAULT_CMP0077=OLD \
  -DCMAKE_EXE_LINKER_FLAGS="%{?build_ldflags} -Wl,--as-needed -Wl,-z,now" \
  -DCMAKE_SHARED_LINKER_FLAGS="%{?build_ldflags} -Wl,--as-needed -Wl,-z,now" \
	-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
	-DWITH_PROMETHEUS=ON \
  -DWITH_OTLP=ON \
  -DWITH_OTLP_GRPC=ON \
  -DWITH_OTLP_HTTP=ON \
  -DWITH_OPENTRACING=ON \
  -DWITH_ABSEIL:BOOL=ON \
  -DWITH_JAEGER=ON \
  -DWITH_STL=ON \
  -DWITH_EXAMPLES=OFF \
  -DBUILD_TESTING=OFF \
  -DBUILD_SHARED_LIBS=ON \
  -DBUILD_STATIC_LIBS=OFF \
  %{nil}

%cmake_build

%install
%cmake_install

%post -n %{_libname} -p /sbin/ldconfig

%postun -n %{_libname} -p /sbin/ldconfig

%files -n %{_libname}
%defattr(-,root,root)
%doc LICENSE
%{_libdir}/*.so

%files devel
%defattr(-,root,root)

%{_includedir}/opentelemetry
%{_libdir}/cmake/*

%changelog
openSUSE Build Service is sponsored by