aboutsummaryrefslogtreecommitdiffstats
path: root/x11/gnomeapplets2
diff options
context:
space:
mode:
authormarcus <marcus@FreeBSD.org>2005-03-15 12:46:31 +0800
committermarcus <marcus@FreeBSD.org>2005-03-15 12:46:31 +0800
commitcfe9dc8e74626cf3c47d9c720b582bc4a7125293 (patch)
treebb9bad4a8f9682459251d88856a00663c85763da /x11/gnomeapplets2
parent7fc8f43b3ce97437793c3335ebcbf469a5c57443 (diff)
downloadfreebsd-ports-gnome-cfe9dc8e74626cf3c47d9c720b582bc4a7125293.tar.gz
freebsd-ports-gnome-cfe9dc8e74626cf3c47d9c720b582bc4a7125293.tar.zst
freebsd-ports-gnome-cfe9dc8e74626cf3c47d9c720b582bc4a7125293.zip
Add battstat (ACPI only) support for amd64.
Submitted by: Jung-uk Kim <jkim@niksun.com>
Diffstat (limited to 'x11/gnomeapplets2')
-rw-r--r--x11/gnomeapplets2/Makefile5
-rw-r--r--x11/gnomeapplets2/files/patch-aa2
-rw-r--r--x11/gnomeapplets2/files/patch-battstat-acpi69
3 files changed, 61 insertions, 15 deletions
diff --git a/x11/gnomeapplets2/Makefile b/x11/gnomeapplets2/Makefile
index d2ee9028fc0f..01fcedea4a8f 100644
--- a/x11/gnomeapplets2/Makefile
+++ b/x11/gnomeapplets2/Makefile
@@ -7,6 +7,7 @@
PORTNAME= gnomeapplets2
PORTVERSION= 2.10.0
+PORTREVISION= 1
CATEGORIES= x11 gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= sources/gnome-applets/2.10
@@ -45,7 +46,7 @@ FREEBSD_SYS?= /usr/src/sys
.include <bsd.port.pre.mk>
-.if ${ARCH} != "i386"
+.if ${ARCH} != "i386" && ${ARCH} != "amd64"
CONFIGURE_ENV+= CFLAGS="${CFLAGS} -fPIC"
PLIST_SUB= BATTERY="@comment "
.else
@@ -53,6 +54,7 @@ GCONF_SCHEMAS+= battstat.schemas
PLIST_SUB= BATTERY=""
.if ${OSVERSION} < 600019
+.if ${OSVERSION} < 503105 || ${OSVERSION} >= 600000
pre-everything::
@${ECHO_MSG} ""
@${ECHO_MSG} " W A R N I N G"
@@ -66,6 +68,7 @@ pre-everything::
@${ECHO_MSG} ""
.endif
.endif
+.endif
.if ${ARCH} != "i386" && ${ARCH} != "amd64"
PLIST_SUB+= CPUFREQ="@comment "
diff --git a/x11/gnomeapplets2/files/patch-aa b/x11/gnomeapplets2/files/patch-aa
index 2a74a1ed8f2b..9e8038833e85 100644
--- a/x11/gnomeapplets2/files/patch-aa
+++ b/x11/gnomeapplets2/files/patch-aa
@@ -32,7 +32,7 @@
;;
# list of supported OS cores that do not use libapm
- *-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
-+ i386-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
++ i386-*-freebsd*|amd64-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
+ if [ -n "${FREEBSD_SYS}" ]; then
+ ACPIINC="-I${FREEBSD_SYS}"
+ else
diff --git a/x11/gnomeapplets2/files/patch-battstat-acpi b/x11/gnomeapplets2/files/patch-battstat-acpi
index ebaa93f7e670..f34bd3cadc16 100644
--- a/x11/gnomeapplets2/files/patch-battstat-acpi
+++ b/x11/gnomeapplets2/files/patch-battstat-acpi
@@ -1,6 +1,6 @@
--- battstat/acpi-freebsd.h.orig Mon Sep 27 18:39:30 2004
+++ battstat/acpi-freebsd.h Mon Sep 27 18:39:30 2004
-@@ -0,0 +1,45 @@
+@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2004 by Joe Marcus Clarke <marcus@FreeBSD.org>
+ *
@@ -32,6 +32,17 @@
+#define ACPI_LIFE "hw.acpi.battery.life"
+#define ACPI_STATE "hw.acpi.battery.state"
+
++/* XXX: AMD64 does not have machine/apm_bios.h. */
++#if !defined(__i386__)
++struct apm_info {
++ guint ai_acline;
++ guint ai_batt_stat;
++ guint ai_batt_life;
++ int ai_batt_time;
++ guint ai_status;
++};
++#endif
++
+struct acpi_info {
+ gboolean ac_online;
+ int acpifd;
@@ -106,11 +117,17 @@
};
--- battstat/power-management.c.orig Thu Jan 13 23:06:40 2005
-+++ battstat/power-management.c Wed Feb 16 02:58:10 2005
-@@ -76,6 +76,14 @@
- #ifdef __FreeBSD__
++++ battstat/power-management.c Mon Mar 14 19:53:13 2005
+@@ -73,9 +73,18 @@
+ * the problem might be. This error message is not to be freed.
+ */
+-#ifdef __FreeBSD__
+-
++#if defined(__FreeBSD__)
++#if defined(__i386__)
#include <machine/apm_bios.h>
++#endif
+#include "acpi-freebsd.h"
+
+struct acpi_info acpiinfo;
@@ -122,7 +139,7 @@
#define APMDEVICE "/dev/apm"
-@@ -86,32 +94,48 @@
+@@ -86,32 +95,51 @@
FreeBSD. Each time this functions is called (once every second)
the APM device is opened, read from and then closed.
*/
@@ -145,6 +162,7 @@
+ acpi_count--;
}
+ else {
++#if defined(__i386__)
+ fd = open(APMDEVICE, O_RDONLY);
+ if (fd == -1) {
+ return ERR_OPEN_APMDEV;
@@ -157,14 +175,16 @@
- close(fd);
+ close(fd);
-
-- if(apminfo.ai_status == 0)
-- return ERR_APM_E;
++
+ if(apminfo.ai_status == 0)
+ return ERR_APM_E;
-+
++#else
++ return ERR_OPEN_APMDEV;
++#endif
+ }
-+
+
+- if(apminfo.ai_status == 0)
+- return ERR_APM_E;
+ if (using_acpi) {
+ acpi_process_event(&acpiinfo);
+ acpi_freebsd_read(&apminfo, &acpiinfo);
@@ -183,7 +203,7 @@
return NULL;
}
-@@ -339,6 +363,13 @@
+@@ -339,6 +367,13 @@
G_IO_IN | G_IO_ERR | G_IO_HUP,
acpi_callback, NULL);
}
@@ -197,7 +217,7 @@
#endif
pm_initialised = 1;
-@@ -360,6 +391,10 @@
+@@ -360,6 +395,10 @@
g_source_remove(acpiwatch);
acpiwatch = 0;
acpi_linux_cleanup(&acpiinfo);
@@ -208,9 +228,30 @@
}
#endif
+--- battstat/properties.c.orig Fri Jan 14 23:38:18 2005
++++ battstat/properties.c Mon Mar 14 19:49:26 2005
+@@ -27,7 +27,7 @@
+
+ #include <stdio.h>
+
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) && defined(__i386__)
+ #include <machine/apm_bios.h>
+ #elif defined(__NetBSD__) || defined(__OpenBSD__)
+ #include <sys/param.h>
+@@ -61,6 +61,9 @@
+ #include <panel-applet-gconf.h>
+ /*#include <status-docklet.h>*/
+
++#if defined(__FreeBSD__) && !defined(__i386__)
++#include "acpi-freebsd.h"
++#endif
+ #include "battstat.h"
+
+ #ifndef gettext_noop
--- battstat/acpi-freebsd.c.orig Mon Feb 28 01:41:08 2005
+++ battstat/acpi-freebsd.c Mon Feb 28 03:00:11 2005
-@@ -0,0 +1,206 @@
+@@ -0,0 +1,208 @@
+/* battstat A GNOME battery meter for laptops.
+ * Copyright (C) 2000 by Jörgen Pehrson <jp@spektr.eu.org>
+ *
@@ -246,7 +287,9 @@
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <sys/ioctl.h>
++#if defined(__i386__)
+#include <machine/apm_bios.h>
++#endif
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>