Subject: pkg/37442: xbattbar does not work on amd64
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <jmcneill@invisible.ca>
List: pkgsrc-bugs
Date: 11/28/2007 02:05:00
>Number: 37442
>Category: pkg
>Synopsis: xbattbar does not work on amd64
>Confidential: no
>Severity: non-critical
>Priority: high
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Nov 28 02:05:00 +0000 2007
>Originator: Jared D. McNeill
>Release: NetBSD 4.99.38
>Organization:
>Environment:
System: NetBSD black.invisible.ca 4.99.38 NetBSD 4.99.38 (GENERIC) #31: Tue Nov 27 20:19:34 EST 2007 jmcneill@black.invisible.ca:/export/home/jmcneill/branches/jmcneill-pm/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
The xbattbar package contains support for fallback to envsys mode
if it cannot open /dev/apm, but still requires apmvar.h to build.
This header is not available on amd64.
>How-To-Repeat:
Try to build sysutils/xbattbar from pkgsrc.
>Fix:
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/xbattbar/Makefile,v
retrieving revision 1.30
diff -u -r1.30 Makefile
--- Makefile 25 Jul 2007 15:09:32 -0000 1.30
+++ Makefile 28 Nov 2007 02:00:14 -0000
@@ -15,7 +15,7 @@
USE_IMAKE= yes
.if !exists(/usr/include/machine/apmvar.h)
-PKG_SKIP_REASON+= "APM is not available for ${MACHINE_PLATFORM}"
+CPPFLAGS+= -D_NO_APM
.endif
.include "../../x11/libX11/buildlink3.mk"
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/xbattbar/distinfo,v
retrieving revision 1.12
diff -u -r1.12 distinfo
--- distinfo 25 Jul 2007 15:09:32 -0000 1.12
+++ distinfo 28 Nov 2007 02:00:14 -0000
@@ -4,5 +4,5 @@
RMD160 (xbattbar_1.4.2.tar.gz) = f28a273a1865a0919e32144bbb5b16b3c0340061
Size (xbattbar_1.4.2.tar.gz) = 14079 bytes
SHA1 (patch-aa) = 3bd4b688ccaeebe766335245c1a8c5dde52768c2
-SHA1 (patch-ab) = b3115d01555e62c0229350213b003d9f2d554968
+SHA1 (patch-ab) = 6700060b89074e62a99901fcc68798cfd1f3dc76
SHA1 (patch-ac) = 507cdf9b4e79dc577d020963142e262d04536527
Index: patches/patch-ab
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/xbattbar/patches/patch-ab,v
retrieving revision 1.7
diff -u -r1.7 patch-ab
--- patches/patch-ab 25 Jul 2007 15:09:32 -0000 1.7
+++ patches/patch-ab 28 Nov 2007 02:00:14 -0000
@@ -1,7 +1,5 @@
-$NetBSD: patch-ab,v 1.7 2007/07/25 15:09:32 xtraeme Exp $
-
---- xbattbar.c.orig 2001-02-02 06:25:29.000000000 +0100
-+++ xbattbar.c 2007-07-25 17:03:43.000000000 +0200
+--- xbattbar.c.orig 2001-02-02 00:25:29.000000000 -0500
++++ xbattbar.c 2007-11-27 20:56:25.000000000 -0500
@@ -27,6 +27,14 @@
#include <sys/types.h>
@@ -17,7 +15,18 @@
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
-@@ -583,27 +591,161 @@
+@@ -577,33 +585,177 @@
+
+ #ifdef __NetBSD__
+
++#ifndef _NO_APM
+ #include <machine/apmvar.h>
++#else
++#define APM_AC_OFF 0x00
++#define APM_AC_ON 0x01
++#endif
+
+ #define _PATH_APM_SOCKET "/var/run/apmdev"
#define _PATH_APM_CTLDEV "/dev/apmctl"
#define _PATH_APM_NORMAL "/dev/apm"
@@ -88,7 +97,9 @@
void battery_check(void)
{
int fd, r, p;
++#ifndef _NO_APM
struct apm_power_info info;
++#endif
+ int acpi;
+ size_t ns;
+ size_t cc;
@@ -128,15 +139,17 @@
+ }
+
+ fillsensors(fd, etds, ebis, ns);
-
++
+#endif
++#ifndef _NO_APM
+ } else {
-+
+
+ memset(&info, 0, sizeof(info));
if (ioctl(fd, APM_IOC_GETPOWER, &info) != 0) {
fprintf(stderr, "xbattbar: ioctl APM_IOC_GETPOWER failed\n");
exit(1);
}
++#endif
+ }
close(fd);
@@ -177,15 +190,17 @@
+ }
+ r = (rtot * 100.0) / maxtot;
+#endif
++#ifndef _NO_APM
+ } else {
+ /* get current remain */
if (info.battery_life > 100) {
/* some APM BIOSes return values slightly > 100 */
r = 100;
-@@ -617,6 +759,7 @@
+@@ -617,6 +769,8 @@
} else {
p = APM_AC_OFF;
}
++#endif
+ }
if (first || ac_line != p || battery_level != r) {
>Unformatted: