%define pypi_name youtube_dl %if 0%{?mageia} %define dist mgr8 %endif %if 0%{?fedora} || 0%{?suse_version} %define has_pandoc 1 %elif "%{_vendor}" != "openEuler" %define has_md2man 1 %endif %if 0%{!?mkrel:1} %define mkrel(c) %{1}%{?dist} %endif Name: youtube-dl Version: 2025.02.07 Release: %mkrel 1.2 Summary: Small command-line program to download videos from YouTube License: Public Domain Group: Video/Players URL: https://ytdl-org.github.io/youtube-dl/ # Done on the 2023.06.17 after bug https://github.com/ytdl-org/youtube-dl/issues/32314 is fixed # Memo: git archive --output=./master.tar.gz --format=tar.gz --prefix=ytdl-org-youtube-dl-a96a45b/ HEAD Source0: https://github.com/ytdl-org/ytdl-nightly/archive/refs/%{version}.tar.gz#/ytdl-nightly-%{version}.tar.gz #Source1: https://yt-dl.org/downloads/%%{version}/%%{name}-%%{version}.tar.gz.sig BuildArch: noarch BuildRequires: make BuildRequires: python3 BuildRequires: zip %if 0%{?has_pandoc} BuildRequires: pandoc %elif 0%{?has_md2man} BuildRequires: go-md2man %endif Requires: python3 # MGA#18464 - cclive crashes Obsoletes: cclive < 0.9.4 %description Small command-line program to download videos from YouTube. %prep %autosetup -n ytdl-nightly-%{version} %build %if 0%{?has_pandoc} # Make the generated man page correct in pandoc 3+ sed -i -e 's,= "2",-ge 2,' Makefile %else %if 0%{?has_md2man} # Generate the man page with go-md2man when pandoc isn't available sed -i -e 's|pandoc -s -f $(MARKDOWN) -t man youtube-dl.1.temp.md -o youtube-dl.1|go-md2man -in %{name}.1.temp.md -out %{name}.1|g' Makefile %endif # Continue to comment out pandoc when it's not generating the man page sed -i 's|pandoc |#pandoc |g' Makefile %endif %if 0%{!?python:1} %define python3 /bin/env python3 %endif %make_build PYTHON="%python3" %install # No pandoc available on mageia - Faking man page touch %{name}.1 %make_install PREFIX="%{_prefix}" MANDIR="%{_mandir}" # force the youtube-dl binary to use python 3 environment by default sed -i -e 's,#!/usr/bin/env python,#!/usr/bin/python3,' %{buildroot}%{_bindir}/%{name} #rm -rf %{buildroot}%{_prefix}/etc install -D -m 0644 LICENSE %{buildroot}%{_datadir}/doc/youtube_dl/LICENSE %files %license %{_datadir}/doc/youtube_dl/LICENSE %attr(0755,root,root) %{_bindir}/%{name} %{_sysconfdir}/bash_completion.d/ %{_sysconfdir}/fish/completions/youtube-dl.fish %{_datadir}/zsh/site-functions/_youtube-dl %{_mandir}/man1/%{name}.1.*