1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-24 04:33:24 +00:00

Update to version 6.1

Numerous changes since last FreeBSD port version.
See CHANGELOG from distfile for details.

PR:		152338
Submitted by:	Charlie Kester corky1951@comcast.net (maintainer)
Approved by:	itetcu
This commit is contained in:
Beech Rintoul 2010-11-22 11:35:55 +00:00
parent 7e83a8b75b
commit 4c8a065e7f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=264910
25 changed files with 870 additions and 206 deletions

View File

@ -6,25 +6,33 @@
#
PORTNAME= fbpanel
PORTVERSION= 4.12
PORTREVISION= 6
PORTVERSION= 6.1
CATEGORIES= x11
MASTER_SITES= SF
EXTRACT_SUFX= .tgz
EXTRACT_SUFX= .tbz2
MAINTAINER= corky1951@comcast.net
COMMENT= Desktop panel that includes a taskbar, pager, launchbar and more
BUILD_DEPENDS= bash:${PORTSDIR}/shells/bash
USE_XORG= x11 xmu xpm
USE_GNOME= gtk20
HAS_CONFIGURE= yes
CONFIGURE_ARGS+= --prefix=${PREFIX}
USE_GMAKE= yes
#CONFIGURE_ENV+= PREFIX=${PREFIX}
MAN1= fbpanel.1
MANCOMPRESSED= yes
MANCOMPRESSED= no
post-patch:
@${REINPLACE_CMD} -e 's|share/man|man|g' ${WRKSRC}/man/Makefile
@${REINPLACE_CMD} -e 's|/bin/bash|${LOCALBASE}/bin/bash|' ${WRKSRC}/configure
@${REINPLACE_CMD} -e 's|/bin/bash|${LOCALBASE}/bin/bash|' ${WRKSRC}/scripts/rfs-pkg-config
@${REINPLACE_CMD} -e 's|/bin/bash|${LOCALBASE}/bin/bash|' ${WRKSRC}/scripts/install.sh
@${REINPLACE_CMD} -e 's|@DATADIR@|${DATADIR}|g' ${WRKSRC}/data/man/${PORTNAME}.1.in
post-install:
@${INSTALL_MAN} ${WRKSRC}/data/man/${PORTNAME}.1 ${MANPREFIX}/man/man1
.include <bsd.port.mk>

View File

@ -1,3 +1,2 @@
MD5 (fbpanel-4.12.tgz) = 12528e7b2936a3548840fe01acaf39f5
SHA256 (fbpanel-4.12.tgz) = 9f665777df5023e3d3c33598a0f5d81d0b79314b75a128c16c07126ef0fc607f
SIZE (fbpanel-4.12.tgz) = 179131
SHA256 (fbpanel-6.1.tbz2) = e14542cc81ea06e64dd4708546f5fd3f5e01884c3e4617885c7ef22af8cf3965
SIZE (fbpanel-6.1.tbz2) = 190266

View File

@ -1,13 +0,0 @@
--- Makefile~ Tue May 16 19:28:38 2006
+++ Makefile Tue May 16 19:14:24 2006
@@ -24,6 +24,10 @@
-include $(DEP)
endif
+ifeq ($(PLUGIN_CPU),on)
+override CFLAGS += -DPLUGIN_CPU
+endif
+
TARGET := fbpanel
EXTRAOBJ :=

View File

@ -1,23 +0,0 @@
--- Makefile.common.orig Tue Apr 24 15:45:43 2007
+++ Makefile.common Thu Jun 21 06:58:50 2007
@@ -53,7 +53,7 @@
DEVEL = 0
CHATTY = $(DEVEL)
-STATIC_PLUGINS = 0
+STATIC_PLUGINS = 1
#$(warning CHATTY=$(CHATTY) DEVEL=$(DEVEL))
ifeq (1,$(CHATTY))
Q :=
@@ -89,10 +89,8 @@
CC ?= gcc
AR = ar
LIBS = $(shell pkg-config --libs glib-2.0 gmodule-2.0 gthread-2.0 gtk+-2.0 gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0) -L/usr/X11R6/lib -lXmu
-INCS2 = $(shell pkg-config --cflags glib-2.0 gmodule-2.0 gthread-2.0 gtk+-2.0 gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0)
-INCS := $(INCS2:-I%=-isystem %)
+INCS = $(shell pkg-config --cflags gtk+-2.0 gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0)
-CFLAGS ?= -O2 -Wall
ifeq (1,$(DEVEL))
override CFLAGS += -g
endif

View File

@ -1,11 +0,0 @@
--- bg.c.orig Tue Apr 24 15:45:43 2007
+++ bg.c Wed Jun 20 17:02:10 2007
@@ -237,7 +237,7 @@
win = GDK_WINDOW_XWINDOW(widget->window);
if (!XGetGeometry(bg->dpy, win, &dummy, &x, &y, &width, &height, &border,
&depth)) {
- DBG2("XGetGeometry failed\n");
+ DBG("XGetGeometry failed\n");
RET(NULL);
}
XTranslateCoordinates(bg->dpy, win, bg->xroot, 0, 0, &x, &y, &dummy);

View File

