diff options
author | lme <lme@FreeBSD.org> | 2013-01-20 22:51:52 +0800 |
---|---|---|
committer | lme <lme@FreeBSD.org> | 2013-01-20 22:51:52 +0800 |
commit | 8a1e56ee9db55bb2f35f88bd4e53bebe68a268cf (patch) | |
tree | fed2d837b9927243f1a5a09ac2f67922fda3a8ed /x11/tint | |
parent | 788a89ea7a6b4afee2d8aa2d24840897b93ae09a (diff) | |
download | freebsd-ports-gnome-8a1e56ee9db55bb2f35f88bd4e53bebe68a268cf.tar.gz freebsd-ports-gnome-8a1e56ee9db55bb2f35f88bd4e53bebe68a268cf.tar.zst freebsd-ports-gnome-8a1e56ee9db55bb2f35f88bd4e53bebe68a268cf.zip |
- 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>
Diffstat (limited to 'x11/tint')
-rw-r--r-- | x11/tint/Makefile | 46 | ||||
-rw-r--r-- | x11/tint/files/patch-src-battery-battery.c | 144 |
2 files changed, 167 insertions, 23 deletions
diff --git a/x11/tint/Makefile b/x11/tint/Makefile index d2c20ea762ba..be0923b94c18 100644 --- a/x11/tint/Makefile +++ b/x11/tint/Makefile @@ -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 diff --git a/x11/tint/files/patch-src-battery-battery.c b/x11/tint/files/patch-src-battery-battery.c new file mode 100644 index 000000000000..2d850bcd69e8 --- /dev/null +++ b/x11/tint/files/patch-src-battery-battery.c @@ -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) { + |