aboutsummaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2005-06-18 09:07:15 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2005-06-18 09:07:15 +0000
commit14b8eb3eda901d64b32160c947b2ead5f017eee3 (patch)
tree4e857b8510b3eacdd7fb3d000543bf9155ec313a /sysutils
parentc1d4ca0abd6cca9456cf0b1c09096f303adebe9a (diff)
downloadports-14b8eb3eda901d64b32160c947b2ead5f017eee3.tar.gz
ports-14b8eb3eda901d64b32160c947b2ead5f017eee3.zip
Add new port: A plugin for gkrellm2 which displays the current CPU speed.
Notes
Notes: svn path=/head/; revision=137671
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/Makefile1
-rw-r--r--sysutils/gkfreq/Makefile27
-rw-r--r--sysutils/gkfreq/distinfo2
-rw-r--r--sysutils/gkfreq/files/Makefile24
-rw-r--r--sysutils/gkfreq/files/patch-gkfreq.c63
-rw-r--r--sysutils/gkfreq/pkg-descr6
6 files changed, 123 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile
index c9e5b981416a..9ea10a579e8e 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -171,6 +171,7 @@
SUBDIR += gdesklets-sensor-psi_disk
SUBDIR += gdesklets-sensor-psi_memory
SUBDIR += gfslicer
+ SUBDIR += gkfreq
SUBDIR += gkleds2
SUBDIR += gkrellfire
SUBDIR += gkrellflynn
diff --git a/sysutils/gkfreq/Makefile b/sysutils/gkfreq/Makefile
new file mode 100644
index 000000000000..e44685ee67e2
--- /dev/null
+++ b/sysutils/gkfreq/Makefile
@@ -0,0 +1,27 @@
+# New ports collection makefile for: gkfreq
+# Date Created: Jun 18 2005
+# Whom: Hajimu UMEMOTO <ume@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= gkfreq
+PORTVERSION= 0.1.1
+#PORTREVISION= 0
+CATEGORIES= sysutils
+MASTER_SITES= http://www.peakunix.net/downloads/
+
+MAINTAINER= ume@FreeBSD.org
+COMMENT= A plugin for gkrellm2 which displays the current CPU speed
+
+BUILD_DEPENDS= ${X11BASE}/include/gkrellm2/gkrellm.h:${PORTSDIR}/sysutils/gkrellm2
+RUN_DEPENDS= gkrellm:${PORTSDIR}/sysutils/gkrellm2
+
+PLIST_FILES= libexec/gkrellm2/plugins/gkfreq.so
+
+USE_X_PREFIX= yes
+
+post-patch:
+ @${CP} ${FILESDIR}/Makefile ${WRKSRC}
+
+.include <bsd.port.mk>
diff --git a/sysutils/gkfreq/distinfo b/sysutils/gkfreq/distinfo
new file mode 100644
index 000000000000..562ec8094565
--- /dev/null
+++ b/sysutils/gkfreq/distinfo
@@ -0,0 +1,2 @@
+MD5 (gkfreq-0.1.1.tar.gz) = d4186d02a9fbc55bbf1854399e78946a
+SIZE (gkfreq-0.1.1.tar.gz) = 9089
diff --git a/sysutils/gkfreq/files/Makefile b/sysutils/gkfreq/files/Makefile
new file mode 100644
index 000000000000..016e93de9014
--- /dev/null
+++ b/sysutils/gkfreq/files/Makefile
@@ -0,0 +1,24 @@
+# $FreeBSD$
+
+PREFIX?= /usr/X11R6
+PLUGIN_DIR?= ${PREFIX}/libexec/gkrellm2/plugins
+
+GKRELLM_INCLUDE=-I${PREFIX}/include
+
+GTK_CONFIG= pkg-config gtk+-2.0
+GTK_CFLAGS= `${GTK_CONFIG} --cflags`
+
+CFLAGS+= -Wall -fPIC ${GTK_CFLAGS} ${GKRELLM_INCLUDE}
+
+INSTALL_PROGRAM?=${INSTALL} -s
+
+all: gkfreq.so
+
+gkfreq.so: gkfreq.o
+ ${CC} -Wall -shared -o gkfreq.so gkfreq.o
+
+install: gkfreq.so
+ ${INSTALL_PROGRAM} gkfreq.so ${PLUGIN_DIR}
+
+clean:
+ rm -f *.o core *.so* *.bak *~
diff --git a/sysutils/gkfreq/files/patch-gkfreq.c b/sysutils/gkfreq/files/patch-gkfreq.c
new file mode 100644
index 000000000000..c00061dcf665
--- /dev/null
+++ b/sysutils/gkfreq/files/patch-gkfreq.c
@@ -0,0 +1,63 @@
+Index: gkfreq.c
+diff -u -p gkfreq.c.orig gkfreq.c
+--- gkfreq.c.orig Wed Jun 8 01:42:00 2005
++++ gkfreq.c Fri Jun 17 01:06:15 2005
+@@ -9,6 +9,9 @@
+ #include <sys/time.h>
+ #include <string.h>
+ #include <unistd.h>
++#ifdef __FreeBSD__
++#include <sys/sysctl.h>
++#endif
+
+ #define CONFIG_NAME "gkfreq"
+ #define STYLE_NAME "gkfreq"
+@@ -17,6 +20,10 @@ static GkrellmMonitor *monitor;
+ static GkrellmPanel *panel;
+ static GkrellmDecal *decal_text1;
+ static gint style_id;
++#ifdef __FreeBSD__
++static int oid_freq[CTL_MAXNAME + 2];
++static size_t oid_freq_len = 0;
++#endif
+
+
+ __inline__ unsigned long long int rdtsc()
+@@ -31,6 +38,16 @@ __inline__ unsigned long long int rdtsc(
+ static
+ void read_MHz(char* buffer_, size_t bufsz_)
+ {
++#ifdef __FreeBSD__
++ int freq;
++ int len = sizeof(freq);
++
++ if (oid_freq_len <= 0 ||
++ sysctl(oid_freq, oid_freq_len, &freq, &len, 0, 0) < 0)
++ snprintf(buffer_, bufsz_, "n/a MHz");
++ else
++ snprintf(buffer_, bufsz_, "%d MHz", freq);
++#else
+ FILE *f;
+ if ( (f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", "r")) == NULL) {
+ /* this can happen if the the scaling is built as a module but it aint
+@@ -44,6 +61,7 @@ void read_MHz(char* buffer_, size_t bufs
+ snprintf(buffer_, bufsz_, "%d MHz", i/1000 );
+ fclose(f);
+ }
++#endif
+ }
+
+ static gint
+@@ -106,6 +124,12 @@ create_plugin(GtkWidget *vbox, gint firs
+ if (first_create)
+ g_signal_connect(G_OBJECT (panel->drawing_area), "expose_event",
+ G_CALLBACK (panel_expose_event), NULL);
++
++#ifdef __FreeBSD__
++ oid_freq_len = sizeof(oid_freq);
++ if (sysctlnametomib("dev.cpu.0.freq", oid_freq, &oid_freq_len) < 0)
++ oid_freq_len = 0;
++#endif
+ }
+
+
diff --git a/sysutils/gkfreq/pkg-descr b/sysutils/gkfreq/pkg-descr
new file mode 100644
index 000000000000..ae7a80c0ac44
--- /dev/null
+++ b/sysutils/gkfreq/pkg-descr
@@ -0,0 +1,6 @@
+GKfreq is a plugin for gkrellm2 which displays the current CPU speed
+using the "dynamic" cpufrequency scheme.
+
+WWW: http://www.peakunix.net/gkfreq/
+
+- Hajimu UMEMOTO <ume@FreeBSD.org>