%bcond check 1 Name: mdcat Version: 2.9.1 Release: 1%{?dist} Summary: Render CommonMark Markdown to text terminals # Cumulative SPDX over mdcat and every statically-linked crate. License: (MIT OR Apache-2.0) AND NCSA AND ((MIT OR Apache-2.0) AND Unicode-3.0) AND (0BSD OR MIT OR Apache-2.0) AND Apache-2.0 AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND BSD-2-Clause AND (BSD-2-Clause OR Apache-2.0 OR MIT) AND BSD-3-Clause AND (BSD-3-Clause OR Apache-2.0) AND (CC0-1.0 OR Apache-2.0) AND MIT AND (MIT AND LPPL-1.3c) AND (MIT OR Apache-2.0 OR LGPL-2.1-or-later) AND (MIT OR Apache-2.0 OR Zlib) AND (MIT OR Zlib OR Apache-2.0) AND MPL-2.0 AND (MPL-2.0 AND Apache-2.0) AND Unicode-3.0 AND (Unlicense OR MIT) AND Zlib AND (Zlib OR Apache-2.0 OR MIT) URL: https://github.com/BIRSAx2/mdcat # GitHub names the tag mdcat-%%{version}, so the archive top dir is mdcat-mdcat-%%{version}. Source0: %{url}/archive/refs/tags/%{name}-%{version}/%{name}-%{version}.tar.gz Source1: %{name}-%{version}-vendor.tar.xz ExclusiveArch: %{rust_arches} BuildRequires: cargo-rpm-macros >= 24 # Vendoring turns off %%cargo_generate_buildrequires, so add the native libs the # *-sys crates link by hand: curl-sys/openssl-sys/libz-sys all resolve via # pkg-config and link the system libraries (no bundled C build). BuildRequires: gcc BuildRequires: pkgconfig(libcurl) BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(zlib) # Renders mdcat.1.adoc into the man page. BuildRequires: asciidoctor %description mdcat renders CommonMark Markdown files to text terminals with sophisticated formatting: syntax highlighting in code blocks, inline links, and even inline images on terminals that support them. Invoked as mdless it paginates its output through a pager. %prep %autosetup -n %{name}-%{name}-%{version} -p1 tar -xJf %{SOURCE1} %cargo_prep -v vendor %build # Build only the mdcat binary; the workspace also holds the pulldown-cmark-mdcat # library, which is a dependency rather than a shipped artifact. %cargo_build -- -p %{name} %{cargo_vendor_manifest} asciidoctor -b manpage -a reproducible -o %{name}.1 %{name}.1.adoc %install install -Dpm0755 target/rpm/%{name} %{buildroot}%{_bindir}/%{name} # mdless is the same binary; invoked under that name it paginates by default. ln -s %{name} %{buildroot}%{_bindir}/mdless install -Dpm0644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1 ln -s %{name}.1 %{buildroot}%{_mandir}/man1/mdless.1 # Completions are emitted by the freshly built binary (README "Packaging"); the # mdless variants come from invoking the same binary under the mdless name. ln -s %{name} target/rpm/mdless install -d %{buildroot}%{bash_completions_dir} \ %{buildroot}%{zsh_completions_dir} \ %{buildroot}%{fish_completions_dir} target/rpm/%{name} --completions bash > %{buildroot}%{bash_completions_dir}/%{name} target/rpm/%{name} --completions zsh > %{buildroot}%{zsh_completions_dir}/_%{name} target/rpm/%{name} --completions fish > %{buildroot}%{fish_completions_dir}/%{name}.fish target/rpm/mdless --completions bash > %{buildroot}%{bash_completions_dir}/mdless target/rpm/mdless --completions zsh > %{buildroot}%{zsh_completions_dir}/_mdless target/rpm/mdless --completions fish > %{buildroot}%{fish_completions_dir}/mdless.fish %check %if %{with check} # The integration suite renders snapshot fixtures against a cargo dev layout, so # smoke-test the installed binary instead. %{buildroot}%{_bindir}/%{name} --version %endif %files %license LICENSE %license cargo-vendor.txt %doc README.md CHANGELOG.md %{_bindir}/%{name} %{_bindir}/mdless %{_mandir}/man1/%{name}.1* %{_mandir}/man1/mdless.1* %{bash_completions_dir}/%{name} %{bash_completions_dir}/mdless %{zsh_completions_dir}/_%{name} %{zsh_completions_dir}/_mdless %{fish_completions_dir}/%{name}.fish %{fish_completions_dir}/mdless.fish %changelog * Mon Jun 29 2026 Bahtiar `kalkin-` Gadimov - 2.9.1-1 - Initial package