diff options
author | Patrick Volkerding <volkerdi@slackware.com> | 2020-10-24 01:31:12 +0100 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2020-10-24 08:14:53 +0700 |
commit | 4a5150b387f6c8e829ee0d65f575ce45f59d33c7 (patch) | |
tree | a29f100a34dd9badeeac8b13b5a68b77a446a8ef /misc | |
parent | 5d899985224ff12db761c048568d08c91df19756 (diff) | |
download | slackbuilds-4a5150b387f6c8e829ee0d65f575ce45f59d33c7.tar.gz |
misc/g810-led: Added (LED controller for Logitech Gx10 keyboards)
Signed-off-by: Dave Woodfall <dave@slackbuilds.org>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'misc')
-rw-r--r-- | misc/g810-led/README | 7 | ||||
-rw-r--r-- | misc/g810-led/doinst.sh | 15 | ||||
-rw-r--r-- | misc/g810-led/g810-led.SlackBuild | 120 | ||||
-rw-r--r-- | misc/g810-led/g810-led.info | 10 | ||||
-rw-r--r-- | misc/g810-led/g810-led.makefile.patch | 82 | ||||
-rw-r--r-- | misc/g810-led/slack-desc | 19 |
6 files changed, 253 insertions, 0 deletions
diff --git a/misc/g810-led/README b/misc/g810-led/README new file mode 100644 index 0000000000..451a0859e6 --- /dev/null +++ b/misc/g810-led/README @@ -0,0 +1,7 @@ +g810-led (LED controller for Logitech Gx10 keyboards) + +This is a configuration tool for the LEDs on Logitech Gx10 gaming +keyboards. The LEDs can be configured in a variety of ways depending +on the capabilities of the keyboard, including effects such as +breathing, color-cycling, waves, individual key colors and +intensities, and key group colors and intensities. diff --git a/misc/g810-led/doinst.sh b/misc/g810-led/doinst.sh new file mode 100644 index 0000000000..46961bfb1d --- /dev/null +++ b/misc/g810-led/doinst.sh @@ -0,0 +1,15 @@ +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/g810-led/profile.new +config etc/g810-led/reboot.new diff --git a/misc/g810-led/g810-led.SlackBuild b/misc/g810-led/g810-led.SlackBuild new file mode 100644 index 0000000000..621fbaaf3c --- /dev/null +++ b/misc/g810-led/g810-led.SlackBuild @@ -0,0 +1,120 @@ +#!/bin/sh + +# Copyright 2020 Patrick Volkerding, Sebeka, Minnesota, USA +# 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=g810-led +VERSION=${VERSION:-0.4.2} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +# Set this to anything other than "NO" to install the shared library and +# development files. I'm not aware of anything that can make use of these +# at this time. Also, the library will not compile on Slackware 14.2, though +# it does compile on -current. +DEVEL=${DEVEL:-NO} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +set -e + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -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 + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +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 . +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 following issues with the makefile: +# - errors when systemd is not present +# - $(DESTDIR) missing in a few places +# - create relative, not absolute symlinks +# - create and install the shared library with a proper soname +# - don't install the udev rules +patch -p1 < $CWD/g810-led.makefile.patch + +# Fix libdir: +sed -i "s|libdir?=\$(PREFIX)/lib|libdir?=\$(PREFIX)/lib${LIBDIRSUFFIX}|g" makefile + +make bin LIB=libusb +make install DESTDIR=$PKG +if [ ! "$DEVEL" = "NO" ]; then + make lib LIB=libusb + make install-lib DESTDIR=$PKG + make install-dev DESTDIR=$PKG + # Fix permissions on shared library: + chmod 755 $PKG/usr/lib${LIBDIRSUFFIX}/libg810-led.so.* +fi + +# Strip binaries: +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +# Don't clobber an existing configuration: +mv $PKG/etc/g810-led/profile $PKG/etc/g810-led/profile.new +mv $PKG/etc/g810-led/reboot $PKG/etc/g810-led/reboot.new + +# Install the udev rules manually, filtering out the part that seems broken: +mkdir -p $PKG/lib/udev/rules.d +cat udev/g810-led.rules | grep -v SUBSYSTEMS > $PKG/lib/udev/rules.d/g810-led.rules + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + CONTRIBUTING* CONTRIBUTORS* INSTALL* LICENSE* PROFILES* README* \ + $PKG/usr/doc/$PRGNAM-$VERSION/ +cat $CWD/g810-led.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/g810-led.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/misc/g810-led/g810-led.info b/misc/g810-led/g810-led.info new file mode 100644 index 0000000000..ede2cb45db --- /dev/null +++ b/misc/g810-led/g810-led.info @@ -0,0 +1,10 @@ +PRGNAM="g810-led" +VERSION="0.4.2" +HOMEPAGE="https://github.com/MatMoul/g810-led/" +DOWNLOAD="https://github.com/MatMoul/g810-led/archive/v0.4.2/g810-led-0.4.2.tar.gz" +MD5SUM="6f4180a75469cd763b65fec7f1325c5f" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Patrick Volkerding" +EMAIL="volkerdi@slackware.com" diff --git a/misc/g810-led/g810-led.makefile.patch b/misc/g810-led/g810-led.makefile.patch new file mode 100644 index 0000000000..e973edb080 --- /dev/null +++ b/misc/g810-led/g810-led.makefile.patch @@ -0,0 +1,82 @@ +--- ./makefile.orig 2020-05-19 16:44:50.000000000 -0500 ++++ ./makefile 2020-10-23 15:49:08.155992793 -0500 +@@ -39,8 +39,9 @@ + + lib/lib$(PROGN).so: $(LIBSRCS) + @mkdir -p lib +- $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -fPIC -shared -Wl,-soname,lib$(PROGN).so -o lib/lib$(PROGN).so.$(MAJOR).$(MINOR).$(MICRO) $^ $(LIBS) +- @ln -sf lib$(PROGN).so.$(MAJOR).$(MINOR).$(MICRO) lib/lib$(PROGN).so ++ @$(CXX) $(LDFLAGS) -fPIC -shared -Wl,-soname,lib$(PROGN).so.$(MAJOR) -o lib/lib$(PROGN).so.$(MAJOR).$(MINOR).$(MICRO) $^ $(LIBS) ++ @ln -sf lib$(PROGN).so.$(MAJOR).$(MINOR).$(MICRO) lib/lib$(PROGN).so.$(MAJOR) ++ @ln -sf lib$(PROGN).so.$(MAJOR) lib/lib$(PROGN).so + + bin-linked: lib/lib$(PROGN).so + @mkdir -p bin +@@ -56,42 +57,43 @@ + @install -m 755 -d \ + $(DESTDIR)/usr/bin \ + $(DESTDIR)/etc/$(PROGN)/samples \ +- $(DESTDIR)/etc/udev/rules.d ++# $(DESTDIR)/etc/udev/rules.d + @cp bin/$(PROGN) $(DESTDIR)/usr/bin +- @test -s $(DESTDIR)/usr/bin/g213-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g213-led +- @test -s $(DESTDIR)/usr/bin/g410-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g410-led +- @test -s $(DESTDIR)/usr/bin/g413-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g413-led +- @test -s $(DESTDIR)/usr/bin/g512-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g512-led +- @test -s $(DESTDIR)/usr/bin/g513-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g513-led +- @test -s $(DESTDIR)/usr/bin/g610-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g610-led +- @test -s $(DESTDIR)/usr/bin/g815-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g815-led +- @test -s $(DESTDIR)/usr/bin/g910-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/g910-led +- @test -s $(DESTDIR)/usr/bin/gpro-led || ln -s /usr/bin/$(PROGN) $(DESTDIR)/usr/bin/gpro-led ++ @test -s $(DESTDIR)/usr/bin/g213-led || ln -s $(PROGN) $(DESTDIR)/usr/bin/g213-led ++ @test -s $(DESTDIR)/usr/bin/g410-led || ln -s $(PROGN) $(DESTDIR)/usr/bin/g410-led ++ @test -s $(DESTDIR)/usr/bin/g413-led || ln -s $(PROGN) $(DESTDIR)/usr/bin/g413-led ++ @test -s $(DESTDIR)/usr/bin/g512-led || ln -s $(PROGN) $(DESTDIR)/usr/bin/g512-led ++ @test -s $(DESTDIR)/usr/bin/g513-led || ln -s $(PROGN) $(DESTDIR)/usr/bin/g513-led ++ @test -s $(DESTDIR)/usr/bin/g610-led || ln -s $(PROGN) $(DESTDIR)/usr/bin/g610-led ++ @test -s $(DESTDIR)/usr/bin/g815-led || ln -s $(PROGN) $(DESTDIR)/usr/bin/g815-led ++ @test -s $(DESTDIR)/usr/bin/g910-led || ln -s $(PROGN) $(DESTDIR)/usr/bin/g910-led ++ @test -s $(DESTDIR)/usr/bin/gpro-led || ln -s $(PROGN) $(DESTDIR)/usr/bin/gpro-led + @cp sample_profiles/* $(DESTDIR)/etc/$(PROGN)/samples +- @cp udev/$(PROGN).rules $(DESTDIR)/etc/udev/rules.d +- @test -s /usr/bin/systemd-run && \ +- install -m 755 -d $(DESTDIR)$(SYSTEMDDIR)/system && \ +- cp systemd/$(PROGN)-reboot.service $(DESTDIR)$(SYSTEMDDIR)/system ++# @cp udev/$(PROGN).rules $(DESTDIR)/etc/udev/rules.d ++# @test -s /usr/bin/systemd-run && \ ++# install -m 755 -d $(DESTDIR)$(SYSTEMDDIR)/system && \ ++# cp systemd/$(PROGN)-reboot.service $(DESTDIR)$(SYSTEMDDIR)/system + + install-lib: lib + @install -m 755 -d $(libdir) + @install -m 644 lib/lib$(PROGN).so.$(MAJOR).$(MINOR).$(MICRO) $(libdir)/ +- @ln -sf lib$(PROGN).so.$(MAJOR).$(MINOR).$(MICRO) $(libdir)/lib$(PROGN).so ++ @ln -sf lib$(PROGN).so.$(MAJOR).$(MINOR).$(MICRO) $(libdir)/lib$(PROGN).so.$(MAJOR) ++ @ln -sf lib$(PROGN).so.$(MAJOR) $(libdir)/lib$(PROGN).so + + install-dev: install-lib + @mkdir -p $(includedir)/$(PROGN)/ + @install -m 644 src/classes/*.h $(includedir)/$(PROGN) + + install: setup +- @test -s /etc/$(PROGN)/profile || \ +- cp /etc/$(PROGN)/samples/group_keys /etc/$(PROGN)/profile +- @test -s /etc/$(PROGN)/reboot || \ +- cp /etc/$(PROGN)/samples/all_off /etc/$(PROGN)/reboot +- @udevadm control --reload-rules +- @$(PROGN) -p /etc/$(PROGN)/profile +- @test -s /usr/bin/systemd-run && \ +- systemctl daemon-reload && \ +- systemctl enable $(PROGN)-reboot ++ @test -s $(DESTDIR)/etc/$(PROGN)/profile || \ ++ cp $(DESTDIR)/etc/$(PROGN)/samples/group_keys $(DESTDIR)/etc/$(PROGN)/profile ++ @test -s $(DESTDIR)/etc/$(PROGN)/reboot || \ ++ cp $(DESTDIR)/etc/$(PROGN)/samples/all_off $(DESTDIR)/etc/$(PROGN)/reboot ++# @udevadm control --reload-rules ++# @$(PROGN) -p /etc/$(PROGN)/profile ++# @test -s /usr/bin/systemd-run && \ ++# systemctl daemon-reload && \ ++# systemctl enable $(PROGN)-reboot + + uninstall-lib: + @rm -f $(libdir)/lib$(PROGN).so* diff --git a/misc/g810-led/slack-desc b/misc/g810-led/slack-desc new file mode 100644 index 0000000000..7616e91553 --- /dev/null +++ b/misc/g810-led/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------------------------------------------------------| +g810-led: g810-led (LED controller for Logitech Gx10 keyboards) +g810-led: +g810-led: This is a configuration tool for the LEDs on Logitech Gx10 gaming +g810-led: keyboards. The LEDs can be configured in a variety of ways depending +g810-led: on the capabilities of the keyboard, including effects such as +g810-led: breathing, color-cycling, waves, individual key colors and +g810-led: intensities, and key group colors and intensities. +g810-led: +g810-led: Homepage: https://github.com/MatMoul/g810-led/ +g810-led: +g810-led: |