# Template file for 'chromium-pepper-flash'
pkgname=chromium-pepper-flash
version=18.0.0.204
_chromeVersion=43.0.2357.132-1
_channel='stable'
_baseUrl='http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable'
revision=1
short_desc="Pepper Flash plugin for Chromium"
maintainer="Enno Boland <eb@s01.de>"
homepage="http://www.google.com/chrome"
license="chrome"
lib32disabled=yes
repository=nonfree
only_for_archs="i686 x86_64"
depends="chromium binutils xz"
create_wrksrc=yes

case "${XBPS_TARGET_MACHINE}" in
x86_64)
	_filename=google-chrome-${_channel}_${_chromeVersion}_amd64.deb
	_chromeChecksum="bf2d3e3f2d329ca081fbe012f2d8bc8db09cc78bd75988afed759475343a19aa"
	;;
i686)
	_filename=google-chrome-${_channel}_${_chromeVersion}_i386.deb
	_chromeChecksum="f6c08da31922530d0415e4acde06b0e24f16bd45b8990d0359659b8661efd7bd"
	;;
esac
_chromeUrl="${_baseUrl}/${_filename}"
distfiles="${_chromeUrl}"
checksum="$_chromeChecksum"

skip_extraction="$_filename"

do_fetch() {
	mkdir -p $wrksrc
	cd $wrksrc
	xbps-uhelper fetch $distfiles
	echo "$checksum  $_filename" | sha256sum -c || { sha256sum "$_filename"; return 1; }
}
do_extract() {
	:
}
do_build() {
	sed \
		-e "s|%VERSION%|${version}|" \
			${FILESDIR}/chromium-pepper-flash.sh.in > chromium-pepper-flash.sh
	sed \
		-e "s|%CHROME_URL%|${_chromeUrl}|" \
		-e "s|%CHROME_CHECKSUM%|${_chromeChecksum}|" \
			${FILESDIR}/chromium-pepper-vars.sh.in > chromium-pepper-vars.sh
}

do_install() {
	vmkdir "usr/lib/chromium-pepper-flash"
	vcopy chromium-pepper-vars.sh "usr/lib/chromium-pepper-flash"

	vinstall "${FILESDIR}/LICENSE" 644 "usr/share/licenses/chromium-pepper-flash"

	vmkdir "etc/profile.d"
	vinstall "chromium-pepper-flash.sh" 644 "etc/profile.d"
}