@ -0,0 +1,11 @@
--- ./configure.orig 2010-04-04 02:02:40.000000000 -0700
+++ ./configure 2010-11-17 11:11:33.000000000 -0800
@@ -324,7 +324,7 @@
add_var target "stab: configure for arch" ""
# N.B. order is important
-add_var prefix "install architecture-independent files" /usr
+add_var prefix "install architecture-independent files" '${PREFIX}'
add_var eprefix "install architecture-dependent files" '$prefix'
add_var bindir "user executables" '$eprefix/bin'
add_var sbindir "system executables" '$eprefix/sbin'

View File

@ -1,92 +0,0 @@
--- plugins/cpu.c~ Tue May 16 19:23:18 2006
+++ plugins/cpu.c Tue May 16 19:00:07 2006
@@ -18,14 +18,24 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-/*A little bug fixed by Mykola <mykola@2ka.mipt.ru>:) */
+/*
+ * A little bug fixed by Mykola <mykola@2ka.mipt.ru> :)
+ * FreeBSD support added by Andreas Wiese <aw@instandbesetzt.net>
+ */
#include <string.h>
#include <sys/time.h>
#include <time.h>
-#include <sys/sysinfo.h>
+#ifdef __FreeBSD__
+# include <sys/types.h>
+# include <sys/resource.h>
+# include <sys/sysctl.h>
+#else
+# include <sys/sysinfo.h>
+#endif
#include <stdlib.h>
+#include <stdio.h>
#include "plugin.h"
#include "panel.h"
@@ -60,6 +70,37 @@
struct cpu_stat cpu_anterior;
} cpu_t;
+#ifdef __FreeBSD__
+static void
+get_procstat(unsigned long *u, unsigned long *n, unsigned long *s,
+ unsigned long *i)
+{
+ static int mib[2] = { -1, -1 }, init = 0, j, realhz;
+ long ct[CPUSTATES];
+
+
+ if(init == 0) {
+ struct clockinfo ci;
+ j = sizeof(ci);
+ sysctlbyname("kern.clockrate", &ci, &j, NULL, 0);
+ realhz = ci.stathz ? ci.stathz : ci.hz;
+
+ j = 2;
+ sysctlnametomib("kern.cp_time", mib, &j);
+
+ init = 1;
+ j = sizeof(ct);
+ }
+
+ sysctl(mib, 2, ct, &j, NULL, 0);
+ *u = ct[CP_USER] / realhz;
+ *n = ct[CP_NICE] / realhz;
+ *s = ct[CP_SYS] / realhz;
+ *i = ct[CP_IDLE] / realhz;
+
+ return;
+}
+#endif
static int
cpu_update(cpu_t *c)
@@ -67,18 +108,24 @@
int cpu_u=0, cpu_s=0, cpu_n=0, cpu_i=100;
unsigned int i;
struct cpu_stat cpu, cpu_r;
+#ifndef __FreeBSD__
FILE *stat;
+#endif
float total;
ENTER;
if(!c->pixmap)
RET(TRUE);
+#ifdef __FreeBSD__
+ get_procstat(&cpu.u, &cpu.n, &cpu.s, &cpu.i);
+#else
stat = fopen("/proc/stat", "r");
if(!stat)
RET(TRUE);
fscanf(stat, "cpu %lu %lu %lu %lu", &cpu.u, &cpu.n, &cpu.s, &cpu.i);
fclose(stat);
+#endif
cpu_r.u = cpu.u - c->cpu_anterior.u;
cpu_r.n = cpu.n - c->cpu_anterior.n;

View File

