summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'x11-plugins/wmcms')
-rw-r--r--x11-plugins/wmcms/Manifest1
-rw-r--r--x11-plugins/wmcms/files/wmcms-0.3.5-s4t4n.patch274
-rw-r--r--x11-plugins/wmcms/metadata.xml5
-rw-r--r--x11-plugins/wmcms/wmcms-0.3.5-r1.ebuild33
4 files changed, 313 insertions, 0 deletions
diff --git a/x11-plugins/wmcms/Manifest b/x11-plugins/wmcms/Manifest
new file mode 100644
index 000000000000..2d52b490a2e8
--- /dev/null
+++ b/x11-plugins/wmcms/Manifest
@@ -0,0 +1 @@
+DIST wmcms-0.3.5.tar.bz2 18920 SHA256 9b47672b3fa5a2474fe26dabb0e95030a4792766ce6577391ab1cd784f21d09b
diff --git a/x11-plugins/wmcms/files/wmcms-0.3.5-s4t4n.patch b/x11-plugins/wmcms/files/wmcms-0.3.5-s4t4n.patch
new file mode 100644
index 000000000000..522add1e7690
--- /dev/null
+++ b/x11-plugins/wmcms/files/wmcms-0.3.5-s4t4n.patch
@@ -0,0 +1,274 @@
+diff -Naur wmcms-0.3.5/state_linux.h wmcms-0.3.5/state_linux.h
+--- wmcms-0.3.5/state_linux.h 2001-09-24 00:56:28.000000000 +0200
++++ wmcms-0.3.5/state_linux.h 1970-01-01 01:00:00.000000000 +0100
+@@ -1,47 +0,0 @@
+-/* wmcms - WindowMaker CPU / Mem Usage Monitor DockApp
+- * state_linux.h
+- * Linux specific functions to get system usage, may someone write it to another plataform
+- * Copyright (C) 2001 Fabio Pugliese Ornellas <fabio.ornellas@poli.usp.br>
+- *
+- * This program is free software; you can redistribute it and/or modify
+- * it under the terms of the GNU General Public License as published by
+- * the Free Software Foundation; either version 2 of the License, or
+- * (at your option) any later version.
+- * This program is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- * GNU General Public License for more details.
+- *
+- * You should have received a copy of the GNU General Public License
+- * along with this program; if not, write to the Free Software
+- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+- */
+-
+-int cpu_user;
+-int cpu_nice;
+-int cpu_kernel;
+-int cpu_idle;
+-
+-int mem_total;
+-int mem_used;
+-int mem_buffers;
+-int mem_cached;
+-
+-int swap_total;
+-int swap_used;
+-
+-void get_cpuinfo ( void )
+-{
+- FILE *fp;
+- fp = fopen ( "/proc/stat", "r" );
+- fscanf ( fp, "%*s %d %d %d %d", &cpu_user, &cpu_nice, &cpu_kernel, &cpu_idle );
+- fclose ( fp );
+-}
+-
+-void get_meminfo ( void )
+-{
+- FILE *fp;
+- fp = fopen ( "/proc/meminfo", "r" );
+- fscanf ( fp, "%*s %*s %*s %*s %*s %*s %*s %d %d %*d %*d %d %d %*s %d %d", &mem_total, &mem_used, &mem_buffers, &mem_cached, &swap_total, &swap_used );
+- fclose ( fp );
+-}
+diff -Naur wmcms-0.3.5/state_linux_2.4.h wmcms-0.3.5/state_linux_2.4.h
+--- wmcms-0.3.5/state_linux_2.4.h 1970-01-01 01:00:00.000000000 +0100
++++ wmcms-0.3.5/state_linux_2.4.h 2004-07-20 22:09:11.157182296 +0200
+@@ -0,0 +1,47 @@
++/* wmcms - WindowMaker CPU / Mem Usage Monitor DockApp
++ * state_linux.h
++ * Linux specific functions to get system usage, may someone write it to another plataform
++ * Copyright (C) 2001 Fabio Pugliese Ornellas <fabio.ornellas@poli.usp.br>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++ */
++
++int cpu_user;
++int cpu_nice;
++int cpu_kernel;
++int cpu_idle;
++
++int mem_total;
++int mem_used;
++int mem_buffers;
++int mem_cached;
++
++int swap_total;
++int swap_used;
++
++void get_cpuinfo_24 ( void )
++{
++ FILE *fp;
++ fp = fopen ( "/proc/stat", "r" );
++ fscanf ( fp, "%*s %d %d %d %d", &cpu_user, &cpu_nice, &cpu_kernel, &cpu_idle );
++ fclose ( fp );
++}
++
++void get_meminfo_24 ( void )
++{
++ FILE *fp;
++ fp = fopen ( "/proc/meminfo", "r" );
++ fscanf ( fp, "%*s %*s %*s %*s %*s %*s %*s %d %d %*d %*d %d %d %*s %d %d", &mem_total, &mem_used, &mem_buffers, &mem_cached, &swap_total, &swap_used );
++ fclose ( fp );
++}
+diff -Naur wmcms-0.3.5/state_linux_2.6.h wmcms-0.3.5/state_linux_2.6.h
+--- wmcms-0.3.5/state_linux_2.6.h 1970-01-01 01:00:00.000000000 +0100
++++ wmcms-0.3.5/state_linux_2.6.h 2004-07-20 22:08:54.256751552 +0200
+@@ -0,0 +1,55 @@
++/* wmcms - WindowMaker CPU / Mem Usage Monitor DockApp
++ * state_linux.h
++ * Linux specific functions to get system usage, may someone write it to another plataform
++ * Copyright (C) 2001 Fabio Pugliese Ornellas <fabio.ornellas@poli.usp.br>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++ */
++
++int cpu_user;
++int cpu_nice;
++int cpu_kernel;
++int cpu_idle;
++
++int mem_total;
++int mem_free;
++int mem_used;
++int mem_buffers;
++int mem_cached;
++
++int swap_total;
++int swap_free;
++int swap_used;
++
++void get_cpuinfo_26 ( void )
++{
++ FILE *fp;
++ fp = fopen ( "/proc/stat", "r" );
++ fscanf ( fp, "%*s %d %d %d %d", &cpu_user, &cpu_nice, &cpu_kernel, &cpu_idle );
++ fclose ( fp );
++}
++
++void get_meminfo_26 ( void )
++{
++ FILE *fp;
++ fp = fopen ( "/proc/meminfo", "r" );
++/* The format of /proc/meminfo has changed with the 2.6 kernel; this new line will work for 2.6 -- idh
++ fscanf ( fp, "%*s %*s %*s %*s %*s %*s %*s %d %d %*d %*d %d %d %*s %d %d", &mem_total, &mem_used, &mem_buffers, &mem_cached, &swap_total, &swap_used ); */
++ fscanf ( fp, "%*s %d %*s %*s %d %*s %*s %d %*s %*s %d %*s %*s %*d %*s %*s %*d %*s %*s %*d %*s %*s %*d %*s %*s %*d %*s %*s %*d %*s %*s %*d %*s %*s %d %*s %*s %d %*s",
++ &mem_total, &mem_free, &mem_buffers, &mem_cached, &swap_total, &swap_free );
++ fclose ( fp );
++
++ mem_used = mem_total - mem_free;
++ swap_used = swap_total - swap_free;
++}
+diff -Naur wmcms-0.3.5/wmcms.c wmcms-0.3.5/wmcms.c
+--- wmcms-0.3.5/wmcms.c 2001-09-24 00:57:06.000000000 +0200
++++ wmcms-0.3.5/wmcms.c 2004-07-20 22:34:26.917751664 +0200
+@@ -19,7 +19,8 @@
+ #include <stdio.h>
+ #include <unistd.h>
+ #include <dockapp.h>
+-#include "state_linux.h"
++#include "state_linux_2.6.h"
++#include "state_linux_2.4.h"
+ #include "wmcms.xpm"
+
+ char *displayName = "";
+@@ -34,6 +35,13 @@
+ int no_nice;
+ char *exe = "";
+
++typedef enum
++{
++ IS_2_6 = 0,
++ IS_OTHER
++} kernel_versions;
++kernel_versions kernel_version;
++
+ /* command line */
+ static DAProgramOption options[] = {
+ {"-d", "--display", "display to use", DOString, False, {&displayName} },
+@@ -44,6 +52,8 @@
+ {"-p", "--program", "program to run on CPU click", DOString, False, {&exe} }
+ };
+
++kernel_versions Get_Kernel_version(void);
++
+ /* draw bars */
+ void bar ( int size, int x, int y, int barx, int bary )
+ {
+@@ -156,6 +166,9 @@
+ /* define callbacks */
+ DACallbacks callbacks = { NULL, change, NULL, NULL, NULL, NULL };
+
++ /* determine kernel version */
++ kernel_version = Get_Kernel_version();
++
+ advanced = 0;
+ up = 0;
+ no_nice = 0;
+@@ -204,14 +217,23 @@
+ XCopyArea ( DADisplay, backdrop, pixmap, gc, 3, 140, 58, 58, 0, 0);
+ DASetPixmap(pixmap);
+
+- /* initial cpu total while splash */
+- get_cpuinfo();
++ /* initial cpu total while splash */
++ if (kernel_version == IS_2_6)
++ get_cpuinfo_26();
++ else
++ get_cpuinfo_24();
++
+ old_cpu_user = cpu_user;
+ old_cpu_nice = cpu_nice;
+ old_cpu_kernel = cpu_kernel;
+ old_cpu_idle = cpu_idle;
+ usleep ( delay );
+- get_cpuinfo();
++
++ if (kernel_version == IS_2_6)
++ get_cpuinfo_26();
++ else
++ get_cpuinfo_24();
++
+ cpu_total = cpu_user - old_cpu_user + cpu_nice - old_cpu_nice + cpu_kernel - old_cpu_kernel + cpu_idle - old_cpu_idle;
+
+ /* draw background */
+@@ -230,8 +252,16 @@
+ XCopyArea ( DADisplay, backdrop, pixmap, gc, 4, 14, 56, 8, 1, 49 );
+
+ /* read values */
+- get_cpuinfo ();
+- get_meminfo ();
++ if (kernel_version == IS_2_6)
++ {
++ get_cpuinfo_26 ();
++ get_meminfo_26 ();
++ }
++ else
++ {
++ get_cpuinfo_24 ();
++ get_meminfo_24 ();
++ }
+
+ /* cpu total */
+ cpu_total = cpu_user - old_cpu_user + cpu_nice - old_cpu_nice + cpu_kernel - old_cpu_kernel + cpu_idle - old_cpu_idle;
+@@ -328,3 +358,20 @@
+ fprintf(stderr, "Congratulations, something truely awful has happened.\n");
+ return -1;
+ }
++
++kernel_versions Get_Kernel_version(void)
++{
++ FILE *fp = fopen("/proc/version", "r");
++ char buf[512];
++
++ if (!fp) return IS_OTHER;
++ if (!fgets(buf, 512, fp))
++ {
++ fclose(fp);
++ return IS_OTHER;
++ }
++ fclose(fp);
++
++ if (strstr(buf, "2.6.")) return IS_2_6;
++ return IS_OTHER;
++}
diff --git a/x11-plugins/wmcms/metadata.xml b/x11-plugins/wmcms/metadata.xml
new file mode 100644
index 000000000000..b1a9efc4f2f0
--- /dev/null
+++ b/x11-plugins/wmcms/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>desktop-dock</herd>
+</pkgmetadata>
diff --git a/x11-plugins/wmcms/wmcms-0.3.5-r1.ebuild b/x11-plugins/wmcms/wmcms-0.3.5-r1.ebuild
new file mode 100644
index 000000000000..7846476faadb
--- /dev/null
+++ b/x11-plugins/wmcms/wmcms-0.3.5-r1.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils
+
+DESCRIPTION="WindowMaker CPU and Memory Usage Monitor Dock App"
+SRC_URI="http://orbita.starmedia.com/~neofpo/files/${P}.tar.bz2"
+HOMEPAGE="http://orbita.starmedia.com/~neofpo/wmcms.html"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc ppc64 sparc x86"
+IUSE=""
+
+DEPEND="x11-libs/libdockapp"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/wmcms-0.3.5-s4t4n.patch
+
+ # Respect LDFLAGS, see bug #335031
+ sed -i 's/ -o wmcms/ ${LDFLAGS} -o wmcms/' "Makefile"
+}
+
+src_compile() {
+ emake CFLAGS="${CFLAGS}" || die "emake failed."
+}
+
+src_install() {
+ dobin wmcms || die "dobin failed."
+}