--- /dev/null
+#!/bin/bash
+
+# Slackware build script for element-desktop
+
+# Copyright 2025 Vladislav 'fsLeg' Borisov, Moscow, Russia
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=element-desktop
+WEBNAM=element-web
+VERSION=${VERSION:-1.11.108}
+BUILD=${BUILD:-1}
+TAG=${TAG:-fsleg}
+PKGTYPE=${PKGTYPE:-txz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" -o "$ARCH" = "i686" ]; then
+ echo
+ echo "*************************************************************"
+ echo "Element-desktop relies on Electron which doesn't support"
+ echo "x86 architecture anymore, therefore it can't be built on"
+ echo "an x86 system."
+ echo "*************************************************************"
+ echo
+ exit 1
+elif [ "$ARCH" = "x86_64" -o "$ARCH" = "aarch64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+RUST_PLATFORM=$(rustc -Vv | awk '/host/ {print $2}')
+
+export PATH="/opt/rust/bin:$PATH"
+if [ -z "$LD_LIBRARY_PATH" ]; then
+ export LD_LIBRARY_PATH="/opt/rust/lib$LIBDIRSUFFIX"
+else
+ export LD_LIBRARY_PATH="/opt/rust/lib$LIBDIRSUFFIX:$LD_LIBRARY_PATH"
+fi
+export CFLAGS="$SLKCFLAGS"
+export CXXFLAGS="$SLKCFLAGS"
+export npm_config_nodedir="/usr"
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION $WEBNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+tar xvf $CWD/$WEBNAM-$VERSION.tar.gz
+tar xvf $CWD/$PRGNAM-$VERSION-vendored-sources.tar
+
+cd $WEBNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+YARN_CACHE_FOLDER="$(pwd)/cache" \
+YARN_YARN_OFFLINE_MIRROR="$(pwd)/vendor" \
+yarn install --frozen-lockfile --ignore-engines --no-fund --update-checksums --offline
+sed -i 's|yarn |yarn --offline |g' package.json
+VERSION=$VERSION \
+YARN_CACHE_FOLDER="$(pwd)/cache" \
+npm_config_cache="$(pwd)/cache"
+ yarn --offline build
+
+cd ../$PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+export YARN_CACHE_FOLDER="$(pwd)/cache"
+export YARN_YARN_OFFLINE_MIRROR="$(pwd)/vendor"
+export npm_config_cache="$(pwd)/cache"
+export XDG_CACHE_HOME=$YARN_CACHE_FOLDER
+# https://gitlab.archlinux.org/archlinux/packaging/packages/element.io/-/blob/main/autolaunch.patch
+patch -p1 < $CWD/autolaunch.patch
+patch -p1 < $CWD/no-fetching-hak.patch
+sed -i 's|"target": "deb"|"target": "dir"|' package.json
+sed -i 's|"https://packages.element.io/desktop/update/"|null|' element.io/release/config.json
+mkdir -p deploys
+mv ../$WEBNAM-$VERSION/webapp deploys/element-v$VERSION
+yarn install --frozen-lockfile --ignore-engines --no-fund --update-checksums --offline
+sed -i 's|yarn |yarn --offline |g' package.json
+#sed -i 's|yarn \-\-offline run hak|yarn run hak|' package.json
+yarn --offline run fetch --noverify --cfgdir ""
+RUSTFLAGS="-C target-cpu=native" \
+CARGO_HOME="$TMP/$PRGNAM-$VERSION/.hak/matrix-seshat/$RUST_PLATFORM/build/.cargo" \
+YARN_YARN_OFFLINE_MIRROR="$TMP/$PRGNAM-$VERSION/.hak/matrix-seshat/$RUST_PLATFORM/build/yarn-vendor" \
+ yarn --offline run build:native
+# electron-builder fails if it can't upload the artifact to GitHub for which it requires a GitHub Token
+# all building is done by that point, so we just continue with packaging
+yarn --offline run build || true
+
+mkdir -p $PKG/usr/{bin,lib$LIBDIRSUFFIX,share/applications}
+mv dist/linux-unpacked $PKG/usr/lib$LIBDIRSUFFIX/element-desktop
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+install -Dm644 $CWD/element-desktop.desktop $PKG/usr/share/applications/io.element.Element.desktop
+install -Dm755 $CWD/element-desktop.sh $PKG/usr/bin/element-desktop
+sed -i "s|@LIBDIRSUFFIX@|$LIBDIRSUFFIX|" $PKG/usr/bin/element-desktop
+
+# 32x32 icon is missing for some reason
+magick build/icons/512x512.png -resize 32x32 build/icons/32x32.png
+for geometry in 16x16 24x24 32x32 48x48 64x64 96x96 128x128 256x256 512x512; do
+ mkdir -p $PKG/usr/share/icons/hicolor/$geometry/apps
+ install -Dm644 build/icons/$geometry.png $PKG/usr/share/icons/hicolor/$geometry/apps/$PRGNAM.png
+done
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a CHANGELOG.md CONTRIBUTING.md README.md LICENSE-* docs/* $PKG/usr/doc/$PRGNAM-$VERSION/
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE