# Generated using the scripts at https://forge.fedoraproject.org/cosmic/cosmic-packaging/src/branch/main/scripts ExcludeArch: %{ix86} # Generated by rust2rpm 26 %bcond_without check %global crate cosmic-viewer # cosmic-packaging: Nightly build processed from tagged version at https://src.fedoraproject.org/rpms/cosmic-viewer.git %global commit 77ba62deb7027217efab1999e90670f3c89c5a02 %global shortcommit %{sub %{commit} 1 7} %global commitdatestring 2026-10-07 12:29:42 -0400 %global commitdate 20261007 %global builddate 202610092153 %global cosmic_minver 1.10.0 Name: cosmic-viewer Version: 1.10.0^git%{commitdate}.%{shortcommit} Release: %autorelease Summary: Image viewer for the COSMIC Desktop License: (0BSD OR MIT OR Apache-2.0) AND (Apache-2.0 AND MIT) AND (Apache-2.0 OR GPL-2.0-only) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND (BSD-3-Clause OR Apache-2.0) AND (BSD-3-Clause OR MIT) AND (BSD-3-Clause OR MIT OR Apache-2.0) AND (CC0-1.0 OR Apache-2.0) AND (MIT OR Apache-2.0) AND (MIT OR Apache-2.0 OR LGPL-2.1-or-later) AND (MIT OR Apache-2.0 OR Zlib) AND (MIT OR LGPL-3.0-or-later) AND (MIT OR Zlib OR Apache-2.0) AND (Unlicense OR MIT) AND (Zlib OR Apache-2.0 OR MIT) AND Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSL-1.0 AND CC0-1.0 AND GPL-3.0-only AND IJG AND ISC AND MIT AND MPL-2.0 AND NCSA AND Unicode-3.0 AND Unlicense AND Zlib URL: https://github.com/pop-os/cosmic-viewer Source0: https://github.com/pop-os/cosmic-viewer/archive/%{commit}/cosmic-viewer-%{shortcommit}.tar.gz # To create the below sources: # * git clone https://github.com/pop-os/cosmic-viewer at the specified commit # * cargo vendor > vendor-config-%%{shortcommit}.toml # * strip executable bits from vendored files (some crates ship +x files, # which break %install's brp-mangle-shebangs) # find vendor ! -type d -perm /111 -exec chmod a-x {} + # * tar -pczf vendor-%%{shortcommit}.tar.gz vendor Source1: vendor-%{shortcommit}.tar.gz # * mv vendor-config-%%{shortcommit}.toml .. Source2: vendor-config-%{shortcommit}.toml # Use the system libheif instead of building the bundled copy from source, # so HEIF/HEIC decoding works through the codecs (incl. the ffmpeg plugin) # the distribution provides. Patch: 0001-Use-system-libheif-instead-of-bundled-copy.patch # Fix desktop-file-validate errors: unregistered categories and a desktop # action group without a matching DesktopAction key Patch: 0002-Fix-desktop-file-validation-errors.patch BuildRequires: cargo-rpm-macros >= 26 BuildRequires: rustc BuildRequires: lld BuildRequires: cargo BuildRequires: just # Building the bundled libjpeg-turbo (via turbojpeg-sys) needs a C toolchain, # nasm for the SIMD code, and cmake (3.5+ policy shim for CMake 4.x) BuildRequires: gcc BuildRequires: make BuildRequires: nasm BuildRequires: cmake BuildRequires: libheif-devel BuildRequires: wayland-devel BuildRequires: libxkbcommon-devel BuildRequires: mesa-libEGL-devel BuildRequires: mesa-libgbm-devel BuildRequires: desktop-file-utils Requires: cosmic-icon-theme >= %{cosmic_minver} # libheif HEVC plugin (ffmpeg), needed to decode HEIF/HEIC images Requires: libheif-ffmpeg %global _description %{expand: %{summary}.} %description %{_description} %prep %autosetup -n %{crate}-%{commit} -p1 -a1 %cargo_prep -N # Append the vendored dependencies configuration to .cargo/config.toml cat %{SOURCE2} >> .cargo/config.toml echo "Appended %{SOURCE2} to .cargo/config.toml" %build # The bundled libjpeg-turbo 3.1.0 used by turbojpeg-sys declares # cmake_minimum_required(2.8.12...3.28), which CMake 4.x refuses to # configure without a policy version shim export CMAKE_POLICY_VERSION_MINIMUM=3.5 # Set vergen environment variables export VERGEN_GIT_COMMIT_DATE="date --utc '%{commitdatestring}'" export VERGEN_GIT_SHA="%{commit}" just build-release --offline --frozen %{cargo_license_summary} %{cargo_license} > LICENSE.dependencies %{cargo_vendor_manifest} %install # Set vergen environment variables export VERGEN_GIT_COMMIT_DATE="date --utc '%{commitdatestring}'" export VERGEN_GIT_SHA="%{commit}" just rootdir=%{buildroot} prefix=%{_prefix} install %check desktop-file-validate %{buildroot}%{_datadir}/applications/com.system76.CosmicViewer.desktop %if %{with check} # Set vergen environment variables export VERGEN_GIT_COMMIT_DATE="date --utc '%{commitdatestring}'" export VERGEN_GIT_SHA="%{commit}" %cargo_test %endif %files %license LICENSE %license LICENSE.dependencies %license cargo-vendor.txt %doc README.md %{_bindir}/cosmic-viewer %{_datadir}/applications/com.system76.CosmicViewer.desktop %{_metainfodir}/com.system76.CosmicViewer.metainfo.xml %{_datadir}/icons/hicolor/*/apps/com.system76.CosmicViewer.svg %changelog %autochangelog