2021-06-15 10:26:26 +02:00
|
|
|
#!/bin/bash
|
2021-04-26 00:06:40 +02:00
|
|
|
|
|
|
|
# variables
|
2021-09-22 16:42:22 +02:00
|
|
|
GITHUB_REPO=swaywm/sway
|
2022-01-21 11:29:29 +01:00
|
|
|
VERSION=${VERSION:-"latest"}
|
2023-01-01 11:26:21 +01:00
|
|
|
BUILD=9
|
2021-04-26 00:06:40 +02:00
|
|
|
|
|
|
|
TAG=gwh
|
|
|
|
OUTPUT=/tmp
|
|
|
|
TMP=/tmp/$TAG
|
|
|
|
CWD=$(pwd)
|
|
|
|
|
2022-12-06 16:47:11 +01:00
|
|
|
PRGNAM=$(basename "$CWD")
|
2021-04-26 00:06:40 +02:00
|
|
|
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-12-06 16:47:11 +01: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
|
2022-12-02 16:30:04 +01:00
|
|
|
git reset --hard HEAD
|
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/
|
2021-06-15 15:15:18 +02:00
|
|
|
|
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
|
2021-06-15 15:15:18 +02:00
|
|
|
|
2022-11-12 22:20:23 +01:00
|
|
|
[ -e "$CWD"/patches/6249-tray-menu.patch ] && mv "$CWD"/patches/6249-tray-menu.patch{,.previous}
|
|
|
|
wget -c https://patch-diff.githubusercontent.com/raw/swaywm/sway/pull/6249.patch -O "$CWD"/patches/6249-tray-menu.patch
|
|
|
|
|
2022-08-25 13:22:56 +02:00
|
|
|
for p in "$CWD"/patches/*.patch; do
|
2022-12-02 16:30:04 +01:00
|
|
|
git am --show-current-patch=diff "$p"
|
2021-11-03 11:18:06 +01:00
|
|
|
done
|
2021-10-25 14:21:36 +02:00
|
|
|
|
2022-12-02 16:30:04 +01:00
|
|
|
# Embed wlroots
|
|
|
|
WLROOTS_VERSION=${WLROOTS_VERSION:-$VERSION}
|
|
|
|
WLROOTS_REPOSITORY=/home/installs/SlackBuilds/_repositories/wlroots
|
|
|
|
|
|
|
|
[ ! -e "$WLROOTS_REPOSITORY" ] && git clone https://gitlab.freedesktop.org/wlroots/wlroots.git "$WLROOTS_REPOSITORY"
|
|
|
|
cd "$WLROOTS_REPOSITORY" || exit 1
|
|
|
|
git reset --hard HEAD
|
|
|
|
git pull --all
|
|
|
|
|
|
|
|
mkdir -p "$TMP/$PRGNAM"/subprojects/
|
|
|
|
cp -a "$WLROOTS_REPOSITORY" "$TMP/$PRGNAM"/subprojects/wlroots
|
|
|
|
cd "$TMP/$PRGNAM"/subprojects/wlroots || exit 1
|
|
|
|
case $WLROOTS_VERSION in
|
|
|
|
trunk)
|
|
|
|
WLROOTS_VERSION="git_$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
|
|
|
|
;;
|
|
|
|
latest)
|
|
|
|
WLROOTS_VERSION=$(git describe --tags --abbrev=0)
|
2022-12-06 16:47:11 +01:00
|
|
|
git checkout "$WLROOTS_VERSION"
|
2022-12-02 16:30:04 +01:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
git checkout "$WLROOTS_VERSION"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
cd "$TMP/$PRGNAM/" || exit 1
|
|
|
|
|
|
|
|
# Back to compiling sway…
|
2021-05-01 12:07:45 +02:00
|
|
|
meson setup \
|
|
|
|
--prefix /usr \
|
|
|
|
--mandir /usr/man/ \
|
2022-04-16 15:09:42 +02:00
|
|
|
-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-12-06 16:47:11 +01:00
|
|
|
# Don't package wlroots includes or .so link as we don't want to interfere with SBo's wlroots
|
|
|
|
find "$PKG$PREFIX/lib$(uname -m | grep -o 64)/" -type l -exec rm {} \;
|
|
|
|
rm -r "$PKG$PREFIX/lib$(uname -m | grep -o 64)/pkgconfig/"
|
|
|
|
rm -r "$PKG$PREFIX/include/"
|
|
|
|
|
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
|
2021-05-01 12:07:45 +02:00
|
|
|
|
2022-10-06 13:19:26 +02:00
|
|
|
#set -e
|
|
|
|
|
2022-10-15 18:43:02 +02:00
|
|
|
LOGFILE=~/.wsession-errors
|
2022-10-06 13:19:26 +02:00
|
|
|
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
|
|
|
|
|
2023-01-01 11:26:21 +01:00
|
|
|
export WLR_RENDERER=vulkan
|
|
|
|
export CLUTTER_BACKEND=wayland
|
|
|
|
export SDL_VIDEODRIVER=wayland
|
|
|
|
export XDG_SESSION_DESKTOP=sway
|
|
|
|
export XDG_SESSION_TYPE=wayland
|
|
|
|
export QT_PLATFORMTHEME=qt5ct
|
|
|
|
export QT_PLATFORM_PLUGIN=qt5ct
|
|
|
|
|
2022-10-06 12:36:35 +02:00
|
|
|
export QT_QPA_PLATFORMTHEME=qt5ct
|
|
|
|
export MOZ_ENABLE_WAYLAND=1
|
|
|
|
export XDG_CURRENT_DESKTOP=sway
|
2022-10-15 18:43:02 +02:00
|
|
|
export XDG_PICTURES_DIR=~/.wallpapers
|
2022-10-06 12:36:35 +02:00
|
|
|
|
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
|
2022-07-13 14:39:54 +02:00
|
|
|
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
|
|
|
|
|
2022-10-15 18:43:21 +02:00
|
|
|
exec dbus-run-session /usr/bin/sway
|
|
|
|
#dbus-launch --sh-syntax --exit-with-session /usr/bin/sway
|
|
|
|
#exec /usr/bin/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:
|
2021-09-22 16:42:22 +02:00
|
|
|
$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"
|
2022-12-06 08:18:20 +01:00
|
|
|
/sbin/makepkg -l y -c n "$OUTPUT/${PRGNAM}+wlroots-$(echo "${VERSION}+${WLROOTS_VERSION}" | tr - _)-$ARCH-$BUILD$TAG.txz"
|