@ -0,0 +1,81 @@
--- ./data/config/default.in.orig 2010-05-12 11:30:00.000000000 -0700
+++ ./data/config/default.in 2010-11-17 11:06:07.000000000 -0800
@@ -274,44 +274,44 @@
}
}
-Plugin {
- type = mem
- expand = false
- padding = 2
- config {
- ShowSwap = false
- }
-}
+#Plugin {
+# type = mem
+# expand = false
+# padding = 2
+# config {
+# ShowSwap = false
+# }
+#}
-Plugin {
- type = cpu
- config {
- Color = green
- }
-}
+#Plugin {
+# type = cpu
+# config {
+# Color = green
+# }
+#}
-Plugin {
- type = net
- expand = false
- padding = 0
- config {
- #interface = ppp0
- interface = eth0
- # set connection limits to make traffic graph more accurate
- TxLimit = 20
- RxLimit = 190
- TxColor = violet
- RxColor = blue
- }
-}
+#Plugin {
+# type = net
+# expand = false
+# padding = 0
+# config {
+# #interface = ppp0
+# interface = eth0
+# # set connection limits to make traffic graph more accurate
+# TxLimit = 20
+# RxLimit = 190
+# TxColor = violet
+# RxColor = blue
+# }
+#}
-Plugin {
- type = space
- config {
- size = 10
- }
-}
+#Plugin {
+# type = space
+# config {
+# size = 10
+# }
+#}
plugin {
type = volume

View File

@ -0,0 +1,49 @@
--- ./data/man/fbpanel.1.in.orig 2009-06-01 07:55:30.000000000 -0700
+++ ./data/man/fbpanel.1.in 2010-11-17 11:06:07.000000000 -0800
@@ -31,7 +31,7 @@
(see \fBOPTIONS\fR below).
Most updated info about fbpanel can be found on its home page:
-http://fbpanel.sf.net/
+http://fbpanel.sourceforge.net/
.SH OPTIONS
.TP
@@ -48,8 +48,8 @@
\-- open configuration dialog
.TP
\fB\--profile <name>\fR
-\-- use specified profile. The profile is loaded from the file ~/.fbpanel/<name>.
-If that fails, fbpanel will load @DATADIR@/<name>.
+\-- use specified profile. The profile is loaded from the file ~/.config/fbpanel/<name>.
+If that fails, fbpanel will load /usr/local/share/fbpanel/<name>.
No -p option is equivalent to -p default
.TP
\fB\-h\fR
@@ -67,21 +67,21 @@
.SH CUSTOMIZATION
To change default settings, copy profile file to your home directory
.br
- mkdir -p ~/.fbpanel
- cp @DATADIR@/default ~/.fbpanel
+ mkdir -p ~/.config/fbpanel
+ cp /usr/local/share/fbpanel/default ~/.config/fbpanel
.br
and edit it. Default profile file contains comments and explanation inside,
so it should be easy. For full list of options please visit fbpanel's home page.
.SH FILES
.TP
-@DATADIR@/
+/usr/local/share/fbpanel/
Directory with system-wide resources and default settings
.TP
-~/.fbpanel/
+~/.config/fbpanel/
Directory with the user's private profiles
.TP
-~/.fbpanel/default
+~/.config/fbpanel/default
The user's default profile.
.SH AUTHOR
fbpanel was written by Anatoly Asviyan <aanatoly@users.sf.net>.

View File

@ -0,0 +1,10 @@
--- ./exec/Makefile.in.orig 2010-03-15 02:58:51.000000000 -0700
+++ ./exec/Makefile.in 2010-11-17 11:06:07.000000000 -0800
@@ -1,6 +1,6 @@
include %%topdir%%/config.mk
-TEXT = make_profile xlogout
+TEXT = make_profile
install :
$(install) 755 $(LIBEXECDIR)/fbpanel 755 $(TEXT)

View File

@ -0,0 +1,46 @@
--- ./exec/make_profile.in.orig 2010-03-24 02:58:10.000000000 -0700
+++ ./exec/make_profile.in 2010-11-17 11:06:07.000000000 -0800
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
umask 0077
# new profile directory
@@ -6,7 +6,7 @@
# old profile directory
opdir=~/.fbpanel
# system profile directory
-spdir=%%datadir%%/fbpanel
+spdir=%%datadir%%/examples/fbpanel
# if profile name was not set, use 'default'
profile=${1:-default}
@@ -42,24 +42,24 @@
# Creates new profile using system profile as template
# $1 - system profile name
# $2 - destination profile name
-function take_system_profile ()
+take_system_profile ()
{
[ -r "$spdir/$1" ] || return 1
local browser terminal filer
- for browser in x-www-browser firefox opera; do
+ for browser in firefox firefox35 firefox36 midori opera; do
if which $browser 2> /dev/null > /dev/null; then
opt="$opt -e s/x-www-browser/$browser/"
break
fi
done
- for terminal in x-terminal urxvt gnome-terminal; do
+ for terminal in x-terminal Terminal konsole roxterm xterm; do
if which $terminal 2> /dev/null > /dev/null; then
opt="$opt -e s/x-terminal/$terminal/"
break
fi
done
- for filer in x-file-manager thunar pcmanfm rox; do
+ for filer in emelfm2 thunar pcmanfm rox konqueror; do
if which $filer 2> /dev/null > /dev/null; then
opt="$opt -e s/x-file-manager/$filer/"
break

View File

@ -1,14 +0,0 @@
--- gtkbgbox.c~ Sat Dec 18 17:46:25 2004
+++ gtkbgbox.c Sat Dec 18 17:46:40 2004
@@ -310,10 +310,9 @@
static void
gtk_bgbox_set_bg_root(GtkWidget *widget, GtkBgboxPrivate *priv)
{
- priv = GTK_BGBOX_GET_PRIVATE (widget);
GdkRectangle rect;
+ priv = GTK_BGBOX_GET_PRIVATE (widget);
- ENTER;
priv->pixmap = fb_bg_get_xroot_pix_for_win(priv->bg, widget);
if (!priv->pixmap || priv->pixmap == GDK_NO_BG) {
priv->bg_type = BG_NONE;

View File

@ -0,0 +1,11 @@
--- ./panel/misc.c.orig 2010-04-28 04:39:31.000000000 -0700
+++ ./panel/misc.c 2010-11-17 11:06:07.000000000 -0800
@@ -687,7 +687,7 @@
gdk_color_to_RRGGBB(GdkColor *color)
{
static gchar str[10]; // #RRGGBB + \0
- g_sprintf(str, "#%02x%02x%02x",
+ g_snprintf(str, sizeof(str), "#%02x%02x%02x",
color->red >> 8, color->green >> 8, color->blue >> 8);
return str;
}

View File

@ -1,16 +0,0 @@
--- plugin.c~ 2007-04-21 14:28:25.000000000 +0300
+++ plugin.c 2008-03-19 15:54:08.000000000 +0200
@@ -65 +65,5 @@
-
+
+#ifdef STATIC_TCLOCK
+ REGISTER_PLUGIN_CLASS(tclock_plugin_class, 0);
+#endif
+
@@ -101 +105,5 @@
-
+
+#if defined(STATIC_CPU) && defined(PLUGIN_CPU)
+ REGISTER_PLUGIN_CLASS(cpu_plugin_class, 0);
+#endif
+

View File

@ -1,8 +0,0 @@
--- plugin.h~ 2007-04-21 14:28:25.000000000 +0300
+++ plugin.h 2008-03-19 15:54:10.000000000 +0200
@@ -54,0 +55 @@
+#define STATIC_TCLOCK
@@ -63,0 +65 @@
+#define STATIC_CPU
@@ -66 +67,0 @@
-

View File

@ -0,0 +1,98 @@
--- ./plugins/battery/battery.c.orig 2010-05-05 04:52:59.000000000 -0700
+++ ./plugins/battery/battery.c 2010-11-17 11:06:07.000000000 -0800
@@ -1,9 +1,14 @@
#include "misc.h"
#include "../meter/meter.h"
-#include <sys/ioctl.h>
+//#include <sys/ioctl.h>
#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
+//#include <sys/stat.h>
+//#include <fcntl.h>
+
+#if defined __FreeBSD__
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#endif
//#define DEBUGPRN
#include "dbg.h"
@@ -18,7 +23,7 @@
gboolean exist;
} battery_priv;
-static gboolean battery_update_os(battery_priv *c);
+static void battery_update_os(battery_priv *c);
static gchar *batt_working[] = {
"battery_0",
@@ -53,6 +58,59 @@
#if defined __linux__
#include "os_linux.c"
+#elif defined __FreeBSD__
+static void
+battery_update_os(battery_priv * c)
+{
+ static int mib_state[4], mib_life[4], miblen_state, miblen_life, init = 0;
+ size_t len;
+ int state;
+ int life;
+
+ ENTER;
+ if (init == 0) {
+ miblen_state = 4;
+ if (sysctlnametomib("hw.acpi.battery.state", mib_state, &miblen_state) == -1) {
+ c->exist = FALSE;
+ RET();
+ }
+ miblen_life = 4;
+ if (sysctlnametomib("hw.acpi.battery.life", mib_life, &miblen_life) == -1) {
+ c->exist = FALSE;
+ RET();
+ }
+ init = 1;
+ }
+ len = sizeof(int);
+ if (sysctl(mib_state, miblen_state, &state, &len, NULL, 0) != -1) {
+ len = sizeof(int);
+ if (sysctl(mib_life, miblen_life, &life, &len, NULL, 0) != -1) {
+ switch (state) {
+ case 0:
+ case 2:/* charging */
+ c->exist = TRUE;
+ c->charging = TRUE;
+ c->level = life;
+ break;
+ case 1:/* discharging */
+ case 4:/* critical */
+ case 5:/* low */
+ c->exist = TRUE;
+ c->charging = FALSE;
+ c->level = life;
+ break;
+ case 7:/* not present */
+ default:
+ c->exist = FALSE;
+ break;
+ }
+ } else
+ c->exist = FALSE;
+ } else {
+ c->exist = FALSE;
+ }
+ RET();
+}
#else
static void
@@ -79,7 +137,7 @@
} else {
i = batt_na;
gtk_widget_set_tooltip_markup(((plugin_instance *)c)->pwid,
- "Runing on AC\nNo battery found");
+ "Running on AC\nNo battery found");
}
k->set_icons(&c->meter, i);
k->set_level(&c->meter, c->level);

View File

@ -0,0 +1,16 @@
--- ./plugins/chart/chart.c.orig 2010-05-02 02:13:47.000000000 -0700
+++ ./plugins/chart/chart.c 2010-11-17 11:06:07.000000000 -0800
@@ -24,7 +24,13 @@
#include <string.h>
#include <sys/time.h>
#include <time.h>
+#ifdef __FreeBSD__
+# include <sys/types.h>
+# include <sys/resource.h>
+# include <sys/sysctl.h>
+#else
#include <sys/sysinfo.h>
+#endif
#include <stdlib.h>
#include "plugin.h"

View File

@ -0,0 +1,107 @@
--- ./plugins/cpu/cpu.c.orig 2010-03-07 00:14:04.000000000 -0800
+++ ./plugins/cpu/cpu.c 2010-11-17 11:06:07.000000000 -0800
@@ -18,9 +18,20 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-/*A little bug fixed by Mykola <mykola@2ka.mipt.ru>:) */
+
+/*
+ * A little bug fixed by Mykola <mykola@2ka.mipt.ru>:)
+ * FreeBSD support added by Andreas Wiese <aw@instandbesetzt.net>
+ */
+#if defined __FreeBSD__
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/sysctl.h>
+#include <stdio.h>
+#endif
#include "misc.h"
#include "../chart/chart.h"
@@ -29,9 +40,16 @@
#include "dbg.h"
/* cpu.c */
+#if defined __FreeBSD__
+struct cpu_stat {
+ gulong u, n, s, i; // user, nice, system, idle
+};
+#else
struct cpu_stat {
gulong u, n, s, i, w; // user, nice, system, idle, wait
};
+#endif
+
typedef struct {
chart_priv chart;
@@ -84,6 +102,65 @@
RET(TRUE);
}
+#elif defined __FreeBSD__
+static int
+cpu_get_load(cpu_priv * c)
+{
+ static int mib[2] = {-1, -1}, init = 0, j, realhz;
+ long ct[CPUSTATES];
+
+ gfloat a , b;
+ struct cpu_stat cpu, cpu_diff;
+ float total;
+ gchar buf[40];
+
+ ENTER;
+ total = 0;
+
+ if (init == 0) {
+ struct clockinfo ci;
+ j = sizeof(ci);
+ if (sysctlbyname("kern.clockrate", &ci, &j, NULL, 0) == -1) {
+ DBG("Couldn't get kern.clockrate");
+ RET(FALSE);
+ } else
+ realhz = ci.stathz ? ci.stathz : ci.hz;
+
+ j = 2;
+ if (sysctlnametomib("kern.cp_time", mib, &j) == -1) {
+ DBG("Couldn't get mib for kern.cp_time");
+ RET(FALSE);
+ }
+ init = 1;
+ j = sizeof(ct);
+ }
+ if (sysctl(mib, 2, ct, &j, NULL, 0) == -1) {
+ DBG("Couldn't get cpu stats");
+ RET(FALSE);
+ }
+ cpu.u = ct[CP_USER] / realhz;
+ cpu.n = ct[CP_NICE] / realhz;
+ cpu.s = ct[CP_SYS] / realhz;
+ cpu.i = ct[CP_IDLE] / realhz;
+
+ cpu_diff.u = cpu.u - c->cpu_prev.u;
+ cpu_diff.n = cpu.n - c->cpu_prev.n;
+ cpu_diff.s = cpu.s - c->cpu_prev.s;
+ cpu_diff.i = cpu.i - c->cpu_prev.i;
+ c->cpu_prev = cpu;
+
+ a = cpu_diff.u + cpu_diff.n + cpu_diff.s;
+ b = a + cpu_diff.i;
+ total = b ? a / b : 1.0;
+
+end:
+ DBG("total=%f a=%f b=%f\n", total, a, b);
+ g_snprintf(buf, sizeof(buf), "<b>Cpu:</b> %d%%", (int)(total * 100));
+ gtk_widget_set_tooltip_markup(((plugin_instance *) c)->pwid, buf);
+ k->add_tick(&c->chart, &total);
+ RET(TRUE);
+
+}
#else
static int
cpu_get_load(cpu_priv *c)

View File

@ -0,0 +1,11 @@
--- ./plugins/deskno/deskno.c.orig 2010-03-02 05:26:40.000000000 -0800
+++ ./plugins/deskno/deskno.c 2010-11-17 11:06:07.000000000 -0800
@@ -57,7 +57,7 @@
ENTER;
dc->deskno = get_net_current_desktop();
- sprintf(buffer, "<b>%d</b>", dc->deskno + 1);
+ snprintf(buffer, sizeof(buffer), "<b>%d</b>", dc->deskno + 1);
gtk_label_set_markup(GTK_LABEL(dc->namew), buffer);
RET(TRUE);
}

View File

@ -0,0 +1,127 @@
--- ./plugins/mem/mem.c.orig 2010-04-28 04:39:31.000000000 -0700
+++ ./plugins/mem/mem.c 2010-11-17 11:11:10.000000000 -0800
@@ -1,3 +1,6 @@
+/* vim:set ts=4
+ * Code for FreeBSD added by Charlie Kester <corky1951@comcast.net>
+ */
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
@@ -6,6 +9,11 @@
#include <string.h>
#include <strings.h>
+#if defined __FreeBSD__
+#include <sys/sysctl.h>
+#include <sys/resource.h>
+#include <vm/vm_param.h>
+#endif
#include "panel.h"
#include "misc.h"
@@ -112,11 +120,104 @@
stats.swap.total = mt[MT_SwapTotal].val;
stats.swap.used = mt[MT_SwapTotal].val - mt[MT_SwapFree].val;
}
+#elif defined __FreeBSD__
+
+static void
+mem_usage()
+{
+ static unsigned long realmem;
+ static int mib_freecount[4], mib_cachecount[4], mib_inactivecount[4],
+ mib_swapinfo[16], init = 0, pagesize;
+ static u_int mib_free_size, mib_cache_size, mib_inactive_size,
+ mib_swapinfo_size;
+ struct xswdev xsw;
+ long scale;
+ size_t len;
+ int freecount , cachecount, inactivecount, n;
+
+
+ if (init == 0) {
+ //initialize meminfo
+ len = sizeof(unsigned long);
+ if (sysctlbyname("hw.realmem", &realmem, &len, NULL, 0) == -1) {
+ DBG("Can't get hw.realmem");
+ return;
+ }
+ len = sizeof(int);
+ if (sysctlbyname("vm.stats.vm.v_page_size", &pagesize, &len, NULL, 0) == -1) {
+ DBG("Can't get vm page size");
+ return;
+ }
+ mib_free_size = 4;
+ if (sysctlnametomib("vm.stats.vm.v_free_count", mib_freecount, &mib_free_size) == -1) {
+ DBG("Can't get mib for mem free stat");
+ return;
+ }
+ mib_cache_size = 4;
+ if (sysctlnametomib("vm.stats.vm.v_cache_count", mib_cachecount, &len) == -1) {
+ DBG("Can't get mib for cached mem stat");
+ return;
+ }
+ mib_inactive_size = 4;
+ if (sysctlnametomib("vm.stats.vm.v_inactive_count", mib_inactivecount, &mib_inactive_size) == -1) {
+ DBG("Can't get mib for mem inactive stat");
+ return;
+ }
+ //initialize swapinfo
+ mib_swapinfo_size = sizeof(mib_swapinfo) / sizeof(mib_swapinfo[0]);
+ if (sysctlnametomib("vm.swap_info", mib_swapinfo, &mib_swapinfo_size) == -1) {
+ DBG("Can't get mib for swapinfo");
+ return;
+ }
+ init = 1;
+ }
+ //get current meminfo
+ len = sizeof(int);
+ if (sysctl(mib_freecount, mib_free_size, &freecount, &len, NULL, 0) == -1) {
+ DBG("Couldn't get mem free stat");
+ return;
+ }
+ if (sysctl(mib_cachecount, mib_cache_size, &cachecount, &len, NULL, 0) == -1) {
+ DBG("Couldn't get cached mem stat");
+ return;
+ }
+ if (sysctl(mib_inactivecount, mib_inactive_size, &inactivecount, &len, NULL, 0) == -1) {
+ DBG("Couldn't get inactive mem stat");
+ return;
+ }
+ //save in kilobytes(same as /proc/meminfo)
+ stats.mem.total = realmem / 1024;
+ //For FreeBSD, there doesn't seem to be any firm consensus on the meaning of "memory used".
+ //Some utils count only wired memory as used, while others also include active and inactive memory.
+ //
+ //The 'top' utility doesn't bother to calculate "memory used" at all, but simply reports the values for
+ //active, inactive, wired, cached, and free. Unfortunately we can't follow that sensible approach here.
+ //
+ //The calculation below reflects the interpretation used by the sysinfo and freebsd_memory utils.
+ stats.mem.used = (realmem - pagesize * (freecount + cachecount + inactivecount)) / 1024;
+
+ //get swapinfo
+ scale = pagesize / 1024;
+ for (n = 0;; ++n) {
+ mib_swapinfo[mib_swapinfo_size] = n;
+ len = sizeof xsw;
+ if (sysctl(mib_swapinfo, mib_swapinfo_size + 1, &xsw, &len, 0, 0) == -1) {
+ // not necessarily an error!
+ break;
+ }
+ if (xsw.xsw_version != XSWDEV_VERSION) {
+ DBG("XSW version mismatch");
+ break;
+ }
+ stats.swap.total += xsw.xsw_nblks * scale;
+ stats.swap.used += xsw.xsw_used * scale;
+ }
+}
#else
static void
mem_usage()
{
-
+
}
#endif

View File

@ -0,0 +1,198 @@
--- ./plugins/net/net.c.orig 2010-03-07 00:14:04.000000000 -0800
+++ ./plugins/net/net.c 2010-11-17 11:06:07.000000000 -0800
@@ -19,10 +19,23 @@
*
*/
/*A little bug fixed by Mykola <mykola@2ka.mipt.ru>:) */
+/* FreeBSD code borrowed from patches to the lxpanel port */
#include "../chart/chart.h"
+
+#ifdef __FreeBSD__
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <ifaddrs.h>
+#include <net/if.h>
+#include <net/if_media.h>
+#include <net/if_var.h>
+#endif
+
#include <stdlib.h>
#include <string.h>
@@ -102,6 +115,171 @@
RET(TRUE);
}
+#elif defined __FreeBSD__
+static inline gboolean
+parse_stats(char *buf,
+ int prx_idx,
+ int ptx_idx,
+ gulong * in_packets,
+ gulong * out_packets,
+ int brx_idx,
+ int btx_idx,
+ gulong * in_bytes,
+ gulong * out_bytes)
+{
+ char *p;
+ int i;
+
+ p = strtok(buf, " \t\n");
+ for (i = 0; p; i++, p = strtok(NULL, " \t\n")) {
+ if (i == prx_idx)
+ *in_packets = g_ascii_strtoull(p, NULL, 10);
+ if (i == ptx_idx)
+ *out_packets = g_ascii_strtoull(p, NULL, 10);
+ if (i == brx_idx)
+ *in_bytes = g_ascii_strtoull(p, NULL, 10);
+ if (i == btx_idx)
+ *out_bytes = g_ascii_strtoull(p, NULL, 10);
+ }
+
+ if (i <= prx_idx || i <= ptx_idx || i <= brx_idx || i <= btx_idx)
+ return FALSE;
+
+ return TRUE;
+}
+
+static inline void
+parse_header(char *buf,
+ int *prx_idx,
+ int *ptx_idx,
+ int *brx_idx,
+ int *btx_idx)
+{
+ char *p;
+ int i;
+
+ *prx_idx = *ptx_idx = -1;
+ *brx_idx = *btx_idx = -1;
+
+ p = strtok(buf, " \n\t");
+ for (i = 0; p; i++, p = strtok(NULL, " \t\n")) {
+ if (!strcmp(p, "Ipkts")) {
+ *prx_idx = i;
+ } else if (!strcmp(p, "Ibytes")) {
+ *brx_idx = i;
+ } else if (!strcmp(p, "Opkts")) {
+ *ptx_idx = i;
+ } else if (!strcmp(p, "Obytes")) {
+ *btx_idx = i;
+ }
+ }
+}
+static int
+net_get_load(net_priv * c)
+{
+ struct net_stat net, net_diff;
+ float total[2];
+ GError *error;
+ char *command_line;
+ char **argv;
+ char *error_message = NULL;
+ int pipe_out;
+ gulong in_packets = -1;
+ gulong out_packets = -1;
+ gulong in_bytes = -1;
+ gulong out_bytes = -1;
+ char tooltip[256];
+
+ ENTER;
+ error = NULL;
+ command_line = g_strdup_printf("/usr/bin/netstat -n -I %s -b -f inet", c->iface);
+ DBG(command_line);
+ if (!g_shell_parse_argv(command_line, NULL, &argv, &error)) {
+ error_message = g_strdup_printf("Could not parse command line '%s': %s",
+ command_line,
+ error->message);
+ DBG(error_message);
+ g_error_free(error);
+ g_free(command_line);
+ RET(0);
+ }
+ g_free(command_line);
+
+ error = NULL;
+ if (g_spawn_async_with_pipes(NULL,
+ argv,
+ NULL,
+ 0,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ &pipe_out,
+ NULL,
+ &error)) {
+ GIOChannel *channel;
+ char *buf;
+ int prx_idx , ptx_idx;
+ int brx_idx , btx_idx;
+
+ channel = g_io_channel_unix_new(pipe_out);
+
+ g_io_channel_read_line(channel, &buf, NULL, NULL, NULL);
+ parse_header(buf, &prx_idx, &ptx_idx, &brx_idx, &btx_idx);
+ g_free(buf);
+
+ if (prx_idx == -1 || ptx_idx == -1 ||
+ brx_idx == -1 || btx_idx == -1) {
+ error_message = g_strdup("Could not parse 'netstat' output. Unknown format");
+ DBG(error_message);
+ goto error_shutdown;
+ }
+ g_io_channel_read_line(channel, &buf, NULL, NULL, NULL);
+
+ if (!parse_stats(buf,
+ prx_idx, ptx_idx, &in_packets, &out_packets,
+ brx_idx, btx_idx, &in_bytes, &out_bytes)) {
+ error_message = g_strdup_printf("Could not parse interface statistics from '%s'. "
+ "prx_idx = %d; ptx_idx = %d; brx_idx = %d; btx_idx = %d;",
+ buf, prx_idx, ptx_idx, brx_idx, btx_idx);
+ DBG(error_message);
+ goto error_shutdown;
+ } else if (in_packets == -1 || out_packets == -1 || in_bytes == -1 || out_bytes == -1) {
+ error_message = g_strdup_printf("Could not obtain information on interface '%s' from netstat",
+ c->iface);
+ DBG(error_message);
+ goto error_shutdown;
+ }
+ net.tx = out_bytes;
+ net.rx = in_bytes;
+
+ net_diff.tx = ((net.tx - c->net_prev.tx) >> 10) / CHECK_PERIOD;
+ net_diff.rx = ((net.rx - c->net_prev.rx) >> 10) / CHECK_PERIOD;
+
+ c->net_prev = net;
+ total[0] = (float)(net_diff.tx) / c->max;
+ total[1] = (float)(net_diff.rx) / c->max;
+ DBG("%f %ul %ul\n", total, net_diff.tx, net_diff.rx);
+ k->add_tick(&c->chart, total);
+ g_snprintf(tooltip, sizeof(tooltip), "<b>%s:</b>\nD %lu Kbs, U %lu Kbs",
+ c->iface, net_diff.rx, net_diff.tx);
+ gtk_widget_set_tooltip_markup(((plugin_instance *) c)->pwid, tooltip);
+
+error_shutdown:
+ g_free(buf);
+ g_io_channel_unref(channel);
+ close(pipe_out);
+ } else {
+ error_message = g_strdup_printf("Error running /usr/bin/netstat for '%s': %s",
+ c->iface, error->message);
+ g_error_free(error);
+ }
+
+ g_strfreev(argv);
+
+ RET(TRUE);
+
+}
#else
static int

