@cryptotaxi247 / netdata-1 / commits / b94153cfa

Bundle protobuf on CentOS 7 and earlier. (#12167)

* Bundle protobuf on CentOS 7 and earlier. * Fix protobuf dep list in spec file.

Austin S. Hemmelgarn committed Feb 25, 2022 at 07:46 UTC b94153cfa4cc384d5e5595d07317f75901668afb
2 files changed +35 -6
netdata.spec.in
+19 -6
@@ -139,15 +139,23 @@ BuildRequires: libuuid-devel
139 BuildRequires: libuv-devel >= 1
140 BuildRequires: openssl-devel
141 %if 0%{?suse_version}
142 +BuildRequires: protobuf-devel
143 +BuildRequires: libprotobuf-c-devel
144 BuildRequires: judy-devel
145 BuildRequires: liblz4-devel
146 BuildRequires: libjson-c-devel
147 %else
148 %if 0%{?fedora}
149 +BuildRequires: protobuf-devel
150 +BuildRequires: protobuf-c-devel
151 BuildRequires: Judy-devel
152 BuildRequires: lz4-devel
153 BuildRequires: json-c-devel
154 %else
155 +%if 0%{?centos_ver} >= 8
156 +BuildRequires: protobuf-devel
157 +BuildRequires: protobuf-c-devel
158 +%endif
159 BuildRequires: lz4-devel
160 BuildRequires: json-c-devel
161 %endif
@@ -200,12 +208,6 @@ BuildRequires: cups-devel >= 1.7
208
209 # Prometheus remote write dependencies
210 BuildRequires: snappy-devel
203 -BuildRequires: protobuf-devel
204 -%if 0%{?suse_version}
205 -BuildRequires: libprotobuf-c-devel
206 -%else
207 -BuildRequires: protobuf-c-devel
208 -%endif
211 # end - prometheus remote write dependencies
212
213 # #####################################################################
@@ -227,6 +229,12 @@ happened, on your systems and applications.
229 %if 0%{!?fedora:1} && 0%{!?suse_version:1}
230 export CFLAGS="${CFLAGS} -fPIC" && ${RPM_BUILD_DIR}/%{name}-%{version}/packaging/bundle-judy.sh ${RPM_BUILD_DIR}/%{name}-%{version}
231 %endif
232 +# Only bundle protobuf on CentOS 7 or earlier
233 +%if 0%{?centos_ver:1}
234 +%if %{centos_ver} < 8
235 +export CFLAGS="${CFLAGS} -fPIC" && ${RPM_BUILD_DIR}/%{name}-%{version}/packaging/bundle-protobuf.sh ${RPM_BUILD_DIR}/%{name}-%{version}
236 +%endif
237 +%endif
238 %if 0%{?_have_ebpf}
239 %if 0%{?centos_ver:1}
240 %if %{centos_ver} < 8
@@ -249,6 +257,11 @@ autoreconf -ivf
257 %if 0%{!?fedora:1} && 0%{!?suse_version:1}
258 --with-bundled-libJudy \
259 %endif
260 + %if 0%{?centos_ver:1}
261 + %if %{centos_ver} < 8
262 + --with-bundled-protobuf \
263 + %endif
264 + %endif
265 --prefix="%{_prefix}" \
266 --sysconfdir="%{_sysconfdir}" \
267 --localstatedir="%{_localstatedir}" \
packaging/bundle-protobuf.sh new
+16
@@ -0,0 +1,16 @@
1 +#!/bin/sh
2 +
3 +PROTOBUF_TARBALL="protobuf-cpp-$(cat "${1}/packaging/protobuf.version").tar.gz"
4 +PROTOBUF_BUILD_PATH="${1}/externaldeps/protobuf/protobuf-$(cat "${1}/packaging/protobuf.version")"
5 +
6 +mkdir -p "${1}/externaldeps/protobuf" || exit 1
7 +curl -sSL --connect-timeout 10 --retry 3 "https://github.com/protocolbuffers/protobuf/releases/download/v$(cat "${1}/packaging/protobuf.version")/${PROTOBUF_TARBALL}" > "${PROTOBUF_TARBALL}" || exit 1
8 +sha256sum -c "${1}/packaging/protobuf.checksums" || exit 1
9 +tar -xzf "${PROTOBUF_TARBALL}" -C "${1}/externaldeps/protobuf" || exit 1
10 +OLDPWD="${PWD}"
11 +cd "${PROTOBUF_BUILD_PATH}" || exit 1
12 +./configure --disable-shared --without-zlib --disable-dependency-tracking --with-pic || exit 1
13 +make -j "$(nproc)" || exit 1
14 +cd "${OLDPWD}" || exit 1
15 +
16 +cp -a "${PROTOBUF_BUILD_PATH}/src" "${1}/externaldeps/protobuf" || exit 1