2021-06-15 10:26:26 +02:00
|
|
|
|
#!/bin/bash
|
2020-07-31 10:33:16 +02:00
|
|
|
|
|
|
|
|
|
# variables
|
|
|
|
|
CWD=$(pwd)
|
|
|
|
|
|
|
|
|
|
PRGNAM=$(basename $(pwd))
|
2021-09-23 15:52:55 +02:00
|
|
|
|
GITHUB_REPO=Hummer12007/brightnessctl
|
2022-01-22 10:52:07 +01:00
|
|
|
|
VERSION=${VERSION:-latest}
|
2020-07-31 10:33:16 +02:00
|
|
|
|
ARCH=${ARCH:-$(uname -m)}
|
|
|
|
|
BUILD=1
|
|
|
|
|
|
|
|
|
|
TAG=gwh
|
|
|
|
|
TMP=/tmp/$TAG
|
|
|
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
|
|
|
OUTPUT=/tmp
|
|
|
|
|
|
2022-01-22 19:52:02 +01:00
|
|
|
|
REPOSITORIES=/home/installs/SlackBuilds/_repositories
|
2020-07-31 10:33:16 +02:00
|
|
|
|
|
|
|
|
|
PREFIX=/usr
|
|
|
|
|
|
2021-09-23 15:52:55 +02:00
|
|
|
|
[ ! -e $REPOSITORIES/$PRGNAM ] && git clone https://github.com/${GITHUB_REPO}.git $REPOSITORIES/$PRGNAM
|
2021-06-15 15:15:18 +02:00
|
|
|
|
cd $REPOSITORIES/$PRGNAM
|
|
|
|
|
git pull --all
|
2020-07-31 10:33:16 +02:00
|
|
|
|
|
|
|
|
|
# nettoyage pr<70>alable
|
2020-07-31 12:06:06 +02:00
|
|
|
|
rm -fr $PKG $TMP/$PRGNAM
|
2020-07-31 10:33:16 +02:00
|
|
|
|
|
|
|
|
|
mkdir -p $PKG
|
|
|
|
|
|
|
|
|
|
# mise en place
|
|
|
|
|
cd $TMP
|
|
|
|
|
cp -R $REPOSITORIES/$PRGNAM $TMP/$PRGNAM
|
|
|
|
|
|
|
|
|
|
cd $TMP/$PRGNAM
|
2024-01-11 14:48:15 +01:00
|
|
|
|
[ "x$VERSION" == "xlatest" ] && VERSION=$(git tag --sort=-taggerdate | head -n1)
|
2022-01-22 10:52:07 +01:00
|
|
|
|
[ "x$VERSION" == "x" ] && VERSION=trunk
|
2023-03-23 09:54:21 +01:00
|
|
|
|
[ "x$VERSION" == "xtrunk" ] && VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)" || git checkout $VERSION
|
2020-07-31 10:33:16 +02:00
|
|
|
|
|
2022-07-06 20:49:45 +02:00
|
|
|
|
./configure \
|
|
|
|
|
--prefix=/usr
|
|
|
|
|
|
2020-07-31 10:33:16 +02:00
|
|
|
|
# compilation
|
|
|
|
|
make -j3 PREFIX=$PREFIX
|
|
|
|
|
|
|
|
|
|
# installation
|
|
|
|
|
make install DESTDIR=$PKG PREFIX=$PREFIX MANDIR=$PKG$PREFIX/man
|
|
|
|
|
|
2020-07-31 12:06:06 +02:00
|
|
|
|
chmod a+s $PKG/usr/bin/brightnessctl
|
|
|
|
|
|
2020-07-31 10:33:16 +02:00
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM
|
|
|
|
|
cp LICENSE README.md $PKG/usr/doc/$PRGNAM/
|
|
|
|
|
|
|
|
|
|
# correction
|
|
|
|
|
cd $PKG
|
|
|
|
|
chown -R root:root *
|
|
|
|
|
|
|
|
|
|
[ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
|
|
|
|
|
|
|
|
|
|
# Strip binaries
|
|
|
|
|
( cd $PKG
|
|
|
|
|
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
|
|
|
|
|
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# embaumement
|
|
|
|
|
mkdir -p $PKG/install
|
2020-07-31 12:06:06 +02:00
|
|
|
|
cat <<EOF > $PKG/install/doinst.sh
|
|
|
|
|
chmod a+s /usr/bin/brightnessctl
|
|
|
|
|
EOF
|
|
|
|
|
|
2020-07-31 10:33:16 +02:00
|
|
|
|
cat <<EOF > $PKG/install/slack-desc
|
|
|
|
|
$PRGNAM: $PRGNAM ( A program to read and control device brightness)
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM: This program allows you read and control device brightness. Devices, by default,
|
|
|
|
|
$PRGNAM: include backlight and LEDs (searched for in corresponding classes). If omitted,
|
|
|
|
|
$PRGNAM: the first found device is selected.
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM: It can also preserve current brightness before applying the operation
|
|
|
|
|
$PRGNAM: (allowing for usecases like disabling backlight on lid close).
|
|
|
|
|
$PRGNAM:
|
2021-09-23 15:52:55 +02:00
|
|
|
|
$PRGNAM: https://github.com/${GITHUB_REPO}
|
2020-07-31 10:33:16 +02:00
|
|
|
|
$PRGNAM:
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
# empaquetage
|
|
|
|
|
cd $PKG
|
|
|
|
|
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
|
2023-08-16 12:23:26 +02:00
|
|
|
|
/sbin/makepkg --linkadd y --chown n --prepend $OUTPUT/$PRGNAM-$(echo $VERSION | sed 's/-//g')-$ARCH-$BUILD$TAG.txz
|