From e4ae67a1c0ec690139b43561bdf202fffdd8450f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Hern=C3=A1ndez=20Blas?= Date: Mon, 7 Nov 2011 18:48:31 -0600 Subject: [PATCH] system/ibam: Added (Intelligent BAttery Monitor) Signed-off-by: Erik Hanson --- system/ibam/README | 7 ++ system/ibam/ibam.SlackBuild | 101 +++++++++++++++++++ system/ibam/ibam.info | 10 ++ system/ibam/patches/ibam-0.5.2-acpi.patch | 15 +++ system/ibam/patches/ibam-0.5.2-ldflags.patch | 27 +++++ system/ibam/slack-desc | 19 ++++ 6 files changed, 179 insertions(+) create mode 100644 system/ibam/README create mode 100644 system/ibam/ibam.SlackBuild create mode 100644 system/ibam/ibam.info create mode 100644 system/ibam/patches/ibam-0.5.2-acpi.patch create mode 100644 system/ibam/patches/ibam-0.5.2-ldflags.patch create mode 100644 system/ibam/slack-desc diff --git a/system/ibam/README b/system/ibam/README new file mode 100644 index 0000000000..df43e7a375 --- /dev/null +++ b/system/ibam/README @@ -0,0 +1,7 @@ +IBAM (Intelligent BAttery Monitor) + +IBAM is an advanced battery monitor for laptops, which uses +statistical and adaptive linear methods to provide accurate +estimations of minutes of battery left or of the time needed +until full recharge. This software relies on either APM, ACPI, +SYSFS or PMU kernel support to access the battery status. diff --git a/system/ibam/ibam.SlackBuild b/system/ibam/ibam.SlackBuild new file mode 100644 index 0000000000..8e6bbdd59d --- /dev/null +++ b/system/ibam/ibam.SlackBuild @@ -0,0 +1,101 @@ +#!/bin/sh + +# Slackware build script for ibam + +# Copyright (c) 2008-2011 Antonio Hernández Blas +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1.- Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=ibam +VERSION=${VERSION:-0.5.2} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +chmod -R u+w,go+r-w,a-s . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +# Make use of our CFLAGS +sed -i 's/^CFLAGS=-O3/CFLAGS+=/' Makefile + +# Apply some patches, from gentoo: +for i in $CWD/patches/*.patch +do + echo + echo "Appling patch $i ..." + cat $i | patch -p1 || exit 1 +done +echo + +CFLAGS="$SLKCFLAGS" make + +# Install binary by hand +# This is the only binary to package so there's no +# need to worry about $LIBDIRSUFFIX +install -D -m 0755 $PRGNAM $PKG/usr/bin/$PRGNAM + +find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +# There's no manpages +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a REPORT README CHANGES $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/ibam/ibam.info b/system/ibam/ibam.info new file mode 100644 index 0000000000..9b6cf6a09e --- /dev/null +++ b/system/ibam/ibam.info @@ -0,0 +1,10 @@ +PRGNAM="ibam" +VERSION="0.5.2" +HOMEPAGE="http://ibam.sourceforge.net" +DOWNLOAD="http://downloads.sourceforge.net/ibam/ibam-0.5.2.tar.gz" +MD5SUM="2d5222ff504dd19e7c1ea8acc2f13cf5" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="Antonio Hernández Blas" +EMAIL="hba.nihilismus@gmail.com" +APPROVED="Erik Hanson" diff --git a/system/ibam/patches/ibam-0.5.2-acpi.patch b/system/ibam/patches/ibam-0.5.2-acpi.patch new file mode 100644 index 0000000000..321f5b3c8d --- /dev/null +++ b/system/ibam/patches/ibam-0.5.2-acpi.patch @@ -0,0 +1,15 @@ +--- ibam-0.5.2/ibam.inl 2009-03-09 19:53:20.000000000 +0300 ++++ ibam-0.5.2/ibam.inl 2010-11-26 04:52:29.590364097 +0300 +@@ -942,10 +942,11 @@ + { + string pmu_path = "/proc/pmu"; // These strings are already in ibam.hpp, + string acpi_path = "/proc/acpi"; // maybe a static function should check this ++ string acpi_ver_path = "/sys/module/acpi/parameters/acpica_version"; + string sysfs_path = "/sys/class/power_supply"; // ... + ifstream pmu,acpi,sysfs; + pmu.open((pmu_path+"/info").c_str()); +- acpi.open((acpi_path+"/info").c_str()); ++ acpi.open(acpi_ver_path.c_str()); + if (pmu.is_open()) { + #ifdef IBAM_DEBUG + cout << "using pmu" << endl; diff --git a/system/ibam/patches/ibam-0.5.2-ldflags.patch b/system/ibam/patches/ibam-0.5.2-ldflags.patch new file mode 100644 index 0000000000..23c481dd63 --- /dev/null +++ b/system/ibam/patches/ibam-0.5.2-ldflags.patch @@ -0,0 +1,27 @@ +diff -uNr ibam-0.5.2.ORIG//Makefile ibam-0.5.2/Makefile +--- ibam-0.5.2.ORIG//Makefile 2010-10-19 21:49:39.000000000 +0100 ++++ ibam-0.5.2/Makefile 2010-10-19 21:53:27.000000000 +0100 +@@ -30,12 +30,12 @@ + all: ibam + + ibam: ibam.cpp ibam.inl ibam.hpp +- $(CC) $(CFLAGS) ibam.cpp -o ibam ++ $(CC) $(LDFLAGS) $(CFLAGS) ibam.cpp -o ibam + + krell: ibam-krell.so + + ibam-krell.so: ibam-krell.o +- $(CC) $(CFLAGS) -fPIC -shared -Wl -o ibam-krell.so ibam-krell.o ++ $(CC) $(LDFLAGS) $(CFLAGS) -fPIC -shared -Wl -o ibam-krell.so ibam-krell.o + + ibam-krell.o: ibam-krell.cpp ibam.hpp ibam.inl + $(CC) $(CFLAGS) -fPIC `pkg-config gtk+-2.0 --cflags` `gdk-pixbuf-config --cflags` -c ibam-krell.cpp +@@ -43,7 +43,7 @@ + krell1: ibam-krell1.so + + ibam-krell1.so: ibam-krell1.o +- $(CC) $(CFLAGS) -shared -Wl -o ibam-krell1.so ibam-krell1.o ++ $(CC) $(LDFLAGS) $(CFLAGS) -shared -Wl -o ibam-krell1.so ibam-krell1.o + + ibam-krell1.o: ibam-krell1.cpp ibam.hpp ibam.inl + $(CC) $(CFLAGS) -fPIC `gtk-config --cflags` `imlib-config --cflags-gdk` -c ibam-krell1.cpp diff --git a/system/ibam/slack-desc b/system/ibam/slack-desc new file mode 100644 index 0000000000..7dcb9a46de --- /dev/null +++ b/system/ibam/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +ibam: IBAM (Intelligent BAttery Monitor) +ibam: +ibam: IBAM is an advanced battery monitor for laptops, which uses +ibam: statistical and adaptive linear methods to provide accurate +ibam: estimations of minutes of battery left or of the time needed +ibam: until full recharge. This software relies on either APM, ACPI, +ibam: SYSFS or PMU kernel support to access the battery status. +ibam: +ibam: Homepage: http://ibam.sourceforge.net +ibam: +ibam: