# Template file for 'youtube-dl'
pkgname=youtube-dl
version=2017.09.24
revision=1
noarch=yes
wrksrc="${pkgname}"
build_style=python-module
pycompile_module="youtube_dl"
hostmakedepends="python python3"
depends="python"
short_desc="CLI program to download videos from YouTube and other sites (Python2)"
#changelog="https://raw.githubusercontent.com/rg3/youtube-dl/master/ChangeLog"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="http://rg3.github.com/youtube-dl/"
license="Public Domain"
distfiles="https://yt-dl.org/downloads/${version}/${pkgname}-${version}.tar.gz"
checksum=7d7140ce63377e84a2072b4922809c7a2e90e3916cde2f4f1cc8860664395548
alternatives="youtube-dl:youtube-dl:/usr/bin/youtube-dl2"

post_install() {
	rm -rf ${DESTDIR}/usr/etc
	vinstall ${pkgname}.bash-completion 644 usr/share/bash-completion/completions ${pkgname}
	vinstall ${pkgname}.zsh 644 usr/share/zsh/site-functions _${pkgname}
	vinstall ${pkgname}.fish 644 usr/share/fish/completions ${pkgname}
}

python3-youtube-dl_package() {
	noarch=yes
	depends="python3"
	pycompile_module="youtube_dl"
	replaces="python3.4-youtube-dl>=0"
	alternatives="youtube-dl:youtube-dl:/usr/bin/youtube-dl3"
	short_desc="${short_desc/2/3}"
	pkg_install() {
		vmove usr/bin/youtube-dl3
		vmove usr/lib/python3*
	}
}

python3.4-youtube-dl_package() {
	noarch=yes
	build_style=meta
	short_desc="${short_desc/2/3.4} (transitional dummy package)"
	depends="python3-youtube-dl>=${version}_${revision}"
}
