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"}
|
2024-05-07 21:52:57 +02:00
|
|
|
BUILD=15
|
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
|
2023-01-23 13:51:55 +01:00
|
|
|
|
2021-04-26 00:06:40 +02:00
|
|
|
PREFIX=/usr
|
2023-06-14 07:37:00 +02:00
|
|
|
MESONFLAGS=""
|
2021-04-26 00:06:40 +02:00
|
|
|
|
|
|
|
# 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)
|
2023-03-23 09:54:21 +01:00
|
|
|
# PKGVERSION="git_r$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
|
2023-03-22 16:56:02 +01:00
|
|
|
PKGVERSION="r$(git rev-list --count HEAD)_$(git log -1 --format=%h)"
|
2022-01-21 11:29:29 +01:00
|
|
|
;;
|
|
|
|
latest)
|
2024-01-11 14:48:15 +01:00
|
|
|
PKGVERSION=$(git tag --sort=-taggerdate | head -n1)
|
2023-03-07 11:25:59 +01:00
|
|
|
git checkout "$PKGVERSION"
|
2022-01-21 11:29:29 +01:00
|
|
|
;;
|
|
|
|
*)
|
2023-06-14 07:37:00 +02:00
|
|
|
PKGVERSION=$VERSION
|
|
|
|
MESONFLAGS="-Dc_args=\"-Wno-error=switch\""
|
2023-03-07 11:25:59 +01:00
|
|
|
git checkout "$PKGVERSION"
|
2022-01-21 11:29:29 +01:00
|
|
|
;;
|
|
|
|
esac
|
2023-03-07 11:25:59 +01:00
|
|
|
PKGNAM=${PRGNAM}
|
2021-06-15 15:15:18 +02:00
|
|
|
|
2023-03-07 13:05:02 +01:00
|
|
|
###########
|
|
|
|
# PATCHES #
|
|
|
|
###########
|
2022-11-12 22:20:23 +01:00
|
|
|
|
2023-03-07 11:25:59 +01:00
|
|
|
# Tray-menu patch
|
2024-05-07 21:52:57 +02:00
|
|
|
PATCH=${PATCH:-"yes"}
|
2024-05-06 10:57:10 +02:00
|
|
|
if [ "$PATCH" = "yes" ]; then
|
|
|
|
for p in "$CWD"/patches/*.patch; do
|
2024-05-07 13:38:20 +02:00
|
|
|
patch -p1 < "$p"
|
2024-05-06 10:57:10 +02:00
|
|
|
done
|
|
|
|
PKGVERSION="${PKGVERSION}_patched"
|
2023-03-07 11:25:59 +01:00
|
|
|
fi
|
|
|
|
|
2023-03-07 13:05:02 +01:00
|
|
|
######################
|
|
|
|
# EMBED DEPENDENCIES #
|
|
|
|
######################
|
|
|
|
# wlroots
|
2023-03-07 11:20:13 +01:00
|
|
|
EMBED_WLROOTS=${EMBED_WLROOTS:-"yes"}
|
|
|
|
if [ "$EMBED_WLROOTS" = "yes" ]; then
|
|
|
|
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)
|
2023-03-23 09:54:21 +01:00
|
|
|
# WLROOTS_VERSION="git_r$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
|
2023-03-22 16:56:02 +01:00
|
|
|
WLROOTS_VERSION="r$(git rev-list --count HEAD)_$(git log -1 --format=%h)"
|
2023-03-07 11:20:13 +01:00
|
|
|
;;
|
|
|
|
latest)
|
2024-01-11 14:48:15 +01:00
|
|
|
WLROOTS_VERSION=$(git tag --sort=-taggerdate | head -n1)
|
2023-03-07 11:20:13 +01:00
|
|
|
git checkout "$WLROOTS_VERSION"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
git checkout "$WLROOTS_VERSION"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
PKGNAM="${PKGNAM}+wlroots"
|
|
|
|
PKGVERSION="${PKGVERSION}+${WLROOTS_VERSION}"
|
|
|
|
fi
|
2023-02-21 13:02:25 +01:00
|
|
|
|
2023-03-07 13:05:02 +01:00
|
|
|
# libliftoff
|
2023-03-07 11:20:13 +01:00
|
|
|
EMBED_LIBLIFTOFF=${EMBED_LIBLIFTOFF:-"yes"}
|
|
|
|
if [ "$EMBED_LIBLIFTOFF" = "yes" ]; then
|
|
|
|
LIBLIFTOFF_VERSION=${LIBLIFTOFF_VERSION:-$VERSION}
|
|
|
|
LIBLIFTOFF_REPOSITORY=/home/installs/SlackBuilds/_repositories/libliftoff
|
|
|
|
[ ! -e "$LIBLIFTOFF_REPOSITORY" ] && git clone https://gitlab.freedesktop.org/emersion/libliftoff.git "$LIBLIFTOFF_REPOSITORY"
|
|
|
|
cd "$LIBLIFTOFF_REPOSITORY" || exit 1
|
|
|
|
git reset --hard HEAD
|
|
|
|
git pull --all
|
|
|
|
|
|
|
|
mkdir -p "$TMP/$PRGNAM"/subprojects/
|
|
|
|
cp -a "$LIBLIFTOFF_REPOSITORY" "$TMP/$PRGNAM"/subprojects/libliftoff
|
|
|
|
cd "$TMP/$PRGNAM"/subprojects/libliftoff || exit 1
|
|
|
|
case $LIBLIFTOFF_VERSION in
|
|
|
|
trunk)
|
2023-03-23 09:54:21 +01:00
|
|
|
# LIBLIFTOFF_VERSION="git_r$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
|
2023-03-22 16:56:02 +01:00
|
|
|
LIBLIFTOFF_VERSION="r$(git rev-list --count HEAD)_$(git log -1 --format=%h)"
|
2023-03-07 11:20:13 +01:00
|
|
|
;;
|
|
|
|
latest)
|
2024-01-11 14:48:15 +01:00
|
|
|
LIBLIFTOFF_VERSION=$(git tag --sort=-taggerdate | head -n1)
|
2023-03-07 11:20:13 +01:00
|
|
|
git checkout "$LIBLIFTOFF_VERSION"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
git checkout "$LIBLIFTOFF_VERSION"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
PKGNAM="${PKGNAM}+libliftoff"
|
|
|
|
PKGVERSION="${PKGVERSION}+${LIBLIFTOFF_VERSION}"
|
|
|
|
fi
|
|
|
|
|
2023-03-07 13:05:02 +01:00
|
|
|
# libdisplay-info
|
2023-03-07 11:20:13 +01:00
|
|
|
EMBED_LIBDISPLAYINFO=${EMBED_LIBDISPLAYINFO:-"yes"}
|
|
|
|
if [ "$EMBED_LIBDISPLAYINFO" = "yes" ]; then
|
|
|
|
LIBDISPLAYINFO_VERSION=${LIBDISPLAYINFO_VERSION:-$VERSION}
|
|
|
|
LIBDISPLAYINFO_REPOSITORY=/home/installs/SlackBuilds/_repositories/libdisplay-info
|
|
|
|
[ ! -e "$LIBDISPLAYINFO_REPOSITORY" ] && git clone https://gitlab.freedesktop.org/emersion/libdisplay-info.git "$LIBDISPLAYINFO_REPOSITORY"
|
|
|
|
cd "$LIBDISPLAYINFO_REPOSITORY" || exit 1
|
|
|
|
git reset --hard HEAD
|
|
|
|
git pull --all
|
|
|
|
|
|
|
|
mkdir -p "$TMP/$PRGNAM"/subprojects/
|
|
|
|
cp -a "$LIBDISPLAYINFO_REPOSITORY" "$TMP/$PRGNAM"/subprojects/libdisplay-info
|
|
|
|
cd "$TMP/$PRGNAM"/subprojects/libdisplay-info || exit 1
|
|
|
|
case $LIBDISPLAYINFO_VERSION in
|
|
|
|
trunk)
|
2023-03-23 09:54:21 +01:00
|
|
|
# LIBDISPLAYINFO_VERSION="git_r$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)"
|
2023-03-22 16:56:02 +01:00
|
|
|
LIBDISPLAYINFO_VERSION="r$(git rev-list --count HEAD)_$(git log -1 --format=%h)"
|
2023-03-07 11:20:13 +01:00
|
|
|
;;
|
|
|
|
latest)
|
2024-01-11 14:48:15 +01:00
|
|
|
LIBDISPLAYINFO_VERSION=$(git tag --sort=-taggerdate | head -n1)
|
2023-03-07 11:20:13 +01:00
|
|
|
git checkout "$LIBDISPLAYINFO_VERSION"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
git checkout "$LIBDISPLAYINFO_VERSION"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
PKGNAM="${PKGNAM}+libdisplay_info"
|
|
|
|
PKGVERSION="${PKGVERSION}+${LIBDISPLAYINFO_VERSION}"
|
|
|
|
fi
|
2022-12-02 16:30:04 +01:00
|
|
|
|
2023-03-07 11:25:59 +01:00
|
|
|
|
2022-12-02 16:30:04 +01:00
|
|
|
# Back to compiling sway…
|
2023-02-21 13:02:25 +01:00
|
|
|
cd "$TMP/$PRGNAM/" || exit 1
|
|
|
|
|
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 \
|
2023-06-14 07:37:00 +02:00
|
|
|
"$MESONFLAGS" \
|
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 ../
|
|
|
|
|
2023-03-07 13:05:02 +01:00
|
|
|
mkdir -p "$PKG$PREFIX/doc/$PRGNAM"
|
|
|
|
cp LICENSE ./*.md "$PKG$PREFIX/doc/$PRGNAM/"
|
2022-12-06 16:47:11 +01:00
|
|
|
|
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
|
|
|
|
|
2024-03-03 11:49:01 +01:00
|
|
|
# LOGFILE=~/.wsession-errors
|
|
|
|
# true > \$LOGFILE
|
|
|
|
# exec &> \$LOGFILE
|
2022-10-06 13:19:26 +02:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2024-05-07 13:38:20 +02:00
|
|
|
|
|
|
|
# vulklan seems buggy with Intel IGP
|
|
|
|
if \$(lsmod | grep -q "^i915.*$"); then
|
|
|
|
export WLR_RENDERER=gles2
|
|
|
|
else
|
|
|
|
export WLR_RENDERER=vulkan
|
|
|
|
fi
|
|
|
|
|
2023-01-01 11:26:21 +01:00
|
|
|
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
|
|
|
|
|
2023-09-21 16:17:00 +02:00
|
|
|
killall daemon
|
|
|
|
|
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"
|
|
|
|
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
|
|
|
|
2023-03-07 13:05:02 +01:00
|
|
|
###############
|
|
|
|
# corrections #
|
|
|
|
###############
|
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
|
|
|
|
2023-03-07 13:05:02 +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/"
|
|
|
|
|
|
|
|
####################
|
|
|
|
# Actual packaging #
|
|
|
|
####################
|
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"
|
2023-08-16 12:23:26 +02:00
|
|
|
/sbin/makepkg --linkadd y --chown n --prepend "$OUTPUT/${PKGNAM}-$(echo "$PKGVERSION" | tr - _)-$ARCH-$BUILD$TAG.txz"
|