#!/bin/bash # variables GITHUB_REPO=swaywm/sway VERSION=${VERSION:-"latest"} BUILD=9 TAG=gwh OUTPUT=/tmp TMP=/tmp/$TAG CWD=$(pwd) PRGNAM=$(basename "$CWD") PKG=$TMP/pkg-$PRGNAM ARCH=$(uname -m) REPOSITORY=/home/installs/SlackBuilds/_repositories/$PRGNAM PREFIX=/usr # nettoyage préalable rm -fr "$PKG" "${TMP:?}/$PRGNAM" mkdir -p "$PKG" # mise en place [ ! -e "$REPOSITORY" ] && git clone https://github.com/${GITHUB_REPO} "$REPOSITORY" cd "$REPOSITORY" || exit 1 git reset --hard HEAD git pull --all cp -R "$REPOSITORY" $TMP/ cd "$TMP/$PRGNAM/" || exit 1 case $VERSION in trunk) VERSION="git_$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)" ;; latest) VERSION=$(git describe --tags --abbrev=0) git checkout "$VERSION" ;; *) git checkout "$VERSION" ;; esac [ -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 for p in "$CWD"/patches/*.patch; do git am --show-current-patch=diff "$p" done # 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) git checkout "$WLROOTS_VERSION" ;; *) git checkout "$WLROOTS_VERSION" ;; esac cd "$TMP/$PRGNAM/" || exit 1 # Back to compiling sway… 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 \ build/ ninja -C build/ cd build/ || exit 1 meson install --destdir="$PKG" cd ../ # 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/" cat < "$PKG$PREFIX/bin/start_sway.sh" #!/bin/bash #set -e LOGFILE=~/.wsession-errors true > \$LOGFILE exec &> \$LOGFILE set -x echo "sway Starting: \$( date )" # Uncomment if mouse pointer is invisible #export WLR_NO_HARDWARE_CURSORS=1 unset QT_QPA_PLATFORM 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 export QT_QPA_PLATFORMTHEME=qt5ct export MOZ_ENABLE_WAYLAND=1 export XDG_CURRENT_DESKTOP=sway export XDG_PICTURES_DIR=~/.wallpapers export SWAYSOCK=/run/user/\$(id -u)/sway-ipc.\$(id -u).\$(pgrep -x sway).sock export XDG_RUNTIME_DIR=/tmp/xdg-runtime-\$(id -u) mkdir -p \$XDG_RUNTIME_DIR chmod 0700 \$XDG_RUNTIME_DIR # avoid wlr error unset DISPLAY exec dbus-run-session /usr/bin/sway #dbus-launch --sh-syntax --exit-with-session /usr/bin/sway #exec /usr/bin/sway EOF 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" mkdir -p "$PKG$PREFIX/doc/$PRGNAM" cp LICENSE ./*.md "$PKG$PREFIX/doc/$PRGNAM/" # correction cd "$PKG" || exit 1 chown -R root:root ./* [ -d "$PKG$PREFIX/man" ] && find "$PKG$PREFIX/man" -name "*.?" -type f -exec gzip -9 {} \; # embaumement mkdir -p "$PKG/install" cat < "$PKG/install/slack-desc" # 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} EOF # empaquetage rm -f "$PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la" /sbin/makepkg -l y -c n "$OUTPUT/${PRGNAM}+wlroots-$(echo "${VERSION}+${WLROOTS_VERSION}" | tr - _)-$ARCH-$BUILD$TAG.txz"