View File

@ -0,0 +1,13 @@
--- ./plugins/volume/volume.c.orig 2010-05-02 02:13:47.000000000 -0700
+++ ./plugins/volume/volume.c 2010-11-17 11:06:07.000000000 -0800
@@ -11,6 +11,10 @@
#include <fcntl.h>
#if defined __linux__
#include <linux/soundcard.h>
+#else
+#if defined __FreeBSD__
+#include <sys/soundcard.h>
+#endif
#endif
//#define DEBUGPRN

View File

@ -0,0 +1,22 @@
--- ./scripts/endianess.sh.orig 2009-06-01 07:55:28.000000000 -0700
+++ ./scripts/endianess.sh 2010-11-17 11:06:07.000000000 -0800
@@ -1,16 +1,13 @@
-#!/bin/bash
+#!/bin/sh
# When cross compiling, you may put cross compiler directory
# in PATH before native gcc (aka spoofing), or you may set CC
# to exact name of cross compiler:
# CC=/opt/ppc_gcc/bin/gcc endianess
-# x86 and friends are considerd LITTLE endian, all others are BIG
-a=`${CC:-gcc} -v 2>&1 | grep Target`
-[ $? -ne 0 ] && exit 1
-#echo $a
+a=`sysctl -n hw.byteorder`
-if [ "${a/86/}" != "$a" ]; then
+if [ "${a}" == "1234" ]; then
echo LITTLE
else
echo BIG

