slackbuilds/wayland/sway/SlackBuild

143 lines
3.2 KiB
Text
Raw Normal View History

2021-06-15 10:26:26 +02:00
#!/bin/bash
2021-04-26 00:06:40 +02:00
# variables
GITHUB_REPO=swaywm/sway
2022-01-21 11:29:29 +01:00
VERSION=${VERSION:-"latest"}
BUILD=4
2021-04-26 00:06:40 +02:00
TAG=gwh
OUTPUT=/tmp
TMP=/tmp/$TAG
CWD=$(pwd)
PRGNAM=$(basename $CWD)
PKG=$TMP/pkg-$PRGNAM
ARCH=$(uname -m)
2022-01-22 19:52:02 +01:00
REPOSITORY=/home/installs/SlackBuilds/_repositories/$PRGNAM
2021-04-26 00:06:40 +02:00
PREFIX=/usr
# nettoyage préalable
2022-08-25 13:22:56 +02:00
rm -fr "$PKG" "$TMP/$PRGNAM"
2021-04-26 00:06:40 +02:00
2022-08-25 13:22:56 +02:00
mkdir -p "$PKG"
2021-04-26 00:06:40 +02:00
# mise en place
2022-08-25 13:22:56 +02:00
[ ! -e "$REPOSITORY" ] && git clone https://github.com/${GITHUB_REPO} "$REPOSITORY"
cd "$REPOSITORY" || exit 1
2021-06-15 10:59:49 +02:00
git pull --all
2021-04-26 00:06:40 +02:00
2022-08-25 13:22:56 +02:00
cp -R "$REPOSITORY" $TMP/
2022-08-25 13:22:56 +02:00
cd "$TMP/$PRGNAM/" || exit 1
2022-01-21 11:29:29 +01:00
case $VERSION in
trunk)
VERSION="git_$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
;;
latest)
2022-10-03 16:35:04 +02:00
VERSION=$(git describe --tags --abbrev=0)
2022-08-25 13:22:56 +02:00
git checkout "$VERSION"
2022-01-21 11:29:29 +01:00
;;
*)
2022-08-25 13:22:56 +02:00
git checkout "$VERSION"
2022-01-21 11:29:29 +01:00
;;
esac
2022-08-25 13:22:56 +02:00
for p in "$CWD"/patches/*.patch; do
git am "$p"
done
2021-10-25 14:21:36 +02:00
2021-05-01 12:07:45 +02:00
meson setup \
--prefix /usr \
--mandir /usr/man/ \
-Dsd-bus-provider=libelogind \
-Dstrip=true \
-Ddefault-wallpaper=true \
-Dswaybar=true \
-Dxwayland=enabled \
-Dtray=enabled \
-Dgdk-pixbuf=enabled \
-Dswaynag=true \
-Dbash-completions=true \
-Dzsh-completions=true \
-Dfish-completions=true \
2021-05-01 12:07:45 +02:00
build/
2022-04-16 15:03:04 +02:00
2021-04-26 00:06:40 +02:00
ninja -C build/
2022-08-25 13:22:56 +02:00
cd build/ || exit 1
meson install --destdir="$PKG"
2021-04-26 00:06:40 +02:00
cd ../
2022-08-25 13:22:56 +02:00
cat <<EOF > "$PKG$PREFIX/bin/start_sway.sh"
2021-06-15 10:26:26 +02:00
#!/bin/bash
2022-07-13 13:38:21 +02:00
set -e
2021-05-01 12:07:45 +02:00
2022-09-30 11:36:03 +02:00
# LOGFILE=/tmp/wsession-errors
# true > \$LOGFILE
# exec &> \$LOGFILE
# set -x
# echo "sway Starting: \$( date )"
2022-08-30 13:44:05 +02:00
2022-08-25 13:22:56 +02:00
# Uncomment if mouse pointer is invisible
#export WLR_NO_HARDWARE_CURSORS=1
2021-05-01 12:07:45 +02:00
2022-10-06 12:36:35 +02:00
unset QT_QPA_PLATFORM
export QT_QPA_PLATFORMTHEME=qt5ct
export MOZ_ENABLE_WAYLAND=1
export XDG_CURRENT_DESKTOP=sway
export XDG_PICTURES_DIR=\$HOME/.wallpapers
2022-08-25 13:22:56 +02:00
export SWAYSOCK=/run/user/\$(id -u)/sway-ipc.\$(id -u).\$(pgrep -x sway).sock
2022-07-13 13:38:21 +02:00
export XDG_RUNTIME_DIR=/tmp/xdg-runtime-\$(id -u)
2022-08-25 13:22:56 +02:00
2022-07-13 13:38:21 +02:00
mkdir -p \$XDG_RUNTIME_DIR
chmod 0700 \$XDG_RUNTIME_DIR
2022-07-13 13:38:21 +02:00
2022-10-06 12:36:35 +02:00
# avoid wlr error
unset DISPLAY
exec dbus-run-session sway
2021-05-01 12:07:45 +02:00
EOF
2022-08-25 13:22:56 +02:00
chmod +x "$PKG$PREFIX/bin/start_sway.sh"
2021-05-01 12:07:45 +02:00
2022-08-25 13:22:56 +02:00
sed -i 's|Exec=sway|Exec=/usr/bin/start_sway.sh|' "$PKG$PREFIX/share/wayland-sessions/sway.desktop"
2021-05-01 12:07:45 +02:00
2022-08-25 13:22:56 +02:00
mkdir -p "$PKG$PREFIX/doc/$PRGNAM"
cp LICENSE ./*.md "$PKG$PREFIX/doc/$PRGNAM/"
2021-04-26 00:06:40 +02:00
# correction
2022-08-25 13:22:56 +02:00
cd "$PKG" || exit 1
chown -R root:root ./*
[ -d "$PKG$PREFIX/man" ] && find "$PKG$PREFIX/man" -name "*.?" -type f -exec gzip -9 {} \;
2021-04-26 00:06:40 +02:00
# embaumement
2022-08-25 13:22:56 +02:00
mkdir -p "$PKG/install"
2021-04-26 00:06:40 +02:00
2022-08-25 13:22:56 +02:00
cat <<EOF > "$PKG/install/slack-desc"
2021-04-26 00:06:40 +02:00
# 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------------------------------------------------------|
$PRGNAM: $PRGNAM (i3-compatible Wayland compositor)
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: https://github.com/${GITHUB_REPO}
2021-04-26 00:06:40 +02:00
EOF
# empaquetage
2022-08-25 13:22:56 +02:00
rm -f "$PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la"
/sbin/makepkg -l y -c n "$OUTPUT/$PRGNAM-$(echo "$VERSION" | tr - _)-$ARCH-$BUILD$TAG.txz"