mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-07-27 10:31:38 +08:00
🏅 Sync 2026-04-06 15:50:29
This commit is contained in:
parent
8da8d669b5
commit
89b54f4dae
@ -1,8 +1,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=3ginfo
|
||||
PKG_VERSION:=20251114
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=20260404
|
||||
PKG_RELEASE:=2
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
@ -365,7 +365,7 @@ function showmodemparams() {
|
||||
}
|
||||
|
||||
if (data.cid_dec && data.cid_dec > 0 && data.operator_mcc == 260) {
|
||||
document.getElementById('btsearch' + idx).setAttribute("href", "http://www.btsearch.pl/szukaj.php?search=" + data.cid_dec + "&siec=-1&mode=std");
|
||||
document.getElementById('btsearch' + idx).setAttribute("href", "https://btsearch.pl/stations?q=" + data.cid_dec);
|
||||
setDisplay('div_btsearch' + idx, true);
|
||||
} else {
|
||||
setDisplay('div_btsearch' + idx, false);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# (c) 2010-2019 Cezary Jackiewicz <cezary@eko.one.pl>
|
||||
# (c) 2010-2026 Cezary Jackiewicz <cezary@eko.one.pl>
|
||||
#
|
||||
|
||||
# Output format
|
||||
@ -426,9 +426,9 @@ if [ "x$CID" != "x" ]; then
|
||||
[ "x$T" != "x-" -a "x$LAC_NUM" != "x-" ] && PAT="^$COPS_NUM;0x"$(printf %04X 0x$T)";0x"$(printf %04X $LAC_NUM)";"
|
||||
is_gz=$(dd if="$CLF" bs=1 count=2 2>/dev/null | hexdump -v -e '1/1 "%02x"')
|
||||
if [ "x$is_gz" = "x1f8b" ] ; then
|
||||
BTSINFO="<a href=\"http://maps.google.pl/?t=k\&z=17\&q="$(zcat "$CLF" | awk -F";" '/'$PAT'/ {printf $5","$6}')"\">"$(zcat "$CLF" | awk -F";" '/'$PAT'/ {gsub(/\!/,"\\!");print $8}')"</a>"
|
||||
BTSINFO="<a href=\"https://maps.google.pl/?t=k\&z=17\&q="$(zcat "$CLF" | awk -F";" '/'$PAT'/ {printf $5","$6}')"\">"$(zcat "$CLF" | awk -F";" '/'$PAT'/ {gsub(/\!/,"\\!");print $8}')"</a>"
|
||||
else
|
||||
BTSINFO="<a href=\"http://maps.google.pl/?t=k\&z=17\&q="$(awk -F";" '/'$PAT'/ {printf $5","$6}' "$CLF")"\">"$(awk -F";" '/'$PAT'/ {gsub(/\!/,"\\!");print $8}' "$CLF")"</a>"
|
||||
BTSINFO="<a href=\"https://maps.google.pl/?t=k\&z=17\&q="$(awk -F";" '/'$PAT'/ {printf $5","$6}' "$CLF")"\">"$(awk -F";" '/'$PAT'/ {gsub(/\!/,"\\!");print $8}' "$CLF")"</a>"
|
||||
fi
|
||||
if [ $FORMAT -eq 2 ]; then
|
||||
BTSINFO=$(echo "$BTSINFO" | sed 's!<a.*>\(.*\)</a>!\1!g')
|
||||
@ -437,12 +437,7 @@ if [ "x$CID" != "x" ]; then
|
||||
|
||||
if [ $FORMAT -eq 0 ]; then
|
||||
case $COPS_NUM in
|
||||
26001*) CID="<a href=\"http://btsearch.pl/szukaj.php?search="$CID"h\&siec=3\&mode=adv\">$CID</a>";;
|
||||
26002*) CID="<a href=\"http://btsearch.pl/szukaj.php?search="$CID"h\&siec=-1\&mode=adv\">$CID</a>";;
|
||||
26003*) CID="<a href=\"http://btsearch.pl/szukaj.php?search="$CID"h\&siec=-1\&mode=adv\">$CID</a>";;
|
||||
26006*) CID="<a href=\"http://btsearch.pl/szukaj.php?search="$CID"h\&siec=4\&mode=adv\">$CID</a>";;
|
||||
26016*) CID="<a href=\"http://btsearch.pl/szukaj.php?search="$CID"h\&siec=7\&mode=adv\">$CID</a>";;
|
||||
26017*) CID="<a href=\"http://btsearch.pl/szukaj.php?search="$CID"h\&siec=8\&mode=adv\">$CID</a>";;
|
||||
260*) CID="<a href=\"https://btsearch.pl/stations?q="$CID_NUM"\">$CID</a>";;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
|
||||
146
netdata/Makefile
Normal file
146
netdata/Makefile
Normal file
@ -0,0 +1,146 @@
|
||||
#
|
||||
# Copyright (C) 2008-2024 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=netdata
|
||||
PKG_VERSION:=2.9.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MAINTAINER:=Josef Schlehofer <pepe.schlehofer@gmail.com>, Daniel Engberg <daniel.engberg.lists@pyret.net>
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
PKG_CPE_ID:=cpe:/a:netdata:netdata
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/netdata/netdata/releases/download/v$(PKG_VERSION)
|
||||
PKG_HASH:=skip
|
||||
PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-v$(PKG_VERSION)
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_BUILD_FLAGS:=no-mips16 gc-sections
|
||||
|
||||
PKG_BUILD_DEPENDS:=protobuf/host rust/host
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
include $(INCLUDE_DIR)/nls.mk
|
||||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||
|
||||
|
||||
define Package/netdata
|
||||
SECTION:=admin
|
||||
CATEGORY:=Administration
|
||||
DEPENDS:=+zlib +libuuid +libuv +libmnl +liblz4 +libjson-c +libyaml +libopenssl +libcurl +protobuf +libzstd +libpcre2
|
||||
TITLE:=Real-time performance monitoring tool
|
||||
URL:=https://www.netdata.cloud/
|
||||
PROVIDES:=netdata-ssl
|
||||
endef
|
||||
|
||||
define Package/netdata/description
|
||||
netdata is a highly optimized Linux daemon providing real-time performance
|
||||
monitoring for Linux systems, applications and SNMP devices over the web.
|
||||
|
||||
If you want to use Python plugins install python3, python3-yaml and
|
||||
python3-urllib3
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS)) -O3
|
||||
TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib
|
||||
TARGET_CFLAGS += $(FPIC)
|
||||
|
||||
CMAKE_OPTIONS += \
|
||||
-DCMAKE_INSTALL_PREFIX="/" \
|
||||
-DCMAKE_CROSSCOMPILING=True \
|
||||
-DProtobuf_PROTOC_EXECUTABLE=$(STAGING_DIR_HOSTPKG)/bin/protoc \
|
||||
-DENABLE_ACLK=On \
|
||||
-DENABLE_CLOUD=On \
|
||||
-DENABLE_DBENGINE=On \
|
||||
-DENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE=Off \
|
||||
-DENABLE_EXPORTER_MONGODB=Off \
|
||||
-DENABLE_H2O=Off \
|
||||
-DENABLE_BACKTRACE=Off \
|
||||
-DENABLE_LOGS_MANAGEMENT_TESTS=Off \
|
||||
-DENABLE_ML=Off \
|
||||
-DENABLE_NETDATA_JOURNAL_FILE_READER=Off \
|
||||
-DENABLE_PLUGIN_OTEL=Off \
|
||||
-DENABLE_PLUGIN_OTEL_SIGNAL_VIEWER=Off \
|
||||
-DENABLE_PLUGIN_GO=Off \
|
||||
-DENABLE_PLUGIN_APPS=Off \
|
||||
-DENABLE_PLUGIN_CGROUP_NETWORK=Off \
|
||||
-DENABLE_PLUGIN_CUPS=Off \
|
||||
-DENABLE_PLUGIN_DEBUGFS=Off \
|
||||
-DENABLE_PLUGIN_EBPF=Off \
|
||||
-DENABLE_PLUGIN_FREEIPMI=Off \
|
||||
-DENABLE_PLUGIN_LOGS_MANAGEMENT=Off \
|
||||
-DENABLE_PLUGIN_NFACCT=Off \
|
||||
-DENABLE_PLUGIN_SYSTEMD_JOURNAL=Off \
|
||||
-DENABLE_PLUGIN_SYSTEMD_UNITS=Off \
|
||||
-DENABLE_PLUGIN_XENSTAT=Off \
|
||||
-DENABLE_WEBRTC=Off
|
||||
|
||||
define Package/netdata/conffiles
|
||||
/etc/config/netdata
|
||||
/etc/netdata/
|
||||
endef
|
||||
|
||||
define Download/netdata-dashboard
|
||||
URL:=https://app.netdata.cloud
|
||||
URL_FILE:=agent.tar.gz
|
||||
FILE:=netdata-dashboard-agent.tar.gz
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
$(CP) $(DL_DIR)/netdata-dashboard-agent.tar.gz $(PKG_BUILD_DIR)/dashboard.tar.gz
|
||||
endef
|
||||
|
||||
define Package/netdata/install
|
||||
#netdata binary
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/netdata $(1)/usr/sbin
|
||||
|
||||
#netdata libs
|
||||
$(INSTALL_DIR) $(1)/usr/lib/netdata
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/netdata/conf.d $(1)/usr/lib/netdata
|
||||
|
||||
#netdata plugins
|
||||
$(INSTALL_DIR) $(1)/usr/libexec/netdata
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/libexec/netdata/charts.d $(1)/usr/libexec/netdata
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/libexec/netdata/plugins.d $(1)/usr/libexec/netdata
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/libexec/netdata/python.d $(1)/usr/libexec/netdata
|
||||
|
||||
#netdata configuration
|
||||
$(INSTALL_DIR) $(1)/etc/netdata
|
||||
$(CP) $(PKG_INSTALL_DIR)/etc/netdata $(1)/etc
|
||||
$(INSTALL_DATA) ./files/netdata.conf $(1)/etc/netdata
|
||||
touch $(1)/etc/netdata/.opt-out-from-anonymous-statistics
|
||||
|
||||
#netdata webdir and remove uneeded files
|
||||
$(INSTALL_DIR) $(1)/usr/share/netdata
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/share/netdata $(1)/usr/share
|
||||
rm $(1)/usr/share/netdata/build-info-cmake-cache.gz
|
||||
rm $(1)/usr/share/netdata/web/v3/3D_PARTY_LICENSES.txt
|
||||
rm $(1)/usr/share/netdata/web/v3/LICENSE.md
|
||||
rm $(1)/usr/share/netdata/web/v3/*.LICENSE.txt
|
||||
rm -r $(1)/usr/share/netdata/web/static/*
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/netdata.init $(1)/etc/init.d/netdata
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/netdata.config $(1)/etc/config/netdata
|
||||
$(INSTALL_DIR) $(1)/etc/nginx/conf.d
|
||||
$(INSTALL_DATA) ./files/netdata.locations $(1)/etc/nginx/conf.d/netdata.locations
|
||||
$(INSTALL_DATA) ./files/netdata.htpasswd $(1)/etc/nginx/conf.d/netdata.htpasswd
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DATA) ./files/netdata.uci-defaults $(1)/etc/uci-defaults/luci-netdata
|
||||
endef
|
||||
|
||||
$(eval $(call Download,netdata-dashboard))
|
||||
$(eval $(call BuildPackage,netdata))
|
||||
33
netdata/files/netdata.conf
Normal file
33
netdata/files/netdata.conf
Normal file
@ -0,0 +1,33 @@
|
||||
# Full configuration can be retrieved from the running
|
||||
# server at http://localhost:19999/netdata.conf
|
||||
#
|
||||
# Example:
|
||||
# curl -o /etc/netdata/netdata.conf http://localhost:19999/netdata.conf
|
||||
#
|
||||
|
||||
[global]
|
||||
run as user = root
|
||||
|
||||
[db]
|
||||
memory deduplication (ksm) = no
|
||||
|
||||
[logs]
|
||||
daemon = syslog
|
||||
debug = none
|
||||
access = none
|
||||
|
||||
[web]
|
||||
default port = 19999
|
||||
allow connections from = fd* localhost 10.* 192.168.* 172.16.* 172.17.* 172.18.* 172.19.* 172.20.* 172.21.* 172.22.* 172.23.* 172.24.* 172.25.* 172.26.* 172.27.* 172.28.* 172.29.* 172.30.* 172.31.*
|
||||
allow dashboard from = fd* localhost 10.* 192.168.* 172.16.* 172.17.* 172.18.* 172.19.* 172.20.* 172.21.* 172.22.* 172.23.* 172.24.* 172.25.* 172.26.* 172.27.* 172.28.* 172.29.* 172.30.* 172.31.*
|
||||
ssl certificate = /etc/netdata/cert.crt
|
||||
ssl key = /etc/netdata/cert.key
|
||||
|
||||
[plugins]
|
||||
apps = no
|
||||
cgroups = no
|
||||
charts.d = no
|
||||
python.d = no
|
||||
|
||||
[plugin:proc:ipc]
|
||||
shared memory totals = no
|
||||
5
netdata/files/netdata.config
Normal file
5
netdata/files/netdata.config
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
config netdata
|
||||
option enabled '0'
|
||||
option port '19999'
|
||||
|
||||
1
netdata/files/netdata.htpasswd
Normal file
1
netdata/files/netdata.htpasswd
Normal file
@ -0,0 +1 @@
|
||||
admin:$apr1$t7qQjoqb$YBHtAb7VGSkjIdObMG.Oy0
|
||||
96
netdata/files/netdata.init
Normal file
96
netdata/files/netdata.init
Normal file
@ -0,0 +1,96 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
|
||||
APPBINARY=/usr/sbin/netdata
|
||||
CONFIGFILE=/etc/netdata/netdata.conf
|
||||
|
||||
config_load 'netdata'
|
||||
|
||||
get_config() {
|
||||
config_get_bool enabled $1 enabled 0
|
||||
config_get port $1 port 19999
|
||||
config_get_bool ssl $1 enable_ssl 0
|
||||
config_get cert_file $1 cert_file '/etc/netdata/cert.crt'
|
||||
config_get key_file $1 key_file '/etc/netdata/cert.key'
|
||||
config_get_bool ennginx $1 nginx_support 0
|
||||
config_get_bool auth $1 auth 0
|
||||
config_get userpw $1 user_passwd 'admin:$apr1$t7qQjoqb$YBHtAb7VGSkjIdObMG.Oy0'
|
||||
[ "$ennginx" == "1" ] && ssl=0
|
||||
}
|
||||
|
||||
#read_option <option>
|
||||
read_option() {
|
||||
[ -n "$1" ] || return 1
|
||||
sed -En "/^\[web\]/,/^(\[|$)/{s|^\s*$1 = *(.*)$|\1|p}" "$CONFIGFILE"
|
||||
}
|
||||
|
||||
#white_option <option> [value]
|
||||
white_option() {
|
||||
[ -n "$1" ] || return 1
|
||||
if [ -n "$(sed -En "/^\[web\]/,/^(\[|$)/{s|^\s*($1) =.*$|\1|p}" "$CONFIGFILE")" ]; then
|
||||
sed -Ei "/^\[web\]/,/^(\[|$)/{s|^(\s*)$1 =.*|\1$1 = $2|}" "$CONFIGFILE"
|
||||
else
|
||||
sed -Ei "/^\[web\]/a\\\t$1 = $2" "$CONFIGFILE"
|
||||
fi
|
||||
}
|
||||
|
||||
white_conf() {
|
||||
[ "$ssl" == "0" ] && local cert_file='' key_file=''
|
||||
|
||||
[ "$port" == "$(read_option 'default port')" ] || white_option 'default port' "$port"
|
||||
[ "$cert_file" == "$(read_option 'ssl certificate')" ] || white_option 'ssl certificate' "$cert_file"
|
||||
[ "$key_file" == "$(read_option 'ssl key')" ] || white_option 'ssl key' "$key_file"
|
||||
}
|
||||
|
||||
write_nginx() {
|
||||
local location="/etc/nginx/conf.d/netdata.locations"
|
||||
local htpasswd="/etc/nginx/conf.d/netdata.htpasswd"
|
||||
|
||||
echo "$userpw" > "$htpasswd"
|
||||
[ "$(sed -En "s|^\s*proxy_pass\s+https?://[^:]+:(\d+).*|\1|p" "$location")" == "$port" ] || sed -Ei "/proxy_pass/{s|(\bproxy_pass\b)(\s+.+)?|\1 http://localhost:$port/;|}" "$location"
|
||||
if [ "$auth" == "1" ];then
|
||||
sed -Ei "s|#(\bauth_basic_user_file\b)|\1|" "$location"
|
||||
else
|
||||
sed -Ei "s|^(\s*)(\bauth_basic_user_file\b)|\1#\2|" "$location"
|
||||
fi
|
||||
/etc/init.d/nginx reload
|
||||
}
|
||||
|
||||
netdata_instance() {
|
||||
mkdir -m 0755 -p /var/cache/netdata
|
||||
chown nobody /var/cache/netdata
|
||||
mkdir -m 0755 -p /var/lib/netdata
|
||||
chown nobody /var/lib/netdata
|
||||
mkdir -m 0755 -p /var/lib/netdata/cloud.d
|
||||
chown nobody /var/lib/netdata/cloud.d
|
||||
mkdir -m 0755 -p /var/log/netdata
|
||||
chown nobody /var/log/netdata
|
||||
procd_open_instance
|
||||
procd_set_param command $APPBINARY -D -c $CONFIGFILE
|
||||
procd_set_param file $CONFIGFILE
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_foreach get_config 'netdata'
|
||||
[ "${enabled:=0}" == "0" ] && stop_service && return 1
|
||||
white_conf
|
||||
[ "$ennginx" == "1" ] && write_nginx
|
||||
netdata_instance
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
pgrep -f $APPBINARY | xargs kill -9 >/dev/null 2>&1
|
||||
return 0
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger 'netdata'
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
restart
|
||||
}
|
||||
11
netdata/files/netdata.locations
Normal file
11
netdata/files/netdata.locations
Normal file
@ -0,0 +1,11 @@
|
||||
location /netdata/ {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://localhost:19999/;
|
||||
proxy_redirect default;
|
||||
proxy_set_header Connection "keep-alive";
|
||||
auth_basic 'Please login to continue';
|
||||
#auth_basic_user_file /etc/nginx/conf.d/netdata.htpasswd;
|
||||
}
|
||||
5
netdata/files/netdata.uci-defaults
Normal file
5
netdata/files/netdata.uci-defaults
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
sed -i "s/initTabs();$/initTabs();loadDashboard();/" /usr/share/netdata/web/index.html
|
||||
|
||||
exit 0
|
||||
20
netdata/patches/001-disable-plugins-by-default.patch
Normal file
20
netdata/patches/001-disable-plugins-by-default.patch
Normal file
@ -0,0 +1,20 @@
|
||||
From 51571c36d02c9ccdb26156bd56a2298c69bc110f Mon Sep 17 00:00:00 2001
|
||||
From: Tiago Gaspar <tiagogaspar8@gmail.com>
|
||||
Date: Thu, 7 Nov 2024 22:00:16 +0000
|
||||
Subject: [PATCH] Update python.d.conf
|
||||
|
||||
---
|
||||
src/collectors/python.d.plugin/python.d.conf | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/src/collectors/python.d.plugin/python.d.conf
|
||||
+++ b/src/collectors/python.d.plugin/python.d.conf
|
||||
@@ -7,7 +7,7 @@
|
||||
##
|
||||
|
||||
## Enable / disable the whole python.d.plugin (all its modules)
|
||||
-enabled: yes
|
||||
+enabled: no
|
||||
|
||||
## ----------------------------------------------------------------------
|
||||
## Enable / Disable python.d.plugin modules
|
||||
@ -0,0 +1,192 @@
|
||||
diff -Naur a/CMakeLists.txt b/CMakeLists.txt
|
||||
--- a/CMakeLists.txt 2024-11-08 03:07:57.000000000 +0700
|
||||
+++ b/CMakeLists.txt 2024-11-12 14:58:32.937729200 +0700
|
||||
@@ -191,6 +191,7 @@
|
||||
option(ENABLE_BUNDLED_JSONC "Force use of a vendored copy of JSON-C" False)
|
||||
option(ENABLE_BUNDLED_YAML "Force use of a vendored copy of libyaml" False)
|
||||
option(ENABLE_BUNDLED_PROTOBUF "Use a vendored copy of protobuf" False)
|
||||
+cmake_dependent_option(ENABLE_BUNDLED_ABSEIL "Use a vendored copy of Abseil" False "NOT ENABLE_BUNDLED_PROTOBUF" True)
|
||||
|
||||
# Experimental features
|
||||
option(ENABLE_WEBRTC "Enable WebRTC dashboard communications (experimental)" False)
|
||||
diff -Naur a/packaging/cmake/Modules/NetdataAbseil.cmake b/packaging/cmake/Modules/NetdataAbseil.cmake
|
||||
--- a/packaging/cmake/Modules/NetdataAbseil.cmake 1970-01-01 07:00:00.000000000 +0700
|
||||
+++ b/packaging/cmake/Modules/NetdataAbseil.cmake 2024-11-12 14:57:35.211610700 +0700
|
||||
@@ -0,0 +1,128 @@
|
||||
+# Macros and functions for handling of Abseil
|
||||
+#
|
||||
+# To use:
|
||||
+# - Include the NetdataAbseil module
|
||||
+# - Call netdata_detect_abseil() with a list of the Abseil components you need.
|
||||
+# - Call netdata_add_abseil_to_target() with the name of the target that needs to link against Abseil.
|
||||
+#
|
||||
+# Copyright (c) 2024 Netdata Inc.
|
||||
+# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
+
|
||||
+# Prepare a vendored copy of Abseil for use with Netdata
|
||||
+function(netdata_bundle_abseil)
|
||||
+ include(FetchContent)
|
||||
+ include(NetdataFetchContentExtra)
|
||||
+
|
||||
+ set(FETCHCONTENT_TRY_FIND_PACKAGE_MODE NEVER)
|
||||
+
|
||||
+ string(REPLACE "-fsanitize=address" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||
+ string(REPLACE "-fsanitize=address" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
+
|
||||
+ # ignore debhelper
|
||||
+ set(FETCHCONTENT_FULLY_DISCONNECTED Off)
|
||||
+
|
||||
+ set(ABSL_PROPAGATE_CXX_STD On)
|
||||
+ set(ABSL_ENABLE_INSTALL Off)
|
||||
+ set(BUILD_SHARED_LIBS Off)
|
||||
+
|
||||
+ message(STATUS "Preparing bundled Abseil")
|
||||
+ FetchContent_Declare(absl
|
||||
+ GIT_REPOSITORY https://github.com/abseil/abseil-cpp
|
||||
+ GIT_TAG 2f9e432cce407ce0ae50676696666f33a77d42ac # 20240116.1
|
||||
+ CMAKE_ARGS ${NETDATA_CMAKE_PROPAGATE_TOOLCHAIN_ARGS}
|
||||
+ )
|
||||
+ FetchContent_MakeAvailable_NoInstall(absl)
|
||||
+ message(STATUS "Finished preparing bundled Abseil")
|
||||
+ set(BUNDLED_ABSEIL PARENT_SCOPE)
|
||||
+endfunction()
|
||||
+
|
||||
+# Look for a system copy of Abseil, and if we can’t find it bundle a copy.
|
||||
+#
|
||||
+# _components is a list of Abseil component libraries to look for,
|
||||
+# without the `absl_` prefix. All of them must be found to use a system copy.
|
||||
+#
|
||||
+# If called multiple times with different lists of components, the
|
||||
+# end result will be as if it was called once with the union of the sets
|
||||
+# of components.
|
||||
+function(netdata_detect_abseil _components)
|
||||
+ set(_components_found "${ENABLE_BUNDLED_ABSEIL}")
|
||||
+ set(_cflags_other "${NETDATA_ABSEIL_CFLAGS_OTHER}")
|
||||
+ set(_include_dirs "${NETDATA_ABSEIL_INCLUDE_DIRS}")
|
||||
+ set(_libs "${NETDATA_ABSEIL_LIBS}")
|
||||
+ set(_bundled "${BUNDLED_ABSEIL}")
|
||||
+
|
||||
+ if(NOT BUNDLED_ABSEIL)
|
||||
+ if(NOT ENABLE_BUNDLED_ABSEIL)
|
||||
+ foreach(_c LISTS _components)
|
||||
+ set(_component_name "absl_${_c}")
|
||||
+ pkg_check_modules("${_component_name}")
|
||||
+
|
||||
+ if(${_component_name}_FOUND)
|
||||
+ list(APPEND _cflags_other "${${_component_name}_CFLAGS_OTHER}")
|
||||
+ list(APPEND _include_dirs "${${_component_name}_INCLUDE_DIRS}")
|
||||
+ list(APPEND _libs "${${_component_name}_LIBRARIES}")
|
||||
+ else()
|
||||
+ set(_components_found FALSE)
|
||||
+ break()
|
||||
+ endif()
|
||||
+ endforeach()
|
||||
+ endif()
|
||||
+
|
||||
+ if(NOT _components_found)
|
||||
+ set(_cflags_other "${NETDATA_ABSEIL_CFLAGS_OTHER}")
|
||||
+ set(_include_dirs "${NETDATA_ABSEIL_INCLUDE_DIRS}")
|
||||
+ set(_libs "${NETDATA_ABSEIL_LIBS}")
|
||||
+ set(_bundled TRUE)
|
||||
+ message(WARNING "Could not find all required Abseil components, vendoring it instead")
|
||||
+ netdata_bundle_abseil()
|
||||
+ endif()
|
||||
+ endif()
|
||||
+
|
||||
+ if(BUNDLED_ABSEIL)
|
||||
+ foreach(_c LISTS _components)
|
||||
+ set(_target "absl::${_c}")
|
||||
+
|
||||
+ if(NOT TARGET ${_target})
|
||||
+ message(FATAL_ERROR "Abseil component ${_c} was not provided by the vendored copy of Abseil.")
|
||||
+ endif()
|
||||
+
|
||||
+ get_target_property(${_c}_cflags_other ${_target} INTERFACE_COMPILE_DEFINITIONS)
|
||||
+
|
||||
+ if(NOT ${_c}_cflags_other STREQUAL ${_c}_cflags_other-NOTFOUND)
|
||||
+ list(APPEND _cflags_other "${${_c}_cflags_other}")
|
||||
+ endif()
|
||||
+
|
||||
+ get_target_property(${_c}_include_dirs ${_target} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
+
|
||||
+ if(NOT ${_c}_include_dirs STREQUAL ${_c}_include_dirs-NOTFOUND)
|
||||
+ list(APPEND _include_dirs "${${_c}_include_dirs}")
|
||||
+ endif()
|
||||
+
|
||||
+ list(APPEND _libs ${_target})
|
||||
+ endforeach()
|
||||
+ endif()
|
||||
+
|
||||
+ foreach(_var ITEMS _cflags_other _include_dirs _libs)
|
||||
+ list(REMOVE_ITEM ${_var} "")
|
||||
+ list(REMOVE_DUPLICATES ${_var})
|
||||
+ endforeach()
|
||||
+
|
||||
+ set(NETDATA_ABSEIL_CFLAGS_OTHER "${_cflags_other}" PARENT_SCOPE)
|
||||
+ set(NETDATA_ABSEIL_INCLUDE_DIRS "${_include_dirs}" PARENT_SCOPE)
|
||||
+ set(NETDATA_ABSEIL_LIBS "${_libs}" PARENT_SCOPE)
|
||||
+ set(HAVE_ABSEIL TRUE PARENT_SCOPE)
|
||||
+ set(BUNDLED_ABSEIL "${_bundled}" PARENT_SCOPE)
|
||||
+endfunction()
|
||||
+
|
||||
+# Add Abseil to a specified target
|
||||
+#
|
||||
+# The _scope argument is optional, if not specified Abseil will be added as a PRIVATE dependency.
|
||||
+function(netdata_add_abseil_to_target _target _scope)
|
||||
+ if(NOT _scope)
|
||||
+ set(_scope PRIVATE)
|
||||
+ endif()
|
||||
+
|
||||
+ target_compile_definitions(${_target} ${_scope} ${NETDATA_ABSEIL_CFLAGS_OTHER})
|
||||
+ target_include_directories(${_target} ${_scope} ${NETDATA_ABSEIL_INCLUDE_DIRS})
|
||||
+ target_link_libraries(${_target} ${_scope} ${NETDATA_ABSEIL_LIBS})
|
||||
+endfunction()
|
||||
\ No newline at end of file
|
||||
diff --git a/packaging/cmake/Modules/NetdataProtobuf.cmake b/packaging/cmake/Modules/NetdataProtobuf.cmake
|
||||
index 5375d13970aa3a..42bf42446be025 100644
|
||||
--- a/packaging/cmake/Modules/NetdataProtobuf.cmake
|
||||
+++ b/packaging/cmake/Modules/NetdataProtobuf.cmake
|
||||
@@ -24,38 +24,12 @@ function(netdata_bundle_protobuf)
|
||||
set(FETCHCONTENT_FULLY_DISCONNECTED Off)
|
||||
|
||||
if(NEED_ABSL)
|
||||
- set(ABSL_PROPAGATE_CXX_STD On)
|
||||
- set(ABSL_ENABLE_INSTALL Off)
|
||||
- set(BUILD_SHARED_LIBS Off)
|
||||
- set(ABSL_BUILD_TESTING Off)
|
||||
- set(absl_SOURCE_DIR "${CMAKE_BINARY_DIR}/_deps/absl-src")
|
||||
-
|
||||
- message(STATUS "Preparing bundled Abseil (required by bundled Protobuf)")
|
||||
- find_program(PATCH patch REQUIRED)
|
||||
- if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
|
||||
- FetchContent_Declare(absl
|
||||
- GIT_REPOSITORY https://github.com/abseil/abseil-cpp
|
||||
- GIT_TAG ${ABSL_TAG}
|
||||
- SOURCE_DIR ${absl_SOURCE_DIR}
|
||||
- PATCH_COMMAND ${CMAKE_SOURCE_DIR}/packaging/cmake/patches/apply-patches.sh
|
||||
- ${absl_SOURCE_DIR}
|
||||
- ${CMAKE_SOURCE_DIR}/packaging/cmake/patches/abseil
|
||||
- CMAKE_ARGS ${NETDATA_CMAKE_PROPAGATE_TOOLCHAIN_ARGS}
|
||||
- EXCLUDE_FROM_ALL
|
||||
- )
|
||||
- else()
|
||||
- FetchContent_Declare(absl
|
||||
- GIT_REPOSITORY https://github.com/abseil/abseil-cpp
|
||||
- GIT_TAG ${ABSL_TAG}
|
||||
- SOURCE_DIR ${absl_SOURCE_DIR}
|
||||
- PATCH_COMMAND ${CMAKE_SOURCE_DIR}/packaging/cmake/patches/apply-patches.sh
|
||||
- ${absl_SOURCE_DIR}
|
||||
- ${CMAKE_SOURCE_DIR}/packaging/cmake/patches/abseil
|
||||
- CMAKE_ARGS ${NETDATA_CMAKE_PROPAGATE_TOOLCHAIN_ARGS}
|
||||
- )
|
||||
+ if(HAVE_ABSEIL AND NOT BUNDLED_ABSEIL)
|
||||
+ message(FATAL_ERROR "Using a system copy of Abseil is not supported if vendoring Protobuf")
|
||||
endif()
|
||||
- FetchContent_MakeAvailable_NoInstall(absl)
|
||||
- message(STATUS "Finished preparing bundled Abseil")
|
||||
+
|
||||
+ netdata_bundle_abseil()
|
||||
+ set(BUNDLED_ABSEIL PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
set(protobuf_INSTALL Off)
|
||||
12
netdata/patches/003-use-cpp-17.patch
Normal file
12
netdata/patches/003-use-cpp-17.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -Naur a/CMakeLists.txt b/CMakeLists.txt
|
||||
--- a/CMakeLists.txt 2024-11-08 03:09:18.000000000 +0700
|
||||
+++ b/CMakeLists.txt 2024-11-10 05:54:38.197675500 +0700
|
||||
@@ -33,7 +33,7 @@
|
||||
set(CMAKE_INSTALL_MESSAGE LAZY)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
-set(CMAKE_CXX_STANDARD 14)
|
||||
+set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "netdata")
|
||||
|
||||
option(USE_CXX_11 "Use C++11 instead of C++14 (should only be used on legacy systems that cannot support C++14, may disable some features)" False)
|
||||
@ -0,0 +1,20 @@
|
||||
From dcefaf8fb607889d7acc60a68448bf6b040dfb87 Mon Sep 17 00:00:00 2001
|
||||
From: Tiago Gaspar <tiagogaspar8@gmail.com>
|
||||
Date: Thu, 7 Nov 2024 22:02:49 +0000
|
||||
Subject: [PATCH] Update loaders.py
|
||||
|
||||
---
|
||||
src/collectors/python.d.plugin/python_modules/bases/loaders.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/src/collectors/python.d.plugin/python_modules/bases/loaders.py
|
||||
+++ b/src/collectors/python.d.plugin/python_modules/bases/loaders.py
|
||||
@@ -4,7 +4,7 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
try:
|
||||
- from pyyaml3 import SafeLoader as YamlSafeLoader
|
||||
+ from yaml import SafeLoader as YamlSafeLoader
|
||||
except ImportError:
|
||||
from yaml import SafeLoader as YamlSafeLoader
|
||||
|
||||
17
netdata/patches/05-dashboard.patch
Normal file
17
netdata/patches/05-dashboard.patch
Normal file
@ -0,0 +1,17 @@
|
||||
--- a/packaging/cmake/Modules/NetdataDashboard.cmake
|
||||
+++ b/packaging/cmake/Modules/NetdataDashboard.cmake
|
||||
@@ -32,13 +32,8 @@ function(bundle_dashboard)
|
||||
message(STATUS "Preparing local agent dashboard code")
|
||||
|
||||
message(STATUS " Fetching ${DASHBOARD_URL}")
|
||||
- file(DOWNLOAD
|
||||
- "${DASHBOARD_URL}"
|
||||
- "${CMAKE_BINARY_DIR}/dashboard.tar.gz"
|
||||
- TIMEOUT 180
|
||||
- STATUS fetch_status)
|
||||
|
||||
- list(GET fetch_status 0 result)
|
||||
+ set(result 0)
|
||||
|
||||
if(result)
|
||||
message(FATAL_ERROR "Failed to fetch dashboard code")
|
||||
3
netdata/test.sh
Normal file
3
netdata/test.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
netdata -version 2>&1 | grep "$2"
|
||||
Loading…
Reference in New Issue
Block a user