View File

@ -7,6 +7,12 @@ It features:
o show desktop - button to iconify or shade all windows
o image - display an image
o clock - show the current time and/or date
o sytem tray - tray for XEMBED icons (aka docklets)
o system tray - tray for XEMBED icons (aka docklets)
o cpu monitor
o network monitor
o memory monitor
o battery monitor
o volume control
o general monitor - display output of configured command in a panel
WWW: http://fbpanel.sourceforge.net/

View File

@ -1,26 +1,54 @@
bin/fbpanel
lib/fbpanel/battery.so
lib/fbpanel/chart.so
lib/fbpanel/cpu.so
lib/fbpanel/dclock.so
lib/fbpanel/deskno.so
lib/fbpanel/deskno2.so
lib/fbpanel/genmon.so
lib/fbpanel/icons.so
lib/fbpanel/image.so
lib/fbpanel/launchbar.so
lib/fbpanel/mem.so
lib/fbpanel/menu.so
lib/fbpanel/meter.so
lib/fbpanel/net.so
lib/fbpanel/pager.so
lib/fbpanel/separator.so
lib/fbpanel/space.so
lib/fbpanel/taskbar.so
lib/fbpanel/tclock.so
lib/fbpanel/tray.so
lib/fbpanel/volume.so
lib/fbpanel/wincmd.so
libexec/fbpanel/make_profile
%%DATADIR%%/default
%%DATADIR%%/images/bottom-left.xpm
%%DATADIR%%/images/bottom-right.xpm
%%DATADIR%%/images/battery_0.png
%%DATADIR%%/images/battery_1.png
%%DATADIR%%/images/battery_2.png
%%DATADIR%%/images/battery_3.png
%%DATADIR%%/images/battery_4.png
%%DATADIR%%/images/battery_5.png
%%DATADIR%%/images/battery_6.png
%%DATADIR%%/images/battery_7.png
%%DATADIR%%/images/battery_8.png
%%DATADIR%%/images/battery_charging_0.png
%%DATADIR%%/images/battery_charging_1.png
%%DATADIR%%/images/battery_charging_2.png
%%DATADIR%%/images/battery_charging_3.png
%%DATADIR%%/images/battery_charging_4.png
%%DATADIR%%/images/battery_charging_5.png
%%DATADIR%%/images/battery_charging_6.png
%%DATADIR%%/images/battery_charging_7.png
%%DATADIR%%/images/battery_charging_8.png
%%DATADIR%%/images/battery_na.png
%%DATADIR%%/images/dclock_glyphs.png
%%DATADIR%%/images/default.xpm
%%DATADIR%%/images/gnome-applications.png
%%DATADIR%%/images/gnome-devel.svg
%%DATADIR%%/images/gnome-emacs.svg
%%DATADIR%%/images/gnome-fs-desktop.svg
%%DATADIR%%/images/gnome-fs-home.svg
%%DATADIR%%/images/gnome-globe.svg
%%DATADIR%%/images/gnome-graphics.png
%%DATADIR%%/images/gnome-joystick.svg
%%DATADIR%%/images/gnome-multimedia.svg
%%DATADIR%%/images/gnome-settings.svg
%%DATADIR%%/images/gnome-system.png
%%DATADIR%%/images/gnome-util.svg
%%DATADIR%%/images/gnome_terminal.svg
%%DATADIR%%/images/mozilla-firefox.svg
%%DATADIR%%/images/star.png
%%DATADIR%%/images/top-left.xpm
%%DATADIR%%/images/top-right.xpm
%%DATADIR%%/images/gnome-session-halt.png
%%DATADIR%%/images/gnome-session-reboot.png
%%DATADIR%%/images/logo.png
%%DATADIR%%/pager
@dirrm %%DATADIR%%/images
@dirrm %%DATADIR%%
@dirrm libexec/fbpanel
@dirrm lib/fbpanel