Compile/Link with absolute paths for bundled/vendored deps. (#11129)
* Do not accept a path when using --with-bundled-lws. The bundled library is always placed under externaldeps/libwebsockets, when using the netdata-installer.sh script. When this option is missing, we look for the system-wide installed version. * Do not accept a path when using --with-bundled-libJudy. The bundled library is always placed under externaldeps/libJudy. When the option is not given, we look for the system-wide installed version. * Use absolute header paths for repo-internal deps. * Use absolute library paths for repo-internal deps.
vkalintiris committed
Jun 1, 2021 at 13:22 UTC
0d96e0a187ee3419a9939b56970248356d05c1e7
5 files changed
+24
-29
Makefile.am
+2
-2
@@ -750,7 +750,7 @@ NETDATA_COMMON_LIBS = \
750
$(NULL)
751
752
if LINK_STATIC_JSONC
753
- NETDATA_COMMON_LIBS += externaldeps/jsonc/libjson-c.a
753
+ NETDATA_COMMON_LIBS += $(abs_top_srcdir)/externaldeps/jsonc/libjson-c.a
754
endif
755
756
NETDATACLI_FILES = \
@@ -771,7 +771,7 @@ netdata_LDADD = \
771
if !ACLK_NG
772
if ENABLE_ACLK
773
netdata_LDADD += \
774
- externaldeps/mosquitto/libmosquitto.a \
774
+ $(abs_top_srcdir)/externaldeps/mosquitto/libmosquitto.a \
775
$(OPTIONAL_LIBCAP_LIBS) \
776
$(OPTIONAL_LWS_LIBS) \
777
$(NETDATA_COMMON_LIBS) \
configure.ac
+17
-22
@@ -174,12 +174,8 @@ AC_ARG_ENABLE(
174
)
175
AC_ARG_WITH(
176
[bundled-lws],
177
- [AS_HELP_STRING([--with-bundled-lws=DIR], [Use a specific Libwebsockets static library @<:@default use system library@:>@])],
178
- [
179
- with_bundled_lws="yes"
180
- bundled_lws_dir="${withval}"
181
- ],
182
- [with_bundled_lws="no"]
177
+ [AS_HELP_STRING([--with-bundled-lws], [Use the bundled version of libwebsockets library @<:@default use system library@:>@])],
178
+ [with_bundled_lws="yes"], [with_bundled_lws="no"]
179
)
180
181
# -----------------------------------------------------------------------------
@@ -432,15 +428,14 @@ test "${enable_dbengine}" = "yes" -a -z "${LZ4_LIBS}" && \
428
AC_MSG_ERROR([liblz4 required but not found. Try installing 'liblz4-dev' or 'lz4-devel'.])
429
430
435
-AC_ARG_WITH([libJudy],
436
- [AS_HELP_STRING([--with-libJudy=PREFIX],[Use a specific Judy library (default is system-library)])],
431
+AC_ARG_WITH([bundled-libJudy],
432
+ [AS_HELP_STRING([--with-bundled-libJudy],[Use the bundled version of Judy library (default is system-library)])],
433
[
438
- libJudy_dir="$withval"
434
AC_MSG_CHECKING(for libJudy in $withval)
440
- if test -f "${libJudy_dir}/libJudy.a" -a -f "${libJudy_dir}/Judy.h"; then
435
+ if test -f "externaldeps/libJudy/libJudy.a" -a -f "externaldeps/libJudy/Judy.h"; then
436
LIBS_BACKUP="${LIBS}"
442
- LIBS="${libJudy_dir}/libJudy.a"
443
- AC_LINK_IFELSE([AC_LANG_SOURCE([[#include "${libJudy_dir}/Judy.h"
437
+ LIBS="externaldeps/libJudy/libJudy.a"
438
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[#include "externaldeps/libJudy/Judy.h"
439
int main (int argc, char **argv) {
440
Pvoid_t PJLArray = (Pvoid_t) NULL;
441
Word_t * PValue;
@@ -450,8 +445,8 @@ AC_ARG_WITH([libJudy],
445
[HAVE_libJudy_a="yes"],
446
[HAVE_libJudy_a="no"])
447
LIBS="${LIBS_BACKUP}"
453
- JUDY_LIBS="${libJudy_dir}/libJudy.a"
454
- JUDY_CFLAGS="-I${libJudy_dir}"
448
+ JUDY_LIBS="\$(abs_top_srcdir)/externaldeps/libJudy/libJudy.a"
449
+ JUDY_CFLAGS="-I \$(abs_top_srcdir)/externaldeps/libJudy"
450
AC_MSG_RESULT([$HAVE_libJudy_a])
451
else
452
libjudy_dir=""
@@ -531,7 +526,7 @@ if test "${enable_jsonc}" != "no" -a -z "${JSONC_LIBS}"; then
526
if test "${HAVE_libjson_c_a}" = "yes"; then
527
AC_DEFINE([LINK_STATIC_JSONC], [1], [static json-c should be used])
528
JSONC_LIBS="static"
534
- OPTIONAL_JSONC_STATIC_CFLAGS="-I externaldeps/jsonc"
529
+ OPTIONAL_JSONC_STATIC_CFLAGS="-I \$(abs_top_srcdir)/externaldeps/jsonc"
530
fi
531
AC_MSG_RESULT([${HAVE_libjson_c_a}])
532
fi
@@ -671,9 +666,9 @@ if test "$enable_cloud" != "no" -a "$aclk_ng" != "yes"; then
666
667
if test "${with_bundled_lws}" = "yes"; then
668
AC_MSG_CHECKING([if libwebsockets static lib is present])
674
- if test -f "${bundled_lws_dir}/libwebsockets.a"; then
675
- LWS_CFLAGS="-I ${bundled_lws_dir}/include"
676
- OPTIONAL_LWS_LIBS="${bundled_lws_dir}/libwebsockets.a"
669
+ if test -f "externaldeps/libwebsockets/libwebsockets.a"; then
670
+ LWS_CFLAGS="-I \$(abs_top_srcdir)/externaldeps/libwebsockets/include"
671
+ OPTIONAL_LWS_LIBS="\$(abs_top_srcdir)/externaldeps/libwebsockets/libwebsockets.a"
672
AC_MSG_RESULT([yes])
673
AC_DEFINE([BUNDLED_LWS], [1], [using statically linked libwebsockets])
674
else
@@ -774,7 +769,7 @@ if test "$enable_cloud" != "no" -a "$aclk_ng" != "no"; then
769
AC_DEFINE([ACLK_NG], [1], [ACLK Next Generation Should be used])
770
AC_DEFINE([ENABLE_ACLK], [1], [netdata ACLK])
771
enable_aclk="yes"
777
- OPTIONAL_ACLK_NG_CFLAGS="-Imqtt_websockets/src/include -Imqtt_websockets/c-rbuf/include -Imqtt_websockets/MQTT-C/include"
772
+ OPTIONAL_ACLK_NG_CFLAGS="-I \$(abs_top_srcdir)/mqtt_websockets/src/include -I \$(abs_top_srcdir)/mqtt_websockets/c-rbuf/include -I \$(abs_top_srcdir)/mqtt_websockets/MQTT-C/include"
773
fi
774
fi
775
AC_SUBST([enable_cloud])
@@ -1087,8 +1082,8 @@ if test "${build_target}" = "linux" -a "${enable_ebpf}" != "no"; then
1082
if test "${have_libelf}" = "yes" -a \
1083
"${have_bpf}" = "yes" -a \
1084
"${have_libbpf}" = "yes"; then
1090
- OPTIONAL_BPF_CFLAGS="${LIBELF_CFLAGS} -I externaldeps/libbpf/include"
1091
- OPTIONAL_BPF_LIBS="externaldeps/libbpf/libbpf.a ${LIBELF_LIBS}"
1085
+ OPTIONAL_BPF_CFLAGS="${LIBELF_CFLAGS} -I \$(abs_top_srcdir)/externaldeps/libbpf/include"
1086
+ OPTIONAL_BPF_LIBS="\$(abs_top_srcdir)/externaldeps/libbpf/libbpf.a ${LIBELF_LIBS}"
1087
AC_DEFINE([HAVE_LIBBPF], [1], [libbpf usability])
1088
enable_ebpf="yes"
1089
else
@@ -1360,7 +1355,7 @@ if test "${enable_backend_prometheus_remote_write}" != "no" -a "${have_libprotob
1355
-a "${have_protoc}" = "yes" -a "${have_CXX_compiler}" = "yes"; then
1356
enable_backend_prometheus_remote_write="yes"
1357
AC_DEFINE([ENABLE_PROMETHEUS_REMOTE_WRITE], [1], [Prometheus remote write API usability])
1363
- OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS="${PROTOBUF_CFLAGS} ${SNAPPY_CFLAGS} -Iexporting/prometheus/remote_write"
1358
+ OPTIONAL_PROMETHEUS_REMOTE_WRITE_CFLAGS="${PROTOBUF_CFLAGS} ${SNAPPY_CFLAGS} -I \$(abs_top_srcdir)/exporting/prometheus/remote_write"
1359
CXX11FLAG="-std=c++11"
1360
OPTIONAL_PROMETHEUS_REMOTE_WRITE_LIBS="${PROTOBUF_LIBS} ${SNAPPY_LIBS}"
1361
else
contrib/debian/rules
+1
-1
@@ -40,7 +40,7 @@ override_dh_auto_configure:
40
autoreconf -ivf
41
dh_auto_configure -- --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib \
42
--libexecdir=/usr/libexec --with-user=netdata --with-math --with-zlib --with-webdir=/var/lib/netdata/www \
43
- --with-bundled-lws=externaldeps/libwebsockets
43
+ --with-bundled-lws
44
45
override_dh_install:
46
cp -v $(BASE_CONFIG) debian/netdata.conf
netdata-installer.sh
+2
-2
@@ -701,7 +701,7 @@ bundle_libwebsockets() {
701
copy_libwebsockets "${tmp}/libwebsockets-${LIBWEBSOCKETS_PACKAGE_VERSION}" &&
702
rm -rf "${tmp}"; then
703
run_ok "libwebsockets built and prepared."
704
- NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS} --with-bundled-lws=externaldeps/libwebsockets"
704
+ NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS} --with-bundled-lws"
705
else
706
run_failed "Failed to build libwebsockets."
707
if [ -n "${NETDATA_REQUIRE_CLOUD}" ]; then
@@ -789,7 +789,7 @@ bundle_judy() {
789
copy_judy "${tmp}/libjudy-${JUDY_PACKAGE_VERSION}" &&
790
rm -rf "${tmp}"; then
791
run_ok "libJudy built and prepared."
792
- NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS} --with-libJudy=externaldeps/libJudy"
792
+ NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS} --with-bundled-libJudy"
793
else
794
run_failed "Failed to build libJudy."
795
if [ -n "${NETDATA_BUILD_JUDY}" ]; then
netdata.spec.in
+2
-2
@@ -237,10 +237,10 @@ export CFLAGS="${CFLAGS} -fPIC" && ${RPM_BUILD_DIR}/%{name}-%{version}/packaging
237
autoreconf -ivf
238
%configure \
239
%if 0%{!?fedora:1} && 0%{!?suse_version:1}
240
- --with-libJudy=externaldeps/libJudy \
240
+ --with-bundled-libJudy \
241
%endif
242
%if 0%{?centos_ver} < 8 || 0%{!?fedora:1}
243
- --with-bundled-lws=externaldeps/libwebsockets \
243
+ --with-bundled-lws \
244
%endif
245
--prefix="%{_prefix}" \
246
--sysconfdir="%{_sysconfdir}" \