Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Jan 2013 14:51:52 +0000 (UTC)
From:      Lars Engels <lme@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r310690 - in head/x11/tint: . files
Message-ID:  <201301201451.r0KEpq2f005686@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: lme
Date: Sun Jan 20 14:51:52 2013
New Revision: 310690
URL: http://svnweb.freebsd.org/changeset/ports/310690

Log:
  - Add a patch to enable battery support [1]
  - Don't depend depend on a specific library version
  - Quiet install
  - Bump PORTREVISION
  - Pass maintainership to submitter
  
  PR:		ports/175332 [1]
  Submitted by:	Yamagi Burmeister <yamagi@yamagi.org>

Added:
  head/x11/tint/files/
  head/x11/tint/files/patch-src-battery-battery.c   (contents, props changed)
Modified:
  head/x11/tint/Makefile   (contents, props changed)

Modified: head/x11/tint/Makefile
==============================================================================
--- head/x11/tint/Makefile	Sun Jan 20 13:58:51 2013	(r310689)
+++ head/x11/tint/Makefile	Sun Jan 20 14:51:52 2013	(r310690)
@@ -2,16 +2,16 @@
 
 PORTNAME=	tint2
 PORTVERSION=	0.11
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	x11
 MASTER_SITES=	${MASTER_SITE_GOOGLE_CODE}
 
-MAINTAINER=	ports@FreeBSD.org
+MAINTAINER=	yamagi@yamagi.org
 COMMENT=	Lightweight freedesktop-compliant panel/taskbar/systray/clock
 
-MAKE_JOBS_SAFE=	yes
+LIB_DEPENDS=	cairo:${PORTSDIR}/graphics/cairo
 
-LIB_DEPENDS=	cairo.2:${PORTSDIR}/graphics/cairo
+MAKE_JOBS_SAFE=	yes
 
 PROJECTHOST=	tint2
 USE_BZIP2=	yes
@@ -20,7 +20,7 @@ USE_GNOME=	pango glib20
 USE_XORG=	xinerama xrandr xdamage xcomposite
 USE_EFL=	imlib2
 
-CMAKE_ARGS=	-DENABLE_BATTERY:BOOL=OFF -DMANDIR:PATH=man
+CMAKE_ARGS=	-DENABLE_BATTERY:BOOL=ON -DMANDIR:PATH=man
 
 PLIST_FILES=	bin/tint2 \
 		share/tint2/default_icon.png
@@ -57,32 +57,32 @@ post-patch:
 .endif
 
 do-install:
-	${INSTALL_PROGRAM} ${WRKSRC}/tint2 ${PREFIX}/bin
-	${MKDIR} ${PREFIX}/share/tint2
-	${INSTALL_DATA} ${WRKSRC}/default_icon.png ${PREFIX}/share/tint2
-	${INSTALL_MAN} ${WRKSRC}/doc/tint2.1 ${MANPREFIX}/man/man1
+	@${INSTALL_PROGRAM} ${WRKSRC}/tint2 ${PREFIX}/bin
+	@${MKDIR} ${PREFIX}/share/tint2
+	@${INSTALL_DATA} ${WRKSRC}/default_icon.png ${PREFIX}/share/tint2
+	@${INSTALL_MAN} ${WRKSRC}/doc/tint2.1 ${MANPREFIX}/man/man1
 .if ${PORT_OPTIONS:MPYCONF}
-	${INSTALL_PROGRAM} ${PYCONF_SRC}/tint2conf ${PREFIX}/bin
-	${INSTALL_SCRIPT} ${PYCONF_SRC}/tintwizard.py ${PREFIX}/bin
-	${MKDIR} ${PREFIX}/share/applications
-	${INSTALL_DATA} ${PYCONF_SRC}/tint2conf.desktop ${PREFIX}/share/applications
-	${INSTALL_DATA} ${PYCONF_SRC}/tint2conf.png ${PREFIX}/share/pixmaps
-	${INSTALL_DATA} ${PYCONF_SRC}/tint2conf.svg ${PREFIX}/share/pixmaps
+	@${INSTALL_PROGRAM} ${PYCONF_SRC}/tint2conf ${PREFIX}/bin
+	@${INSTALL_SCRIPT} ${PYCONF_SRC}/tintwizard.py ${PREFIX}/bin
+	@${MKDIR} ${PREFIX}/share/applications
+	@${INSTALL_DATA} ${PYCONF_SRC}/tint2conf.desktop ${PREFIX}/share/applications
+	@${INSTALL_DATA} ${PYCONF_SRC}/tint2conf.png ${PREFIX}/share/pixmaps
+	@${INSTALL_DATA} ${PYCONF_SRC}/tint2conf.svg ${PREFIX}/share/pixmaps
 .endif
 .if ${PORT_OPTIONS:MDOCS}
