# Compiles Lightning from source, for COPR (mizerd/lightning-matrix) or any # mock chroot: Fedora, and openSUSE Tumbleweed and Leap 16.0 (the # %%{?suse_version} branches; the build-rpm-opensuse CI job compiles this spec # on Leap 16.0). packaging-ci/scripts/build-copr-srpm.sh fills 0.10.1 and # 712ed6ddd16d53d33d0297f242592183f1b756a7. The release pipeline keeps using lightning.spec, which repacks a # staged tree; tests/test-copr-spec-parity.py keeps the two in step. %global commit 712ed6ddd16d53d33d0297f242592183f1b756a7 %global shortcommit %(c=%{commit}; echo ${c:0:12}) # No -debuginfo subpackage, as in the release RPM. %global debug_package %{nil} # Fedora turns on GCC LTO for C++; no release lane uses it, and on top of the # Rust fat-LTO link it raises the build's peak memory. %global _lto_cflags %{nil} # openSUSE's rpm-config does not define it. %{!?_metainfodir:%global _metainfodir %{_datadir}/metainfo} Name: lightning-matrix # Renamed from "lightning": Fedora's GNU Lightning (2.x) has that name. Obsoletes: lightning < 1.0 Version: 0.10.1 # %%buildtag is Copr's build id (".copr"), so a rebuild of the same # version still reaches users. Release: 1%{?dist}%{?buildtag} Summary: Native Matrix desktop client # Lightning is GPL-3.0-or-later. The statically linked Rust crates in Source1 # carry their own licences (mostly MIT OR Apache-2.0). License: GPL-3.0-or-later URL: https://gitlab.smetonis.net/Mizerd/lightning Source0: lightning-%{shortcommit}.tar.gz Source1: lightning-%{shortcommit}-vendor.tar.xz ExclusiveArch: x86_64 aarch64 %if 0%{?suse_version} # openSUSE names its packages differently and splits Qt per module, so the # build asks for what CMake looks up. Leap 16.0 ships Qt 6.9, GStreamer 1.26 # and Rust 1.98 (measured 2026-10-06); the build needs Qt >= 6.5. BuildRequires: cmake >= 3.21 BuildRequires: ninja BuildRequires: gcc-c++ BuildRequires: cargo BuildRequires: rust BuildRequires: pkgconfig BuildRequires: cmake(Qt6Core) >= 6.5 BuildRequires: cmake(Qt6DBus) BuildRequires: cmake(Qt6Gui) BuildRequires: cmake(Qt6LinguistTools) BuildRequires: cmake(Qt6Multimedia) BuildRequires: cmake(Qt6Network) BuildRequires: cmake(Qt6Qml) BuildRequires: cmake(Qt6Quick) BuildRequires: cmake(Qt6QuickControls2) BuildRequires: cmake(Qt6Sql) BuildRequires: cmake(Qt6Svg) BuildRequires: cmake(Qt6Widgets) BuildRequires: qt6-gui-private-devel # Not pkgconfig(openssl): LibreSSL provides that too, and zypper chose it on # Leap 16.0, whose headers CMake reads as OpenSSL 2.0.0 (measured). BuildRequires: libopenssl-devel >= 3.0 BuildRequires: pkgconfig(zlib) BuildRequires: pkgconfig(libsecret-1) BuildRequires: pkgconfig(gstreamer-1.0) BuildRequires: pkgconfig(gstreamer-app-1.0) BuildRequires: pkgconfig(gstreamer-rtp-1.0) BuildRequires: pkgconfig(gstreamer-sdp-1.0) BuildRequires: pkgconfig(gstreamer-video-1.0) BuildRequires: pkgconfig(gstreamer-webrtc-1.0) BuildRequires: desktop-file-utils BuildRequires: AppStream BuildRequires: binutils %else BuildRequires: cmake >= 3.21 BuildRequires: ninja-build BuildRequires: gcc-c++ BuildRequires: cargo BuildRequires: rust BuildRequires: pkgconf-pkg-config BuildRequires: qt6-qtbase-devel >= 6.5 BuildRequires: qt6-qtbase-private-devel BuildRequires: qt6-qtdeclarative-devel BuildRequires: qt6-qtmultimedia-devel BuildRequires: qt6-qtsvg-devel BuildRequires: qt6-qttools-devel BuildRequires: openssl-devel >= 3.0 BuildRequires: zlib-devel BuildRequires: libsecret-devel BuildRequires: gstreamer1-devel BuildRequires: gstreamer1-plugins-base-devel BuildRequires: gstreamer1-plugins-bad-free-devel BuildRequires: desktop-file-utils BuildRequires: appstream %endif # The runtime dependencies below are the release spec's, line for line (the # parity test compares them); see lightning.spec for why each is there. The # release spec also requires desktop-file-utils, for its %%post scriptlet # only; a repository install is covered by Fedora's file triggers. %global gst_element() gstreamer1(element-%1)()(%{__isa_bits}bit) Requires: %{gst_element webrtcbin} Requires: %{gst_element nicesrc} Requires: %{gst_element opusenc} Requires: %{gst_element vp8enc} Requires: %{gst_element autoaudiosrc} Requires: %{gst_element pipewiresrc} Recommends: libenchant-2.so.2()(%{__isa_bits}bit) %global qml_module() (qt6qml(%1) or qt6qmlimport(%1)) Requires: %{qml_module QtQuick} Requires: %{qml_module QtQuick.Controls} Requires: %{qml_module QtQuick.Controls.impl} Requires: %{qml_module QtQuick.Controls.Basic} Requires: %{qml_module QtQuick.Layouts} Requires: %{qml_module QtQuick.Effects} Requires: %{qml_module QtQuick.Dialogs} Requires: %{qml_module QtQuick.Window} Requires: %{qml_module QtQuick.Shapes} Requires: %{qml_module QtMultimedia} Requires: (qt6-qtimageformats or qt6-imageformats) Recommends: kf6-kimageformats # A colour emoji font (Fedora's name, then openSUSE's): without one a minimal # install draws emoji monochrome or as tofu. Recommends: (google-noto-color-emoji-fonts or noto-coloremoji-fonts) %description A native C++ and Qt Matrix desktop client with the Matrix Rust SDK backend. %prep %autosetup -n lightning-%{shortcommit} -a1 # CMake runs `cargo build --offline --locked`; point crates.io at the vendored # copy. Cargo finds this file from the build directory by walking up. mkdir -p .cargo cat >.cargo/config.toml <<'CARGO' [source.crates-io] replace-with = "vendored-sources" [source.vendored-sources] directory = "rust/vendor" [net] offline = true CARGO %build export CARGO_HOME="$PWD/.cargo" # The crate's release profile (fat LTO, one codegen unit) decides the Rust # code generation. Fedora's default RUSTFLAGS add -Cdebuginfo=2, which only # inflates that link while this package ships no debuginfo. export RUSTFLAGS="--cap-lints=warn --remap-path-prefix=$PWD=/usr/src/debug/%{name}" %if 0%{?suse_version} # openSUSE's %%cmake would comment out every set(CMAKE_BUILD_TYPE ...) in the # tree, pick Makefiles and differ from %%cmake_build's arguments, so CMake is # called directly, with openSUSE's compiler flags. The options from -G Ninja # on are the Fedora branch's, line for line (test-copr-spec-parity.py). cmake -S . -B build \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -DCMAKE_CXX_FLAGS="%{optflags}" \ -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_SKIP_INSTALL_RPATH=ON \ -DBUILD_TESTING=OFF \ -DLIGHTNING_DISABLE_CCACHE=ON \ -DENABLE_RUST_SDK_BACKEND=ON \ -DLIGHTNING_RUST_ONLY=ON \ -DLIGHTNING_ENABLE_WEBRTC=ON \ -DLIGHTNING_REQUIRE_WEBRTC=ON \ -DLIGHTNING_REQUIRE_QT_SVG=ON \ -DLIGHTNING_REQUIRE_GIF_KEYS=OFF \ -DLIGHTNING_ARTIFACT_KIND=release \ -DLIGHTNING_INSTALL_TYPE=linux-rpm-repo \ -DLIGHTNING_PORTABLE_QT_ABI=ON \ -DLIGHTNING_UPDATE_PUBKEY_2026A=pnNX0yQfhr66fpbMJ89MCNWkHVtfAr+WwI9c4OHzz50= \ -DLIGHTNING_SOURCE_SHA=%{commit} # Rust first, two crates at a time, as on Fedora (memory). export CARGO_BUILD_JOBS=2 cmake --build build %{?_smp_mflags} --target matrix-client-rust-build cmake --build build %{?_smp_mflags} %else # No install RPATH: qt_standard_project_setup() asks for $ORIGIN ones, which # configure-build.sh strips with patchelf for the release RPM. # linux-rpm-repo: dnf owns updates, so the in-app updater only points at it. # The portable Qt ABI keeps Qt private-ABI imports out, so a Fedora Qt minor # update does not have to wait for a rebuild here. %cmake \ -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_SKIP_INSTALL_RPATH=ON \ -DBUILD_TESTING=OFF \ -DLIGHTNING_DISABLE_CCACHE=ON \ -DENABLE_RUST_SDK_BACKEND=ON \ -DLIGHTNING_RUST_ONLY=ON \ -DLIGHTNING_ENABLE_WEBRTC=ON \ -DLIGHTNING_REQUIRE_WEBRTC=ON \ -DLIGHTNING_REQUIRE_QT_SVG=ON \ -DLIGHTNING_REQUIRE_GIF_KEYS=OFF \ -DLIGHTNING_ARTIFACT_KIND=release \ -DLIGHTNING_INSTALL_TYPE=linux-rpm-repo \ -DLIGHTNING_PORTABLE_QT_ABI=ON \ -DLIGHTNING_UPDATE_PUBKEY_2026A=pnNX0yQfhr66fpbMJ89MCNWkHVtfAr+WwI9c4OHzz50= \ -DLIGHTNING_SOURCE_SHA=%{commit} # CMake has cached Fedora's LDFLAGS for the C++ link by now. Cargo must not # see them: aws-lc-sys links a feature probe with LDFLAGS but without CFLAGS, # so redhat-hardened-ld asks for a PIE link of a non-PIE object and the probe # fails ("recompile with -fPIE"). unset LDFLAGS # Rust first, alone and two crates at a time. At four crates beside the C++ # compile the build passed the 8 GB of a standard Copr builder and was # OOM-killed compiling matrix-sdk. export CARGO_BUILD_JOBS=2 %cmake_build --target matrix-client-rust-build %cmake_build %endif %install %if 0%{?suse_version} # Stripped here: openSUSE runs no strip when there is no debuginfo package, # and unstripped the binary is 294 MB (measured on Leap 16.0). DESTDIR=%{buildroot} cmake --install build --strip %else %cmake_install %endif install -Dpm0644 packaging-ci/packaging/common/lightning.metainfo.xml \ %{buildroot}%{_metainfodir}/lightning.metainfo.xml %check if readelf -d %{buildroot}%{_bindir}/lightning-matrix %{buildroot}%{_bindir}/lightning-updater \ | grep -E 'RPATH|RUNPATH'; then exit 1; fi desktop-file-validate %{buildroot}%{_datadir}/applications/lightning.desktop appstreamcli validate --no-net %{buildroot}%{_metainfodir}/lightning.metainfo.xml # The same fail-closed assertions configure-build.sh makes on the staged binary. %{buildroot}%{_bindir}/lightning-matrix --version %{buildroot}%{_bindir}/lightning-matrix --build-info >build-info.txt cat build-info.txt grep -qx 'matrix_backend: rust' build-info.txt grep -qx 'http_backend_compiled: false' build-info.txt grep -qx 'mock_backend_compiled: false' build-info.txt timeout 60s %{buildroot}%{_bindir}/lightning-matrix --call-media-status >call-media.txt 2>&1 || : cat call-media.txt grep -qx 'call media engine built in: yes' call-media.txt # The portable Qt ABI, as validate-rpm.sh asserts on the release RPM: no Qt # private-ABI import, and the Qt version tag kept. objdump -T %{buildroot}%{_bindir}/lightning-matrix >dynsym.txt if grep -E '[(]Qt_[0-9._]*PRIVATE_API[)]' dynsym.txt; then exit 1; fi grep -qE '[(]Qt_6[.][0-9]+[)][[:space:]]+qt_version_tag$' dynsym.txt %files %license LICENSE %doc README.md %{_bindir}/lightning-matrix %{_bindir}/lightning-updater %{_datadir}/applications/lightning.desktop %{_datadir}/icons/hicolor/*/apps/lightning.png %{_datadir}/icons/hicolor/scalable/apps/lightning.svg %{_metainfodir}/lightning.metainfo.xml %changelog * Wed Sep 30 2026 Mizerd - 0.10.1-1 - Built from source %{commit}