%bcond check 1 Name: mdcat Version: 2.15.0 Release: 1%{?dist} Summary: Render CommonMark Markdown to text terminals # Cumulative SPDX over mdcat and every statically-linked crate. License: ((Apache-2.0 OR MIT) AND BSD-3-Clause) AND ((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 BSL-1.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 AND (CC0-1.0 OR Apache-2.0) AND ISC AND MIT AND (MIT AND LPPL-1.3c) AND (MIT OR Apache-2.0) AND (MIT OR Apache-2.0 OR CC0-1.0) 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) # onig_sys (via syntect) compiles a bundled oniguruma unless # RUSTONIG_SYSTEM_LIBONIG (exported in %%build) forces the system library. BuildRequires: pkgconfig(oniguruma) # Renders mdcat.1.adoc into the man page. BuildRequires: asciidoctor # mdpick shells out to fzf and errors without it; the other entry points # don't need it, so a weak dependency suffices. Recommends: fzf %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; invoked as mdpick it fuzzy-picks a Markdown file with fzf and renders the selection. %prep %autosetup -n %{name}-%{name}-%{version} -p1 tar -xJf %{SOURCE1} %cargo_prep -v vendor %build export RUSTONIG_SYSTEM_LIBONIG=1 # 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 and mdpick are the same binary; invoked under those names it # paginates or fuzzy-picks by default. ln -s %{name} %{buildroot}%{_bindir}/mdless ln -s %{name} %{buildroot}%{_bindir}/mdpick install -Dpm0644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1 ln -s %{name}.1 %{buildroot}%{_mandir}/man1/mdless.1 ln -s %{name}.1 %{buildroot}%{_mandir}/man1/mdpick.1 # Completions are emitted by the freshly built binary (README "Packaging"); the # mdless/mdpick variants come from invoking the same binary under those names. ln -s %{name} target/rpm/mdless ln -s %{name} target/rpm/mdpick 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 target/rpm/mdpick --completions bash > %{buildroot}%{bash_completions_dir}/mdpick target/rpm/mdpick --completions zsh > %{buildroot}%{zsh_completions_dir}/_mdpick target/rpm/mdpick --completions fish > %{buildroot}%{fish_completions_dir}/mdpick.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 config.toml.example %{_bindir}/%{name} %{_bindir}/mdless %{_bindir}/mdpick %{_mandir}/man1/%{name}.1* %{_mandir}/man1/mdless.1* %{_mandir}/man1/mdpick.1* %{bash_completions_dir}/%{name} %{bash_completions_dir}/mdless %{bash_completions_dir}/mdpick %{zsh_completions_dir}/_%{name} %{zsh_completions_dir}/_mdless %{zsh_completions_dir}/_mdpick %{fish_completions_dir}/%{name}.fish %{fish_completions_dir}/mdless.fish %{fish_completions_dir}/mdpick.fish %changelog * Thu Aug 13 2026 Bahtiar `kalkin-` Gadimov - 2.15.0-1 - Update to 2.15.0 - Add the new mdpick alias (binary, man page, completions); Recommends: fzf - Link the system oniguruma for syntect's new onig backend - Regenerate the cumulative License string for the 2.15.0 crate tree - Ship config.toml.example; mdcat reads ~/.config/mdcat/config.toml since 2.12.0 * Mon Jun 29 2026 Bahtiar `kalkin-` Gadimov - 2.9.1-1 - Initial package