aboutsummaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorBoris Korzun <drtr0jan@yandex.ru>2021-10-14 11:54:57 +0000
committerRene Ladan <rene@FreeBSD.org>2021-10-14 11:58:48 +0000
commit8921a96194000bc7891ed5d04053b5d5ebaf956c (patch)
treec0c2c20fc1b264ab5377bded14d896e9665b8c83 /sysutils
parent9d1d409f4253410995aba30263251bb1e44f62dc (diff)
downloadports-8921a96194000bc7891ed5d04053b5d5ebaf956c.tar.gz
ports-8921a96194000bc7891ed5d04053b5d5ebaf956c.zip
sysutils/wmcpuload: revive and update to 1.1.1
Pass maintainership to submitter. PR: 254397
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/Makefile1
-rw-r--r--sysutils/wmcpuload/Makefile32
-rw-r--r--sysutils/wmcpuload/distinfo3
-rw-r--r--sysutils/wmcpuload/files/patch-src_cpu__freebsd.c57
-rw-r--r--sysutils/wmcpuload/pkg-descr4
5 files changed, 97 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile
index dd95b1febebe..e835799e41a5 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -1518,6 +1518,7 @@
SUBDIR += wmbluecpu
SUBDIR += wmbsdbatt
SUBDIR += wmcube
+ SUBDIR += wmcpuload
SUBDIR += wmdiskmon
SUBDIR += wmflame
SUBDIR += wmmemfree
diff --git a/sysutils/wmcpuload/Makefile b/sysutils/wmcpuload/Makefile
new file mode 100644
index 000000000000..d788e4baecc6
--- /dev/null
+++ b/sysutils/wmcpuload/Makefile
@@ -0,0 +1,32 @@
+# Created by: Soeren Boll Overgaard <boll@tolkien.dk>
+
+PORTNAME= wmcpuload
+DISTVERSION= 1.1.1
+
+CATEGORIES= sysutils windowmaker
+MASTER_SITES= https://www.dockapps.net/download/
+
+MAINTAINER= drtr0jan@yandex.ru
+COMMENT= "lcd" dockapp for windowmaker, which displays the current cpuload
+LICENSE= GPLv2
+
+USES= xorg
+USE_XORG+= x11 xext xpm
+GNU_CONFIGURE= yes
+
+PORTDOCS= ChangeLog README
+PLIST_FILES= "@(,kmem,2555) bin/wmcpuload" \
+ man/man1/wmcpuload.1.gz
+
+OPTIONS_DEFINE= DOCS
+
+post-patch:
+ @${REINPLACE_CMD} '/SETGID_FLAGS=/d' ${WRKSRC}/configure
+
+post-install:
+ @${MKDIR} ${STAGEDIR}${DOCSDIR}
+.for file in ${PORTDOCS}
+ ${INSTALL_DATA} ${WRKSRC}/${file} ${STAGEDIR}${DOCSDIR}
+.endfor
+
+.include <bsd.port.mk>
diff --git a/sysutils/wmcpuload/distinfo b/sysutils/wmcpuload/distinfo
new file mode 100644
index 000000000000..45403e11b1f2
--- /dev/null
+++ b/sysutils/wmcpuload/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1634212712
+SHA256 (wmcpuload-1.1.1.tar.gz) = 8f08b2b937db105b677a9e4df2a67259d2580071e28456c0e6cd77db15f0648c
+SIZE (wmcpuload-1.1.1.tar.gz) = 167751
diff --git a/sysutils/wmcpuload/files/patch-src_cpu__freebsd.c b/sysutils/wmcpuload/files/patch-src_cpu__freebsd.c
new file mode 100644
index 000000000000..058a807aee01
--- /dev/null
+++ b/sysutils/wmcpuload/files/patch-src_cpu__freebsd.c
@@ -0,0 +1,57 @@
+--- src/cpu_freebsd.c.orig 2016-10-20 13:55:48 UTC
++++ src/cpu_freebsd.c
+@@ -16,7 +16,8 @@
+ #include <string.h>
+ #include "cpu.h"
+
+-#include <kvm.h>
++#include <sys/sysctl.h>
++#include <sys/types.h>
+ #include <fcntl.h>
+
+ #include <sys/param.h>
+@@ -27,27 +28,21 @@
+ # include <sys/resource.h>
+ #endif /* __FreeBSD_version < 500101 */
+
+-static kvm_t *kd = NULL;
+-static struct nlist nlst[] = { {"_cp_time"}, {0} };
++static int sysctl_mib[2] = { -1, -1 };
++static size_t sysctl_len;
+
+ void
+ cpu_init(void)
+ {
+
+- kd = kvm_open(NULL, NULL, NULL, O_RDONLY, "kvm_open");
++ sysctl_len = 2;
++ sysctlnametomib("kern.cp_time", sysctl_mib, &sysctl_len);
+
+- if (kd == NULL) {
+- fprintf(stderr, "can't open kernel virtual memory");
++ if (sysctl_mib[0] == -1) {
++ fprintf(stderr, "unknown sysctl kern.cp_time");
+ exit(1);
+ }
+
+- kvm_nlist(kd, nlst);
+-
+- if (nlst[0].n_type == 0) {
+- fprintf(stderr, "error extracting symbols");
+- exit(1);
+- }
+-
+ /* drop setgid & setuid (the latter should not be there really) */
+ seteuid(getuid());
+ setegid(getgid());
+@@ -66,8 +61,8 @@ cpu_get_usage(cpu_options *opts)
+ int used, total, result;
+ unsigned long int cpu_time[CPUSTATES];
+
+- if (kvm_read(kd, nlst[0].n_value, &cpu_time, sizeof(cpu_time)) !=
+- sizeof(cpu_time))
++ sysctl_len = sizeof(cpu_time);
++ if (sysctl(sysctl_mib, 2, &cpu_time, &sysctl_len, NULL, 0) == -1)
+ return 0;
+
+ /* calculate usage */
diff --git a/sysutils/wmcpuload/pkg-descr b/sysutils/wmcpuload/pkg-descr
new file mode 100644
index 000000000000..f52440126a82
--- /dev/null
+++ b/sysutils/wmcpuload/pkg-descr
@@ -0,0 +1,4 @@
+This is a port of wmcpuload, which displays the current cpu-load in a
+simulated lcd-display, which supports background lighting.
+
+WWW: https://www.dockapps.net/wmcpuload