Name: stoat Version: %{lua: local f = io.popen("curl -s https://raw.githubusercontent.com/stoatchat/for-desktop/main/package.json | grep '\"version\"' | head -n1 | sed 's/.*\"version\": \"\\([^\"]*\\)\".*/\\1/'") local v = f:read("*a") or "" f:close() v = v:gsub("%s+", "") print(v) } Release: 1%{?dist} Summary: Stoat — official Stoat desktop client License: AGPL-3.0 URL: https://github.com/stoatchat/for-desktop Source0: https://codeload.github.com/stoatchat/for-desktop/tar.gz/refs/heads/main BuildRequires: nodejs >= 18 BuildRequires: pnpm BuildRequires: git BuildRequires: desktop-file-utils Requires: gtk3 Requires: libXScrnSaver Requires: libnotify %description Stoat is the official Electron-based desktop client for the Stoat chat platform. %prep rm -rf stoat git clone --depth 1 --recursive https://github.com/stoatchat/for-desktop.git stoat cd stoat git -c submodule."assets".update=checkout submodule update --init assets %build cd %{_builddir}/stoat pnpm i --frozen-lockfile pnpm package %install # Directories mkdir -p %{buildroot}%{_bindir} mkdir -p %{buildroot}%{_datadir}/applications mkdir -p %{buildroot}%{_datadir}/icons/hicolor/256x256/apps mkdir -p %{buildroot}%{_datadir}/stoat mkdir -p %{buildroot}%{_docdir}/stoat mkdir -p %{buildroot}/usr/share/licenses/stoat/ # Install binary install -Dm755 %{_builddir}/stoat/out/Stoat-linux-x64/stoat-desktop %{buildroot}%{_bindir}/stoat # Copy all Electron resources and libraries to /usr/share/stoat cp -a %{_builddir}/stoat/out/Stoat-linux-x64/* %{buildroot}%{_datadir}/stoat/ chmod 755 %{buildroot}%{_datadir}/stoat/chrome-sandbox # .desktop file sets LD_LIBRARY_PATH so Stoat finds its .so files cat > %{buildroot}%{_datadir}/applications/stoat.desktop << "EOF" [Desktop Entry] Name=Stoat Comment=Stoat — official desktop client Exec=env LD_LIBRARY_PATH=/usr/share/stoat /usr/bin/stoat Icon=stoat Terminal=false Type=Application Categories=Network;Chat; StartupWMClass=Stoat EOF # Fetch README.md and LICENSE curl -sL https://raw.githubusercontent.com/stoatchat/for-desktop/main/README.md \ -o %{buildroot}/usr/share/doc/stoat/README.md curl -sL https://raw.githubusercontent.com/stoatchat/for-desktop/main/LICENSE \ -o %{buildroot}/usr/share/licenses/stoat/LICENSE %files %license /usr/share/licenses/stoat/LICENSE %doc %{_docdir}/stoat/README.md %{_bindir}/stoat %{_datadir}/applications/stoat.desktop %{_datadir}/stoat/* %changelog * Sat Nov 09 2024 Copr Auto Build - Bundled all Electron libraries and resources into /usr/share/stoat - No wrapper script or patchelf needed - Automated build from latest upstream master