-	${MKDIR} ${DOCSDIR}
-.for file in ${PORTDOCS}
-	${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR}
+	@${MKDIR} ${DOCSDIR}
+.for f in ${PORTDOCS}
+	@${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
 .endfor
 .endif
 .if ${PORT_OPTIONS:MEXAMPLES}
-	${MKDIR} ${EXAMPLESDIR}
-	@for file in ${RCS}; do \
-	${INSTALL_DATA} ${WRKSRC}/sample/$${file} ${EXAMPLESDIR}; \
+	@${MKDIR} ${EXAMPLESDIR}
+	@for f in ${RCS}; do \
+	${INSTALL_DATA} ${WRKSRC}/sample/$${f} ${EXAMPLESDIR}; \
 	done
 RCS=	icon_and_text_1.tint2rc icon_and_text_2.tint2rc icon_and_text_3.tint2rc icon_and_text_4.tint2rc icon_only_1.tint2rc icon_only_2.tint2rc icon_only_3.tint2rc icon_only_4.tint2rc icon_only_6.tint2rc icon_only_7.tint2rc text_only_1.tint2rc text_only_2.tint2rc text_only_3.tint2rc text_only_4.tint2rc text_only_5.tint2rc text_only_6.tint2rc tint2rc
-.for file in ${RCS}
-PLIST_FILES+=	${EXAMPLESDIR_REL}/${file}
+.for f in ${RCS}
+PLIST_FILES+=	${EXAMPLESDIR_REL}/${f}
 .endfor
 PLIST_DIRS+=	${EXAMPLESDIR_REL}
 .endif

Added: head/x11/tint/files/patch-src-battery-battery.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/x11/tint/files/patch-src-battery-battery.c	Sun Jan 20 14:51:52 2013	(r310690)
@@ -0,0 +1,144 @@
+Index: src/battery/battery.c
+===================================================================
+--- src/battery/battery.c	(Revision 514)
++++ src/battery/battery.c	(Revision 515)
+@@ -24,13 +24,18 @@
+ #include <cairo-xlib.h>
+ #include <pango/pangocairo.h>
+ 
+-#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
++#if defined(__OpenBSD__) || defined(__NetBSD__)
+ #include <machine/apmvar.h>
+ #include <err.h>
+ #include <sys/ioctl.h>
+ #include <unistd.h>
+ #endif
+ 
++#if defined(__FreeBSD__)
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#endif
++
+ #include "window.h"
+ #include "server.h"
+ #include "area.h"
+@@ -59,11 +64,10 @@
+ char *path_current_now;
+ char *path_status;
+ 
+-#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
++#if defined(__OpenBSD__) || defined(__NetBSD__)
+ int apm_fd;
+ #endif
+ 
+-
+ void update_batterys(void* arg)
+ {
+ 	int i;
+@@ -103,7 +107,7 @@
+ 	path_energy_full = 0;
+ 	path_current_now = 0;
+ 	path_status = 0;
+-#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
++#if defined(__OpenBSD__) || defined(__NetBSD__)
+ 	apm_fd = -1;
+ #endif
+ }
+@@ -118,7 +122,7 @@
+ 	if (path_status) g_free(path_status);
+ 	if (battery_low_cmd) g_free(battery_low_cmd);
+ 
+-#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
++#if defined(__OpenBSD__) || defined(__NetBSD__)
+ 	if ((apm_fd != -1) && (close(apm_fd) == -1))
+ 		warn("cannot close /dev/apm");
+ #endif
+@@ -129,7 +133,7 @@
+ {
+ 	if (!battery_enabled) return;
+ 
+-#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
++#if defined(__OpenBSD__) || defined(__NetBSD__)
+ 	apm_fd = open("/dev/apm", O_RDONLY);
+ 	if (apm_fd < 0) {
+ 		warn("init_battery: failed to open /dev/apm.");
+@@ -137,7 +141,7 @@
+ 		return;
+ 	}
+ 
+-#else
++#elif !defined(__FreeBSD__)
+ 	// check battery
+ 	GDir *directory = 0;
+ 	GError *error = NULL;
+@@ -258,17 +262,21 @@
+ 
+ 
+ void update_battery() {
+-#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
++#if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__)
+ 	// unused on OpenBSD, silence compiler warnings
+ 	FILE *fp;
+ 	char tmp[25];
+ 	int64_t current_now = 0;
+ #endif
++#if defined(__FreeBSD__)
++	int sysctl_out =  0;
++	size_t len = 0;
++#endif
+ 	int64_t energy_now = 0, energy_full = 0;
+ 	int seconds = 0;
+ 	int8_t new_percentage = 0;
+ 
+-#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
++#if defined(__OpenBSD__) || defined(__NetBSD__)
+ 	struct apm_power_info info;
+ 	if (ioctl(apm_fd, APM_IOC_GETPOWER, &(info)) < 0)
+ 		warn("power update: APM_IOC_GETPOWER");
+@@ -298,6 +306,45 @@
+ 
+ 	new_percentage = info.battery_life;
+ 
++#elif defined(__FreeBSD__)
++	len = sizeof(sysctl_out);
++
++	if (sysctlbyname("hw.acpi.battery.state", &sysctl_out, &len, NULL, 0) != 0)
++		fprintf(stderr, "power update: no such sysctl");
++
++	// attemp to map the battery state to linux
++	battery_state.state = BATTERY_UNKNOWN;
++
++	switch(sysctl_out) {
++		case 1:
++			battery_state.state = BATTERY_DISCHARGING;
++			break;
++		case 2:
++			battery_state.state = BATTERY_CHARGING;
++			break;
++		default:
++			battery_state.state = BATTERY_FULL;
++			break;
++	}
++
++	// no mapping for freebsd
++	energy_full = 0;
++	energy_now = 0;
++
++	if (sysctlbyname("hw.acpi.battery.time", &sysctl_out, &len, NULL, 0) != 0)
++		seconds = -1;
++	else
++		seconds = sysctl_out * 60;
++
++	// charging or error
++	if (seconds < 0)
++		seconds = 0;
++
++	if (sysctlbyname("hw.acpi.battery.life", &sysctl_out, &len, NULL, 0) != 0)
++		new_percentage = -1;
++	else
++		new_percentage = sysctl_out;
++
+ #else
+ 	fp = fopen(path_status, "r");
+ 	if(fp != NULL) { 
+



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301201451.r0KEpq2f005686>