diff options
Diffstat (limited to 'x11-plugins/wmcms')
-rw-r--r-- | x11-plugins/wmcms/ChangeLog | 8 | ||||
-rw-r--r-- | x11-plugins/wmcms/Manifest | 3 | ||||
-rw-r--r-- | x11-plugins/wmcms/files/digest-wmcms-0.3.5-r1 | 1 | ||||
-rw-r--r-- | x11-plugins/wmcms/files/wmcms-0.3.5-s4t4n.patch | 274 | ||||
-rw-r--r-- | x11-plugins/wmcms/wmcms-0.3.5-r1.ebuild | 34 |
5 files changed, 319 insertions, 1 deletions
diff --git a/x11-plugins/wmcms/ChangeLog b/x11-plugins/wmcms/ChangeLog index 09b5e220c065..61aa391f5f5e 100644 --- a/x11-plugins/wmcms/ChangeLog +++ b/x11-plugins/wmcms/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for x11-plugins/wmcms # Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/x11-plugins/wmcms/ChangeLog,v 1.6 2004/06/24 23:07:00 agriffis Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-plugins/wmcms/ChangeLog,v 1.7 2004/07/20 20:56:18 s4t4n Exp $ + +*wmcms-0.3.5-r1 (20 Jul 2004) + + 20 Jul 2004; Michele Noberasco <s4t4n@gentoo.org> : wmcms-0.3.5-r1.ebuild: + Revision bump, added patch to make it work seamlessly with both 2.4 and + 2.6 kernels... Closes #40640. 06 Dec 2002; Rodney Rees <manson@gentoo.org> : changed sparc ~sparc keywords diff --git a/x11-plugins/wmcms/Manifest b/x11-plugins/wmcms/Manifest index 159ef5805f4e..7c1118fb5d6c 100644 --- a/x11-plugins/wmcms/Manifest +++ b/x11-plugins/wmcms/Manifest @@ -1,4 +1,7 @@ MD5 ffaab438b8dc05e0680c006e572d9c78 wmcms-0.3.5.ebuild 571 MD5 4a5892e247758e80a688c5a29a49c4e3 ChangeLog 963 MD5 62ba71d3b2fa785a4cbd5d47fdbd0eb6 metadata.xml 165 +MD5 de0648e26fb8f190a1b39ee6ae0acb99 wmcms-0.3.5-r1.ebuild 728 +MD5 89008bcc6679be353c11621157845cf5 files/wmcms-0.3.5-s4t4n.patch 8562 +MD5 3d836ad986971d2cfdf3b9af4d1867f1 files/digest-wmcms-0.3.5-r1 63 MD5 3d836ad986971d2cfdf3b9af4d1867f1 files/digest-wmcms-0.3.5 63 diff --git a/x11-plugins/wmcms/files/digest-wmcms-0.3.5-r1 b/x11-plugins/wmcms/files/digest-wmcms-0.3.5-r1 new file mode 100644 index 000000000000..96367ea8b7c2 --- /dev/null +++ b/x11-plugins/wmcms/files/digest-wmcms-0.3.5-r1 @@ -0,0 +1 @@ +MD5 8f6471bc10ed767bdd4fc3320cd3136c wmcms-0.3.5.tar.bz2 18920 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/wmcms-0.3.5-r1.ebuild b/x11-plugins/wmcms/wmcms-0.3.5-r1.ebuild new file mode 100644 index 000000000000..8dc78bebbea9 --- /dev/null +++ b/x11-plugins/wmcms/wmcms-0.3.5-r1.ebuild @@ -0,0 +1,34 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/x11-plugins/wmcms/wmcms-0.3.5-r1.ebuild,v 1.1 2004/07/20 20:56:18 s4t4n Exp $ + +inherit eutils + +IUSE="" + +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" + +DEPEND="virtual/x11 + >=x11-libs/libdockapp-0.4.0-r1" + +SLOT="0" +LICENSE="GPL-2" +KEYWORDS="~x86 ~sparc ~amd64 ~ppc" + +src_unpack() +{ + unpack ${A} + epatch ${FILESDIR}/wmcms-0.3.5-s4t4n.patch +} + +src_compile() +{ + emake CFLAGS="${CFLAGS}" || die "Compilation failed." +} + +src_install () +{ + dobin wmcms +} |