Andrei Belov | 9e2db3a | 2020-12-21 18:14:23 +0300 | [diff] [blame] | 1 | MODULES+= opentracing |
| 2 | |
| 3 | MODULE_SUMMARY_opentracing= 3rd-party OpenTracing dynamic module |
| 4 | |
| 5 | include $(CONTRIB)/src/opentracing-cpp/version |
| 6 | include $(CONTRIB)/src/nginx-opentracing/version |
Andrei Belov | 4b71008 | 2021-03-19 18:52:05 +0300 | [diff] [blame] | 7 | include $(CONTRIB)/src/thrift/version |
Andrei Belov | 9e2db3a | 2020-12-21 18:14:23 +0300 | [diff] [blame] | 8 | include $(CONTRIB)/src/jaeger-client-cpp/version |
| 9 | |
| 10 | MODULE_VERSION_opentracing= $(NGINX_OPENTRACING_VERSION) |
| 11 | MODULE_RELEASE_opentracing= 1 |
| 12 | |
| 13 | MODULE_VERSION_PREFIX_opentracing=$(MODULE_TARGET_PREFIX) |
| 14 | |
| 15 | MODULE_SOURCES_opentracing= opentracing-cpp-$(OPENTRACING_CPP_VERSION).tar.gz \ |
| 16 | nginx-opentracing-$(NGINX_OPENTRACING_VERSION).tar.gz \ |
Andrei Belov | 4b71008 | 2021-03-19 18:52:05 +0300 | [diff] [blame] | 17 | thrift-$(THRIFT_VERSION).tar.gz \ |
Andrei Belov | 9e2db3a | 2020-12-21 18:14:23 +0300 | [diff] [blame] | 18 | jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION).tar.gz |
| 19 | |
| 20 | MODULE_PATCHES_opentracing= $(CONTRIB)/src/opentracing-cpp/CMakeLists.txt.patch \ |
Andrei Belov | 4b71008 | 2021-03-19 18:52:05 +0300 | [diff] [blame] | 21 | $(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 Belov | 9e2db3a | 2020-12-21 18:14:23 +0300 | [diff] [blame] | 26 | |
Andrei Belov | b133506 | 2021-03-22 12:30:20 +0300 | [diff] [blame] | 27 | ifeq ($(shell test `rpm --eval '0%{?rhel}'` -gt 0 -a `rpm --eval '0%{?rhel}'` -lt 8 && echo 1),1) |
| 28 | MODULE_PATCHES_opentracing+= $(CONTRIB)/src/jaeger-client-cpp/CMakeLists.txt.suppress-gcc-version-check.patch |
| 29 | endif |
| 30 | |
Andrei Belov | 9e2db3a | 2020-12-21 18:14:23 +0300 | [diff] [blame] | 31 | MODULE_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 Belov | 4b71008 | 2021-03-19 18:52:05 +0300 | [diff] [blame] | 37 | .sum-thrift \ |
Andrei Belov | 9e2db3a | 2020-12-21 18:14:23 +0300 | [diff] [blame] | 38 | .sum-jaeger-client-cpp |
| 39 | touch $@ |
| 40 | |
| 41 | define MODULE_DEFINITIONS_opentracing |
| 42 | %if (0%{?rhel} > 0) || (0%{?amzn} > 0) |
| 43 | %if (0%{?rhel} >= 8) |
| 44 | BuildRequires: cmake |
| 45 | %define _cmake_cmd %{__cmake} |
| 46 | %else |
| 47 | BuildRequires: cmake3 |
| 48 | %define _cmake_cmd %{__cmake3} |
| 49 | %endif |
| 50 | %endif |
| 51 | |
| 52 | %if (0%{?suse_version} >= 1500) || (0%{?fedora} > 0) |
| 53 | BuildRequires: cmake |
| 54 | %define _cmake_cmd %{__cmake} |
| 55 | %endif |
Andrei Belov | b133506 | 2021-03-22 12:30:20 +0300 | [diff] [blame] | 56 | %if (0%{?rhel} >= 7) || (0%{?fedora} > 0) |
Andrei Belov | 9e2db3a | 2020-12-21 18:14:23 +0300 | [diff] [blame] | 57 | BuildRequires: libstdc++-static |
Andrei Belov | 15927bb | 2021-01-19 12:11:41 +0300 | [diff] [blame] | 58 | %endif |
Andrei Belov | 9e2db3a | 2020-12-21 18:14:23 +0300 | [diff] [blame] | 59 | BuildRequires: yaml-cpp-devel |
Andrei Belov | 4b71008 | 2021-03-19 18:52:05 +0300 | [diff] [blame] | 60 | BuildRequires: boost-devel |
Andrei Belov | 9e2db3a | 2020-12-21 18:14:23 +0300 | [diff] [blame] | 61 | endef |
| 62 | export MODULE_DEFINITIONS_opentracing |
| 63 | |
| 64 | MODULE_CC_OPT_opentracing=-I%{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/include |
| 65 | MODULE_CC_OPT_DEBUG_opentracing=$(MODULE_CC_OPT_opentracing) |
| 66 | MODULE_LD_OPT_opentracing=-L%{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib |
| 67 | MODULE_LD_OPT_DEBUG_opentracing=$(MODULE_LD_OPT_opentracing) |
| 68 | |
| 69 | define MODULE_PREBUILD_opentracing |
| 70 | cd %{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION) \&\& \ |
| 71 | mkdir .build \&\& \ |
| 72 | cd .build \&\& \ |
| 73 | %{_cmake_cmd} ../ \&\& \ |
| 74 | DESTDIR=%{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION) make %{?_smp_mflags} install || exit 1 |
Andrei Belov | 4b71008 | 2021-03-19 18:52:05 +0300 | [diff] [blame] | 75 | cd %{bdir}/thrift-$(THRIFT_VERSION) \&\& \ |
| 76 | mkdir .build \&\& \ |
| 77 | cd .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 | ../ \&\& \ |
| 96 | DESTDIR=%{bdir}/thrift-$(THRIFT_VERSION) make %{?_smp_mflags} install || exit 1 |
Andrei Belov | 9e2db3a | 2020-12-21 18:14:23 +0300 | [diff] [blame] | 97 | cd %{bdir}/jaeger-client-cpp-$(JAEGER_CLIENT_CPP_VERSION) \&\& \ |
| 98 | mkdir .build \&\& \ |
| 99 | cd .build \&\& \ |
Andrei Belov | 4b71008 | 2021-03-19 18:52:05 +0300 | [diff] [blame] | 100 | OpenTracing_DIR=%{bdir}/opentracing-cpp-$(OPENTRACING_CPP_VERSION)/usr/local/lib/cmake/OpenTracing \ |
| 101 | thrift_DIR=%{bdir}/thrift-$(THRIFT_VERSION)/usr/local/lib/cmake/thrift \ |
| 102 | %{_cmake_cmd} \ |
Ippolitov Igor | 369efb4 | 2021-03-25 10:41:54 +0000 | [diff] [blame] | 103 | -DJAEGERTRACING_BUILD_EXAMPLES=OFF \ |
Andrei Belov | 4b71008 | 2021-03-19 18:52:05 +0300 | [diff] [blame] | 104 | -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 Belov | 9e2db3a | 2020-12-21 18:14:23 +0300 | [diff] [blame] | 110 | make %{?_smp_mflags} || exit 1 |
| 111 | endef |
| 112 | export MODULE_PREBUILD_opentracing |
| 113 | |
| 114 | define 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/ |
| 128 | endef |
| 129 | export MODULE_PREINSTALL_opentracing |
| 130 | |
| 131 | define 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/* |
| 142 | endef |
| 143 | export MODULE_FILES_opentracing |
| 144 | |
| 145 | define MODULE_POST_opentracing |
| 146 | cat <<BANNER |
| 147 | ---------------------------------------------------------------------- |
| 148 | |
| 149 | The $(MODULE_SUMMARY_opentracing) for $(MODULE_SUMMARY_PREFIX) has been installed. |
| 150 | To enable this module, add the following to /etc/nginx/nginx.conf |
| 151 | and reload nginx: |
| 152 | |
| 153 | load_module modules/ngx_http_opentracing_module.so; |
| 154 | |
| 155 | Note that additional tracer plugins are required in order |
| 156 | to communicate with corresponding services (e.g. Zipkin, Jaeger). |
| 157 | This package includes the Jaeger dynamic tracer plugin: |
| 158 | |
| 159 | /usr/libexec/opentracing/libjaegertracing_plugin.so |
| 160 | |
| 161 | Please refer to the module documentation for further details: |
| 162 | https://github.com/opentracing-contrib/nginx-opentracing |
| 163 | https://github.com/opentracing-contrib/nginx-opentracing/blob/master/doc/Reference.md |
| 164 | |
| 165 | OpenTracing project site (general info and documentation): |
| 166 | https://opentracing.io/ |
| 167 | |
| 168 | ---------------------------------------------------------------------- |
| 169 | BANNER |
| 170 | endef |
| 171 | export MODULE_POST_opentracing |