blob: 219853f251e9e0d901b6d6197782868cc5a02425 [file] [log] [blame]
Andrei Belov9e2db3a2020-12-21 18:14:23 +03001MODULES+= opentracing
2
3MODULE_SUMMARY_opentracing= 3rd-party OpenTracing dynamic module
4
5include $(CONTRIB)/src/opentracing-cpp/version
6include $(CONTRIB)/src/nginx-opentracing/version
Andrei Belov4b710082021-03-19 18:52:05 +03007include $(CONTRIB)/src/thrift/version
Andrei Belov9e2db3a2020-12-21 18:14:23 +03008include $(CONTRIB)/src/jaeger-client-cpp/version
9
10MODULE_VERSION_opentracing= $(NGINX_OPENTRACING_VERSION)
11MODULE_RELEASE_opentracing= 1
12
13MODULE_VERSION_PREFIX_opentracing=$(MODULE_TARGET_PREFIX)
14
15MODULE_SOURCES_opentracing= opentracing-cpp-$(OPENTRACING_CPP_VERSION).tar.gz \
16 nginx-opentracing-$(NGINX_OPENTRACING_VERSION).tar.gz \
Andrei Belov4b710082021-03-19 18:52:05 +030017 thrift-$(THRIFT_VERSION).tar.gz \
Andrei Belov9e2db3a2020-12-21 18:14:23 +030018 jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION).tar.gz
19
20MODULE_PATCHES_opentracing= $(CONTRIB)/src/opentracing-cpp/CMakeLists.txt.patch \
Andrei Belov4b710082021-03-19 18:52:05 +030021 $(CONTRIB)/src/jaeger-client-cpp/CMakeLists.txt.patch \
22 $(CONTRIB)/src/thrift/CMakeLists.txt.patch \
23 $(CONTRIB)/src/thrift/build-cmake-Config.cmake.in.patch \
24 $(CONTRIB)/src/thrift/build-cmake-ThriftMacros.cmake.patch \
25 $(CONTRIB)/src/thrift/lib-cpp-CMakeLists.txt.patch
Andrei Belov9e2db3a2020-12-21 18:14:23 +030026
Andrei Belovb1335062021-03-22 12:30:20 +030027ifeq ($(shell test `rpm --eval '0%{?rhel}'` -gt 0 -a `rpm --eval '0%{?rhel}'` -lt 8 && echo 1),1)
28MODULE_PATCHES_opentracing+= $(CONTRIB)/src/jaeger-client-cpp/CMakeLists.txt.suppress-gcc-version-check.patch
29endif
30
Andrei Belov9e2db3a2020-12-21 18:14:23 +030031MODULE_CONFARGS_opentracing= --add-dynamic-module=nginx-opentracing-$(NGINX_OPENTRACING_VERSION)/opentracing
32
33.deps-module-opentracing:
34 cd $(CONTRIB) && make \
35 .sum-opentracing-cpp \
36 .sum-nginx-opentracing \
Andrei Belov4b710082021-03-19 18:52:05 +030037 .sum-thrift \
Andrei Belov9e2db3a2020-12-21 18:14:23 +030038 .sum-jaeger-client-cpp
39 touch $@
40
41define MODULE_DEFINITIONS_opentracing
42%if (0%{?rhel} > 0) || (0%{?amzn} > 0)
43%if (0%{?rhel} >= 8)
44BuildRequires: cmake
45%define _cmake_cmd %{__cmake}
46%else
47BuildRequires: cmake3
48%define _cmake_cmd %{__cmake3}
49%endif
50%endif
51
52%if (0%{?suse_version} >= 1500) || (0%{?fedora} > 0)
53BuildRequires: cmake
54%define _cmake_cmd %{__cmake}
55%endif
Andrei Belovb1335062021-03-22 12:30:20 +030056%if (0%{?rhel} >= 7) || (0%{?fedora} > 0)
Andrei Belov9e2db3a2020-12-21 18:14:23 +030057BuildRequires: libstdc++-static
Andrei Belov15927bb2021-01-19 12:11:41 +030058%endif
Andrei Belov9e2db3a2020-12-21 18:14:23 +030059BuildRequires: yaml-cpp-devel
Andrei Belov4b710082021-03-19 18:52:05 +030060BuildRequires: boost-devel
Andrei Belov9e2db3a2020-12-21 18:14:23 +030061endef
62export MODULE_DEFINITIONS_opentracing
63
64MODULE_CC_OPT_opentracing=-I%{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/include
65MODULE_CC_OPT_DEBUG_opentracing=$(MODULE_CC_OPT_opentracing)
66MODULE_LD_OPT_opentracing=-L%{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib
67MODULE_LD_OPT_DEBUG_opentracing=$(MODULE_LD_OPT_opentracing)
68
69define MODULE_PREBUILD_opentracing
70cd %{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION) \&\& \
71mkdir .build \&\& \
72cd .build \&\& \
73%{_cmake_cmd} ../ \&\& \
74DESTDIR=%{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION) make %{?_smp_mflags} install || exit 1
Andrei Belov4b710082021-03-19 18:52:05 +030075cd %{bdir}/thrift-$(THRIFT_VERSION) \&\& \
76mkdir .build \&\& \
77cd .build \&\& \
78%{_cmake_cmd} \
79 -DBUILD_TESTING=OFF \
80 -DBUILD_TUTORIALS=OFF \
81 -DBUILD_COMPILER=OFF \
82 -DBUILD_C_GLIB=OFF \
83 -DBUILD_HASKELL=OFF \
84 -DBUILD_JAVA=OFF \
85 -DBUILD_PYTHON=OFF \
86 -DWITH_QT4=OFF \
87 -DWITH_QT5=OFF \
88 -DWITH_SHARED_LIB=OFF \
89 -DWITH_PLUGIN=OFF \
90 -DWITH_LIBEVENT=OFF \
91 -DWITH_OPENSSL=OFF \
92 -DWITH_ZLIB=OFF \
93 -DBUILD_SHARED_LIBS=ON \
94 -DCMAKE_INSTALL_LIBDIR=lib \
95../ \&\& \
96DESTDIR=%{bdir}/thrift-$(THRIFT_VERSION) make %{?_smp_mflags} install || exit 1
Andrei Belov9e2db3a2020-12-21 18:14:23 +030097cd %{bdir}/jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION) \&\& \
98mkdir .build \&\& \
99cd .build \&\& \
Andrei Belov4b710082021-03-19 18:52:05 +0300100OpenTracing_DIR=%{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib/cmake/OpenTracing \
101thrift_DIR=%{bdir}/thrift-$(THRIFT_VERSION)/usr/local/lib/cmake/thrift \
102%{_cmake_cmd} \
Ippolitov Igor369efb42021-03-25 10:41:54 +0000103 -DJAEGERTRACING_BUILD_EXAMPLES=OFF \
Andrei Belov4b710082021-03-19 18:52:05 +0300104 -DBUILD_TESTING=OFF \
105 -DJAEGERTRACING_PLUGIN=ON \
106 -DCMAKE_BUILD_TYPE=Release \
107 -DHUNTER_CONFIGURATION_TYPES=Release \
108 -DOPENTRACING_INC=%{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/include \
109../ \&\& \
Andrei Belov9e2db3a2020-12-21 18:14:23 +0300110make %{?_smp_mflags} || exit 1
111endef
112export MODULE_PREBUILD_opentracing
113
114define MODULE_PREINSTALL_opentracing
115%{__mkdir} -p $$RPM_BUILD_ROOT%{_libdir}
116%{__install} -m755 %{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib/libopentracing.so.$(OPENTRACING_CPP_VERSION) \
117 $$RPM_BUILD_ROOT%{_libdir}/
118%{__install} -m755 %{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib/libopentracing_mocktracer.so.$(OPENTRACING_CPP_VERSION) \
119 $$RPM_BUILD_ROOT%{_libdir}/
120%{__ln_s} -f libopentracing.so.$(OPENTRACING_CPP_VERSION) $$RPM_BUILD_ROOT%{_libdir}/libopentracing.so.1
121%{__ln_s} -f libopentracing.so.1 $$RPM_BUILD_ROOT%{_libdir}/libopentracing.so
122%{__ln_s} -f libopentracing_mocktracer.so.$(OPENTRACING_CPP_VERSION) $$RPM_BUILD_ROOT%{_libdir}/libopentracing_mocktracer.so.1
123%{__ln_s} -f libopentracing_mocktracer.so.1 $$RPM_BUILD_ROOT%{_libdir}/libopentracing_mocktracer.so
124%{__mkdir} -p $$RPM_BUILD_ROOT%{_includedir}
125%{__cp} -rp %{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/include/opentracing $$RPM_BUILD_ROOT%{_includedir}/
126%{__mkdir} -p $$RPM_BUILD_ROOT%{_libexecdir}/opentracing
127%{__install} -m755 %{bdir}/jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION)/.build/libjaegertracing_plugin.so $$RPM_BUILD_ROOT%{_libexecdir}/opentracing/
128endef
129export MODULE_PREINSTALL_opentracing
130
131define MODULE_FILES_opentracing
132%{_libdir}/libopentracing.so.$(OPENTRACING_CPP_VERSION)
133%{_libdir}/libopentracing.so.1
134%{_libdir}/libopentracing.so
135%{_libdir}/libopentracing_mocktracer.so.$(OPENTRACING_CPP_VERSION)
136%{_libdir}/libopentracing_mocktracer.so.1
137%{_libdir}/libopentracing_mocktracer.so
138%dir %{_libexecdir}/opentracing
139%{_libexecdir}/opentracing/libjaegertracing_plugin.so
140%dir %{_includedir}/opentracing
141%{_includedir}/opentracing/*
142endef
143export MODULE_FILES_opentracing
144
145define MODULE_POST_opentracing
146cat <<BANNER
147----------------------------------------------------------------------
148
149The $(MODULE_SUMMARY_opentracing) for $(MODULE_SUMMARY_PREFIX) has been installed.
150To enable this module, add the following to /etc/nginx/nginx.conf
151and reload nginx:
152
153 load_module modules/ngx_http_opentracing_module.so;
154
155Note that additional tracer plugins are required in order
156to communicate with corresponding services (e.g. Zipkin, Jaeger).
157This package includes the Jaeger dynamic tracer plugin:
158
159 /usr/libexec/opentracing/libjaegertracing_plugin.so
160
161Please refer to the module documentation for further details:
162https://github.com/opentracing-contrib/nginx-opentracing
163https://github.com/opentracing-contrib/nginx-opentracing/blob/master/doc/Reference.md
164
165OpenTracing project site (general info and documentation):
166https://opentracing.io/
167
168----------------------------------------------------------------------
169BANNER
170endef
171export MODULE_POST_opentracing