282
"--enable-plugin-freeipmi") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--enable-plugin-freeipmi/} --enable-plugin-freeipmi" ;;
283
"--disable-plugin-freeipmi") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-plugin-freeipmi/} --disable-plugin-freeipmi" ;;
284
"--disable-https") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-https/} --disable-https" ;;
285
- "--disable-dbengine") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-dbengine/} --disable-dbengine" ;;
285
+ "--disable-dbengine")
286
+ NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-dbengine/} --disable-dbengine"
287
+ NETDATA_DISABLE_DBENGINE=1
288
+ ;;
289
"--enable-plugin-nfacct") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--enable-plugin-nfacct/} --enable-plugin-nfacct" ;;
290
"--disable-plugin-nfacct") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-plugin-nfacct/} --disable-plugin-nfacct" ;;
291
"--enable-plugin-xenstat") NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--enable-plugin-xenstat/} --enable-plugin-xenstat" ;;
322
"--build-json-c")
323
NETDATA_BUILD_JSON_C=1
324
;;
325
+ "--build-judy")
326
+ NETDATA_BUILD_JUDY=1
327
+ ;;
328
"--install")
329
NETDATA_PREFIX="${2}/netdata"
330
shift 1
676
677
# -----------------------------------------------------------------------------
678
679
+build_judy() {
680
+ local env_cmd=''
681
+
682
+ if [ -z "${DONT_SCRUB_CFLAGS_EVEN_THOUGH_IT_MAY_BREAK_THINGS}" ]; then
683
+ env_cmd="env CFLAGS= CXXFLAGS= LDFLAGS="
684
+ fi
685
+
686
+ pushd "${1}" > /dev/null || return 1
687
+ if run ${env_cmd} libtoolize --force --copy && \
688
+ run ${env_cmd} aclocal && \
689
+ run ${env_cmd} autoheader && \
690
+ run ${env_cmd} automake --add-missing --force --copy --include-deps && \
691
+ run ${env_cmd} autoconf && \
692
+ run ${env_cmd} ./configure && \
693
+ run ${env_cmd} make -C src && \
694
+ run ${env_cmd} ar -r src/libJudy.a src/Judy*/*.o ; then
695
+ popd > /dev/null || return 1
696
+ else
697
+ popd > /dev/null || return 1
698
+ return 1
699
+ fi
700
+}
701
+
702
+copy_judy() {
703
+ target_dir="${PWD}/externaldeps/libjudy"
704
+
705
+ run mkdir -p "${target_dir}" || return 1
706
+
707
+ run cp "${1}/src/libJudy.a" "${target_dir}/libJudy.a" || return 1
708
+ run cp "${1}/src/Judy.h" "${target_dir}/Judy.h" || return 1
709
+}
710
+
711
+bundle_judy() {
712
+ # If --build-judy flag or no Judy on the system and we're building the dbengine, bundle our own libJudy.
713
+ # shellcheck disable=SC2235
714
+ if [ -n "${NETDATA_DISABLE_DBENGINE}" ] || ( [ -z "${NETDATA_BUILD_JUDY}" ] && [ -e /usr/include/Judy.h ] ); then
715
+ return 0
716
+ elif [ -n "${NETDATA_BUILD_JUDY}" ] ; then
717
+ progress "User requested bundling of libJudy, building it now"
718
+ elif [ ! -e /usr/include/Judy.h ] ; then
719
+ progress "/usr/include/Judy.h does not exist, but we need libJudy, building our own copy"
720
+ fi
721
+
722
+ progress "Prepare libJudy"
723
+
724
+ JUDY_PACKAGE_VERSION="$(cat packaging/judy.version)"
725
+
726
+ tmp="$(mktemp -d -t netdata-judy-XXXXXX)"
727
+ JUDY_PACKAGE_BASENAME="v${JUDY_PACKAGE_VERSION}.tar.gz"
728
+
729
+ if fetch_and_verify "judy" \
730
+ "https://github.com/netdata/libjudy/archive/${JUDY_PACKAGE_BASENAME}" \
731
+ "${JUDY_PACKAGE_BASENAME}" \
732
+ "${tmp}" \
733
+ "${NETDATA_LOCAL_TARBALL_OVERRIDE_JUDY}"; then
734
+ if run tar -xf "${tmp}/${JUDY_PACKAGE_BASENAME}" -C "${tmp}" &&
735
+ build_judy "${tmp}/libjudy-${JUDY_PACKAGE_VERSION}" &&
736
+ copy_judy "${tmp}/libjudy-${JUDY_PACKAGE_VERSION}" &&
737
+ rm -rf "${tmp}"; then
738
+ run_ok "libJudy built and prepared."
739
+ NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS} --with-libjudy=externaldeps/libJudy"
740
+ else
741
+ run_failed "Failed to build libJudy."
742
+ if [ -n "${NETDATA_BUILD_JUDY}" ]; then
743
+ exit 1
744
+ else
745
+ defer_error_highlighted "Failed to build libJudy. dbengine support will be disabled."
746
+ fi
747
+ fi
748
+ else
749
+ run_failed "Unable to fetch sources for libJudy."
750
+ if [ -n "${NETDATA_BUILD_JUDY}" ]; then
751
+ exit 1
752
+ else
753
+ defer_error_highlighted "Unable to fetch sources for libJudy. dbengine support will be disabled."
754
+ fi
755
+ fi
756
+}
757
+
758
+bundle_judy
759
+
760
+# -----------------------------------------------------------------------------
761
+
762
build_jsonc() {
763
local env_cmd=''
764