--- /dev/null
+#!/bin/bash
+
+set -e
+
+if [ "$(uname -m)" != "x86_64" ]; then
+ echo "64-bit OS is required for sucessfull LibreWolf build. You can use";
+ echo "immudex-sdk for build librewolf for 32-bit system. For 32-bit (--i386)";
+ echo "result of this script, you get binary archive with LibreWolf and"
+ echo "the .desktop file, for browser appearance in menu.";
+ exit 1;
+fi
+
+wget https://codeberg.org/librewolf/source/tags.rss
+ver=$(grep 'title' tags.rss | sed -n '2p' | sed -e 's,<title>,,g' -e 's,</title>,,g' -e 's,^[[:space:]]*,,g')
+sourceURL="https://gitlab.com/api/v4/projects/32320088/packages/generic/librewolf-source/${ver}/librewolf-${ver}.source.tar.gz";
+wget $sourceURL
+tar -xf $(basename $sourceURL)
+cd librewolf-${ver}
+curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
+sudo apt install pkg-config build-essential python3-pip python3-distutils -y
+export PATH=${PATH}:${HOME}/.cargo/bin;
+if [ "$1" ] && [ "$1" = "--i386" ]; then
+ rustup target add i686-unknown-linux-gnu
+ sed -i '22s/.*/ac_add_options --target=i686-linux-gnu/' mozconfig
+fi
+./mach --no-interactive bootstrap --application-choice=browser
+./lw/setup-wasi-linux.sh
+./mach build
+./mach package
+if [ "$1" ] && [ "$1" = "--i386" ]; then
+ cp obj-i686-pc-linux-gnu/dist/librewolf-${ver}.en-US.linux-i686.tar.bz2 $HOME;
+else
+ cp -vv obj-x86_64-pc-linux-gnu/dist/librewolf-${ver}.en-US.linux-$(uname -m).tar.bz2 ${HOME}/ftp/librewolf
+fi
+
+if [ $? -eq 0 ]; then
+ cd ..;
+ rm -rf librewolf-${ver};
+ rm $(basename $sourceURL);
+ rm tags.rss;
+fi