aboutsummaryrefslogtreecommitdiff
path: root/system/pommed-light
diff options
context:
space:
mode:
authorZhu Qun-Ying <zhu.qunying@gmail.com>2014-10-18 06:29:34 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2014-10-18 06:29:34 +0700
commitfe5e8c11bd6caaf029a2db1c3f222367f7a2f2a1 (patch)
treedf27fb493d5e0c09bd856fed166251e1aa40e8ed /system/pommed-light
parent2bd0ba6a1ee367242f54a6a890a1191fb566f6bc (diff)
system/pommed-light: Added (Apple laptops hotkeys events handler).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/pommed-light')
-rw-r--r--system/pommed-light/README9
-rw-r--r--system/pommed-light/doinst.sh14
-rw-r--r--system/pommed-light/pommed-light.SlackBuild98
-rw-r--r--system/pommed-light/pommed-light.info10
-rw-r--r--system/pommed-light/pommed.patch154
-rw-r--r--system/pommed-light/slack-desc19
6 files changed, 304 insertions, 0 deletions
diff --git a/system/pommed-light/README b/system/pommed-light/README
new file mode 100644
index 000000000000..524b03a8e784
--- /dev/null
+++ b/system/pommed-light/README
@@ -0,0 +1,9 @@
+pommed-light (Apple laptops hotkeys events handler)
+
+This is a stripped-down version of pommed with client, dbus,
+and ambient light sensor support removed, optimized for use
+with dwm and the like.
+
+pommed-light handles the hotkeys found on the Apple MacBook Pro and
+MacBook laptops and adjusts the LCD backlight, sound volume,
+keyboard backlight or ejects the CD-ROM drive accordingly.
diff --git a/system/pommed-light/doinst.sh b/system/pommed-light/doinst.sh
new file mode 100644
index 000000000000..1e8713903f56
--- /dev/null
+++ b/system/pommed-light/doinst.sh
@@ -0,0 +1,14 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+config etc/pommed.conf.new
diff --git a/system/pommed-light/pommed-light.SlackBuild b/system/pommed-light/pommed-light.SlackBuild
new file mode 100644
index 000000000000..a565937a3a36
--- /dev/null
+++ b/system/pommed-light/pommed-light.SlackBuild
@@ -0,0 +1,98 @@
+#!/bin/sh
+
+# Slackware build script for pommed-light
+
+# Copyright 2014 Zhu Qun-Ying
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script 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=pommed-light
+VERSION=${VERSION:-1.47lw}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) echo "No ARM platform is supported"; exit ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+set -e
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ echo "Unsupported platform $ARCH"
+fi
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz || tar xvf $CWD/v$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+# patch the source
+patch -p1 < $CWD/pommed.patch
+
+make EXTRA_CFLAGS="$SLKCFLAGS"
+
+mkdir -p $PKG/usr/sbin
+install -m755 pommed/pommed $PKG/usr/sbin
+mkdir -p $PKG/usr/man/man1
+gzip -c pommed.1 > $PKG/usr/man/man1/pommed.1.gz
+
+mkdir -p $PKG/usr/share/pommed
+cp -a pommed/data/* $PKG/usr/share/pommed
+
+mkdir -p $PKG/etc/rc.d/
+cp pommed.conf.mactel $PKG/etc/pommed.conf.new
+
+install -m644 pommed.init $PKG/etc/rc.d/rc.pommed
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp README.md INSTALL COPYING AUTHORS ChangeLog $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
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/system/pommed-light/pommed-light.info b/system/pommed-light/pommed-light.info
new file mode 100644
index 000000000000..9c2defbde1bb
--- /dev/null
+++ b/system/pommed-light/pommed-light.info
@@ -0,0 +1,10 @@
+PRGNAM="pommed-light"
+VERSION="1.74lw"
+HOMEPAGE="https://github.com/qunying/pommed-light"
+DOWNLOAD="https://github.com/qunying/pommed-light/archive/v1.47lw.tar.gz"
+MD5SUM="36b21b215b17577c561439bc76fd00ef"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="confuse"
+MAINTAINER="Zhu Qun-Ying"
+EMAIL="zhu.qunying@gmail.com"
diff --git a/system/pommed-light/pommed.patch b/system/pommed-light/pommed.patch
new file mode 100644
index 000000000000..62ed28016f58
--- /dev/null
+++ b/system/pommed-light/pommed.patch
@@ -0,0 +1,154 @@
+diff --git a/pommed/Makefile b/pommed/Makefile
+index 2a74e78..dd34146 100644
+--- a/pommed/Makefile
++++ b/pommed/Makefile
+@@ -11,13 +11,9 @@ AUDIOFILE_LIBS = $(shell pkg-config audiofile --libs)
+ CONFUSE_CFLAGS = $(shell pkg-config libconfuse --cflags)
+ CONFUSE_LIBS = $(shell pkg-config libconfuse --libs)
+
+-INOTIFY_CFLAGS = $(shell test -e /usr/include/sys/inotify.h || echo -DNO_SYS_INOTIFY_H)
++CFLAGS = -g -O2 -Wall $(ALSA_CFLAGS) $(AUDIOFILE_CFLAGS) $(CONFUSE_CFLAGS) $(EXTRA_CFLAGS)
+
+-TIMERFD_CFLAGS = $(shell test -e /usr/include/sys/timerfd.h || echo -DNO_SYS_TIMERFD_H)
+-
+-CFLAGS = -g -O2 -Wall $(DBUS_CFLAGS) $(ALSA_CFLAGS) $(AUDIOFILE_CFLAGS) $(CONFUSE_CFLAGS) $(INOTIFY_CFLAGS) $(TIMERFD_CFLAGS)
+-
+-LDLIBS = -pthread -lrt $(DBUS_LIBS) $(ALSA_LIBS) $(AUDIOFILE_LIBS) $(CONFUSE_LIBS)
++LDLIBS = -pthread -lrt $(ALSA_LIBS) $(AUDIOFILE_LIBS) $(CONFUSE_LIBS)
+
+ LIB_OBJS =
+
+@@ -53,9 +49,10 @@ ifeq ($(LIBPCI_SHARED), true)
+ LDLIBS += $(LIBPCI_LIBS)
+ else
+ LIB_OBJS += /usr/lib/libpci.a
+- LDLIBS += -lz
+ endif
+
++LDLIBS += -lz
++
+ LDLIBS += $(LIB_OBJS)
+
+ SOURCES = pommed.c cd_eject.c evdev.c conffile.c audio.c \
+diff --git a/pommed/evdev.c b/pommed/evdev.c
+index abd8590..3564da1 100644
+--- a/pommed/evdev.c
++++ b/pommed/evdev.c
+@@ -31,12 +31,7 @@
+
+ #include <sys/epoll.h>
+
+-#ifndef NO_SYS_INOTIFY_H
+-# include <sys/inotify.h>
+-#else
+-# include <linux/inotify.h>
+-# include "inotify-syscalls.h"
+-#endif
++#include <sys/inotify.h>
+
+ #include <linux/input.h>
+
+diff --git a/pommed/inotify-syscalls.h b/pommed/inotify-syscalls.h
+deleted file mode 100644
+index a1d5408..0000000
+--- a/pommed/inotify-syscalls.h
++++ /dev/null
+@@ -1,98 +0,0 @@
+-/*
+- * Inotify syscall numbers
+- * Taken from the Linux kernel source tree
+- *
+- * Licensed under the terms of the GNU General Public License Version 2.
+- *
+- * Copyright (c) 2006 Tobias Klauser <tklauser@distanz.ch>
+- */
+-
+-#ifndef _LINUX_INOTIFY_SYSCALLS_H
+-#define _LINUX_INOTIFY_SYSCALLS_H
+-
+-#include <sys/syscall.h>
+-
+-#if defined(__i386__)
+-# define __NR_inotify_init 291
+-# define __NR_inotify_add_watch 292
+-# define __NR_inotify_rm_watch 293
+-#elif defined(__x86_64__)
+-# define __NR_inotify_init 253
+-# define __NR_inotify_add_watch 254
+-# define __NR_inotify_rm_watch 255
+-#elif defined(__powerpc__) || defined(__powerpc64__)
+-# define __NR_inotify_init 275
+-# define __NR_inotify_add_watch 276
+-# define __NR_inotify_rm_watch 277
+-#elif defined (__ia64__)
+-# define __NR_inotify_init 1277
+-# define __NR_inotify_add_watch 1278
+-# define __NR_inotify_rm_watch 1279
+-#elif defined (__s390__)
+-# define __NR_inotify_init 284
+-# define __NR_inotify_add_watch 285
+-# define __NR_inotify_rm_watch 286
+-#elif defined (__alpha__)
+-# define __NR_inotify_init 444
+-# define __NR_inotify_add_watch 445
+-# define __NR_inotify_rm_watch 446
+-#elif defined (__sparc__) || defined (__sparc64__)
+-# define __NR_inotify_init 151
+-# define __NR_inotify_add_watch 152
+-# define __NR_inotify_rm_watch 156
+-#elif defined (__arm__)
+-# define __NR_OABI_SYSCALL_BASE 0x900000
+-# if defined(__thumb__) || defined(__ARM_EABI__)
+-# define __NR_SYSCALL_BASE 0
+-# else
+-# define __NR_SYSCALL_BASE __NR_OABI_SYSCALL_BASE
+-# endif
+-# define __NR_inotify_init (__NR_SYSCALL_BASE + 316)
+-# define __NR_inotify_add_watch (__NR_SYSCALL_BASE + 317)
+-# define __NR_inotify_rm_watch (__NR_SYSCALL_BASE + 318)
+-#elif defined (__sh__)
+-# define __NR_inotify_init 290
+-# define __NR_inotify_add_watch 291
+-# define __NR_inotify_rm_watch 292
+-#elif defined (__hppa__)
+-# define __NR_inotify_init 269
+-# define __NR_inotify_add_watch 270
+-# define __NR_inotify_rm_watch 271
+-#elif defined (__mips__)
+-# include <sgidefs.h>
+-# if _MIPS_SIM == _MIPS_SIM_ABI32
+-# define __NR_Linux 4000
+-# define __NR_inotify_init (__NR_Linux + 284)
+-# define __NR_inotify_add_watch (__NR_Linux + 285)
+-# define __NR_inotify_rm_watch (__NR_Linux + 286)
+-# elif _MIPS_SIM == _MIPS_SIM_ABI64
+-# define __NR_Linux 5000
+-# define __NR_inotify_init (__NR_Linux + 243)
+-# define __NR_inotify_add_watch (__NR_Linux + 244)
+-# define __NR_inotify_rm_watch (__NR_Linux + 245)
+-# elif _MIPS_SIM == _MIPS_SIM_NABI32
+-# define __NR_Linux 6000
+-# define __NR_inotify_init (__NR_Linux + 247)
+-# define __NR_inotify_add_watch (__NR_Linux + 248)
+-# define __NR_inotify_rm_watch (__NR_Linux + 249)
+-# endif
+-#else
+-# error "inotify not supported on this architecture!"
+-#endif
+-
+-static inline int inotify_init (void)
+-{
+- return syscall (__NR_inotify_init);
+-}
+-
+-static inline int inotify_add_watch (int fd, const char *name, __u32 mask)
+-{
+- return syscall (__NR_inotify_add_watch, fd, name, mask);
+-}
+-
+-static inline int inotify_rm_watch (int fd, __u32 wd)
+-{
+- return syscall (__NR_inotify_rm_watch, fd, wd);
+-}
+-
+-#endif /* _LINUX_INOTIFY_SYSCALLS_H */
diff --git a/system/pommed-light/slack-desc b/system/pommed-light/slack-desc
new file mode 100644
index 000000000000..ea62e9da6ae3
--- /dev/null
+++ b/system/pommed-light/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 ':' except on otherwise blank lines.
+
+ |-----handy-ruler-------------------------------------------------|
+pommed-light: pommed-light (Apple laptops hotkeys events handler)
+pommed-light:
+pommed-light: pommed handles the hotkeys found on the Apple MacBook Pro and
+pommed-light: MacBook laptops and adjusts the LCD backlight, sound volume,
+pommed-light: keyboard backlight or ejects the CD-ROM drive accordingly.
+pommed-light:
+pommed-light:
+pommed-light:
+pommed-light:
+pommed-light: Homepage: https://github.com/bytbox/pommed-light
+pommed-light: