# Template file for 'adobe-flash-plugin'
pkgname=adobe-flash-plugin
version=32.0.0.465
revision=1
depends="curl hicolor-icon-theme desktop-file-utils"
short_desc="Adobe Flash Player plugin for Netscape compatible browsers"
maintainer="mkf <makefile@riseup.net>"
license="custom:Adobe License (non free)"
homepage="https://www.adobe.com"
repository="nonfree"

restricted=yes
create_wrksrc=yes
archs="i686 x86_64"
nopie=yes

# The EULA file
_eula="https://www.adobe.com/content/dam/Adobe/en/legal/licenses-terms/pdf/PlatformClients_PC_WWEULA-en_US-20150407_1357.pdf"
_eulacksum=5a0a95eb4082b6db7182188ce119f3829184b238b0a91293322c2a51a2b41fc1
_url=https://fpdownload.adobe.com/pub/flashplayer/pdc/${version}
if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
	distfiles="
	 ${_url}/flash_player_npapi_linux.x86_64.tar.gz
	 ${_url}/flash_player_ppapi_linux.x86_64.tar.gz"
	checksum="
	 a90f2edb98231896331c61a81017f390e180015f90193865e3295319cf636c35
	 99fcc780897be55bac7d11c0204ba7a3d5e7dc1f1aed75d5e7b5ad28c0b2ff5d"
else
	distfiles="
	 ${_url}/flash_player_npapi_linux.i386.tar.gz
	 ${_url}/flash_player_ppapi_linux.i386.tar.gz"
	checksum="
	 27b7210d09514d661c34752d29cbc0b6c09968b8d197d21fedc14fd3c49a0bd6
	 d32ad3eb24f22cd11cb83910a72880c98f69ea1ec0f3ce6beb31812e166f0f62"
fi
distfiles+=" ${_eula}"
checksum+=" ${_eulacksum}"
skip_extraction="${_eula##*/}"

do_install() {
	vinstall libflashplayer.so 755 usr/lib/mozilla/plugins
	#vinstall usr/lib/kde4/kcm_adobe_flash_player.so 755 usr/lib/kde4
	vbin usr/bin/flash-player-properties
	for i in 16x16 22x22 24x24 32x32 48x48; do
		vinstall usr/share/icons/hicolor/${i}/apps/flash-player-properties.png \
		644 usr/share/icons/hicolor/${i}/apps
	done
	vinstall usr/share/applications/flash-player-properties.desktop 644 \
		usr/share/applications
	vinstall usr/share/kde4/services/kcm_adobe_flash_player.desktop 644 \
		usr/share/kde4/services
	vlicense "${XBPS_SRCDISTDIR}/${pkgname}-${version}/${_eula##*/}" LICENSE.pdf
}

adobe-flash-plugin-ppapi_package() {
	short_desc="Adobe Flash Player plugin for Chromium-based browsers"
	pkg_install() {
		vinstall libpepflashplayer.so 755 usr/lib/chromium/PepperFlash
		vinstall manifest.json 644 usr/lib/chromium/PepperFlash
		vinstall ${FILESDIR}/flash-plugin-ppapi.sh 644 etc/profile.d
		vsed -e "s/@VERSION@/${version}/g" -i ${PKGDESTDIR}/etc/profile.d/flash-plugin-ppapi.sh
		vlicense "${XBPS_SRCDISTDIR}/${sourcepkg}-${version}/${_eula##*/}" LICENSE.pdf
	}
}
