slackbuilds/lua/awesome/SlackBuild
Gwenhael Le Moine e4486755e6
simplify
2020-09-03 15:22:52 +02:00

88 lines
2 KiB
Bash
Executable file

#!/bin/sh
# variables
CWD=$(pwd)
PRGNAM=awesome
BRANCH=master
VERSION=${VERSION:-${BRANCH}}
ARCH=${ARCH:-$(uname -m)}
BUILD=1
TAG=gwh
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
OUTPUT=/tmp
REPOSITORIES=/home/installs/SlackBuilds/repositories
SLCKFLAGS=""
REQUIRES="lua luarocks lgi"
# nettoyage préalable
rm -fr $PKG $TMP/$PRGNAM
mkdir -p $PKG
SRC_PATH=$REPOSITORIES/$PRGNAM
# mise en place
cd $TMP
[ ! -e $REPOSITORIES/$PRGNAM ] && git clone https://github.com/awesomeWM/$PRGNAM.git $REPOSITORIES/$PRGNAM
( cd $REPOSITORIES/$PRGNAM; git pull )
rm -fr $TMP/$PRGNAM
mkdir -p $TMP/$PRGNAM
cd $TMP/$PRGNAM
VERSION="$( cd $REPOSITORIES/$PRGNAM && git log -1 --format=%h_%ad --date=format:%Y.%m.%d )"
# configuration
cmake \
-DCMAKE_INSTALL_PREFIX=/usr \
-DSYSCONFDIR=/etc \
-DAWESOME_DOC_PATH=/usr/doc/$PRGNAM \
-DAWESOME_MAN_PATH=/usr/man \
$SRC_PATH
# compilation
make -j3
# installation
make install DESTDIR=$PKG
mkdir -p $PKG/etc/X11/xinit/
cp $CWD/xinitrc.$PRGNAM $PKG/etc/X11/xinit/
chmod +x $PKG/etc/X11/xinit/xinitrc.$PRGNAM
# correction
cd $PKG
chown -R root:root *
find $PKG -name \.git\* -exec rm -fr {} \;
[ -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
cat <<EOF > $PKG/install/slack-desc
$PRGNAM: $PRGNAM (Window Manager "Framework")
$PRGNAM:
$PRGNAM: $PRGNAM is an extremely fast, small, and dynamic window manager for X.
$PRGNAM:
$PRGNAM: # for rock in luafilesystem penlight ldoc busted luacheck luacov; do
$PRGNAM: luarocks install $rock;
$PRGNAM: done
$PRGNAM:
$PRGNAM: https://awesomewm.org/
$PRGNAM: see /usr/doc/$PRGNAM-$VERSION for more details
$PRGNAM:
EOF
# empaquetage
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | sed 's/-//g')-$ARCH-$BUILD$TAG.txz