View | Details | Raw Unified | Return to bug 97575
Collapse All | Expand All

(-)Makefile (-7 / +2 lines)
Lines 7-13 Link Here
7
7
8
PORTNAME=	fbpanel
8
PORTNAME=	fbpanel
9
PORTVERSION=	4.3
9
PORTVERSION=	4.3
10
PORTREVISION=	2
10
PORTREVISION=	3
11
CATEGORIES=	x11
11
CATEGORIES=	x11
12
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
12
MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
13
MASTER_SITE_SUBDIR=	${PORTNAME}
13
MASTER_SITE_SUBDIR=	${PORTNAME}
Lines 19-25 Link Here
19
USE_X_PREFIX=	yes
19
USE_X_PREFIX=	yes
20
USE_GNOME=	gtk20
20
USE_GNOME=	gtk20
21
HAS_CONFIGURE=	yes
21
HAS_CONFIGURE=	yes
22
CONFIGURE_ARGS=	--prefix=${PREFIX} --cpu=off
22
CONFIGURE_ARGS=	--prefix=${PREFIX}
23
CFLAGS+=	-I${WRKSRC}
23
CFLAGS+=	-I${WRKSRC}
24
USE_GMAKE=	yes
24
USE_GMAKE=	yes
25
25
Lines 29-37 Link Here
29
post-patch:
29
post-patch:
30
	@${REINPLACE_CMD} -e 's|share/man|man|g' ${WRKSRC}/man/Makefile
30
	@${REINPLACE_CMD} -e 's|share/man|man|g' ${WRKSRC}/man/Makefile
31
31
32
post-install:
33
	@${ECHO_MSG} ""
34
	@${CAT} ${PKGMESSAGE}
35
	@${ECHO_MSG} ""
36
37
.include <bsd.port.mk>
32
.include <bsd.port.mk>
(-)pkg-message (-1 lines)
Removed Link Here
1
Please note that the cpu plugin has not been built due to compatibility reasons.
(-)files/patch-Makefile (+13 lines)
Added Link Here
1
--- Makefile~	Tue May 16 19:28:38 2006
2
+++ Makefile	Tue May 16 19:14:24 2006
3
@@ -24,6 +24,10 @@
4
 -include $(DEP)
5
 endif
6
 
7
+ifeq ($(PLUGIN_CPU),on)
8
+override CFLAGS += -DPLUGIN_CPU
9
+endif
10
+
11
 TARGET := fbpanel
12
 
13
 EXTRAOBJ :=
(-)files/patch-cpu.c (+92 lines)
Added Link Here
1
--- plugins/cpu.c~	Tue May 16 19:23:18 2006
2
+++ plugins/cpu.c	Tue May 16 19:00:07 2006
3
@@ -18,14 +18,24 @@
4
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5
  * 
6
  */
7
-/*A little bug fixed by Mykola <mykola@2ka.mipt.ru>:) */
8
+/*
9
+ * A little bug fixed by Mykola <mykola@2ka.mipt.ru> :)
10
+ * FreeBSD support added by Andreas Wiese <aw@instandbesetzt.net>
11
+ */
12
 
13
 
14
 #include <string.h>
15
 #include <sys/time.h>
16
 #include <time.h>
17
-#include <sys/sysinfo.h>
18
+#ifdef __FreeBSD__
19
+# include <sys/types.h>
20
+# include <sys/resource.h>
21
+# include <sys/sysctl.h>
22
+#else
23
+# include <sys/sysinfo.h>
24
+#endif
25
 #include <stdlib.h>
26
+#include <stdio.h>
27
 
28
 #include "plugin.h"
29
 #include "panel.h"
30
@@ -60,6 +70,37 @@
31
     struct cpu_stat cpu_anterior;
32
 } cpu_t;
33
 
34
+#ifdef __FreeBSD__
35
+static void
36
+get_procstat(unsigned long *u, unsigned long *n, unsigned long *s,
37
+    unsigned long *i)
38
+{
39
+    static int mib[2] = { -1, -1 }, init = 0, j, realhz;
40
+    long ct[CPUSTATES];
41
+
42
+
43
+    if(init == 0) {
44
+	struct clockinfo ci;
45
+	j = sizeof(ci);
46
+	sysctlbyname("kern.clockrate", &ci, &j, NULL, 0);
47
+	realhz = ci.stathz ? ci.stathz : ci.hz;
48
+
49
+	j = 2;
50
+	sysctlnametomib("kern.cp_time", mib, &j);
51
+
52
+	init = 1;
53
+	j = sizeof(ct);
54
+    }
55
+
56
+    sysctl(mib, 2, ct, &j, NULL, 0);
57
+    *u = ct[CP_USER] / realhz;
58
+    *n = ct[CP_NICE] / realhz;
59
+    *s = ct[CP_SYS]  / realhz;
60
+    *i = ct[CP_IDLE] / realhz;
61
+
62
+    return;
63
+}
64
+#endif
65
 
66
 static int
67
 cpu_update(cpu_t *c)
68
@@ -67,18 +108,24 @@
69
     int cpu_u=0, cpu_s=0, cpu_n=0, cpu_i=100;
70
     unsigned int i;
71
     struct cpu_stat cpu, cpu_r;
72
+#ifndef __FreeBSD__
73
     FILE *stat;
74
+#endif
75
     float total;
76
     
77
     ENTER;
78
     if(!c->pixmap)
79
         RET(TRUE); 
80
      
81
+#ifdef __FreeBSD__
82
+    get_procstat(&cpu.u, &cpu.n, &cpu.s, &cpu.i);
83
+#else
84
     stat = fopen("/proc/stat", "r");
85
     if(!stat)
86
         RET(TRUE);
87
     fscanf(stat, "cpu %lu %lu %lu %lu", &cpu.u, &cpu.n, &cpu.s, &cpu.i);
88
     fclose(stat);
89
+#endif
90
 
91
     cpu_r.u = cpu.u - c->cpu_anterior.u;
92
     cpu_r.n = cpu.n - c->cpu_anterior.n;
(-)files/patch-plugin.c (+15 lines)
Added Link Here
1
--- plugin.c~	Tue May 16 19:22:41 2006
2
+++ plugin.c	Tue May 16 19:16:29 2006
3
@@ -98,7 +98,11 @@
4
 #ifdef STATIC_DESKNO
5
     REGISTER_PLUGIN_CLASS(deskno_plugin_class, 0);
6
 #endif
7
-    
8
+
9
+#if defined(STATIC_CPU) && defined(PLUGIN_CPU)
10
+    REGISTER_PLUGIN_CLASS(cpu_plugin_class, 0);
11
+#endif
12
+
13
     RET();
14
 }
15
 
(-)files/patch-plugin.h (+11 lines)
Added Link Here
1
--- plugin.h~	Tue May 16 19:22:49 2006
2
+++ plugin.h	Tue May 16 19:00:09 2006
3
@@ -61,7 +61,7 @@
4
 #define STATIC_SPACE
5
 #define STATIC_ICONS
6
 #define STATIC_DESKNO
7
+#define STATIC_CPU
8
 #endif
9
-
10
 
11
 #endif

Return to bug 97575