# Maintainer: XZS # This PKGBUILD is maintained on GitHub . # You may find it convenient to file issues and pull requests there. pkgname=thunderbird-theme-tt-deepdark pkgver=11.0.4.1 pkgrel=1 pkgdesc='Smooth dark theme for Thunderbird' license=('custom:noncommercial') md5sums=('cfd2e3c6b0d05bb4ccc6b8d4bcff9644') [ "$arch" ] || arch=('any') source+=( "${pkgname}.zip::https://addons.mozilla.org/firefox/downloads/latest/${_extname=${pkgname#*-*-}}/platform:2/" ".version::https://services.addons.mozilla.org/firefox/api/1.5/addon/$_extname" ) [ ${url++} ] || url="https://addons.mozilla.org/${pkgname%%-*}/addon/$_extname/" md5sums+=('SKIP') noextract+=("${pkgname}.zip") makedepends+=(unzip) prepare() { unzip "${pkgname}.zip" rm ${pkgname}.zip } makedepends+=(rasqal) sparql() { roqet -e "PREFIX em: SELECT ?x WHERE { $1 }" \ -D "${2:-install.rdf}" -r csv 2>/dev/null | tr -d '\r' | tail -n 1 | head -c -1 } pkgver() { sparql ' em:version ?x' | tr - . } # Retrieve current compatibility information from addons.mozilla.org API. query-version() { xmllint .version --xpath \ "//application[appID='$2']/$1_version/text()" } version-range() { if [ -z "$(sparql "?x em:type ?type. filter(?type in ('2', '64'))")" ] || [ -n "$(sparql "?x em:strictCompatibility 'true'")" ] || { [ -e chrome.manifest ] && grep '^binary-component[ \t]' chrome.manifest ; } then local emid=$(emid $1) echo "$1>$(version min $emid)" "$1<$(version max $emid)" else echo "$1>$(version min $(emid $1))" fi } emid() { case $1 in firefox) echo '{ec8030f7-c20a-464f-9b0e-13a3a9e97384}' ;; thunderbird) echo '{3550f703-e582-4d05-9a08-453d09bdfdc6}' ;; *) return 1 ;; esac } version() { local version="$(query-version $1 $2)" if [[ $version =~ ([[:digit:]]+).\* ]]; then if [[ $1 = max ]]; then echo $(( ${BASH_REMATCH[1]} + 1 )) else echo "=${BASH_REMATCH[1]}" fi else echo "=$version" fi } prepare_target() { local target=${pkgname%%-*} id="$(sparql ' em:id ?x')" destdir="$pkgdir/usr/lib/${target/firefox/firefox\/browser}/extensions" install -d "$destdir" } depends=(${pkgname%%-*}) package() { compose_dependencies prepare_target cp --no-preserve=ownership,mode -r . "$destdir/$id" find "$destdir/$id" -mindepth 1 -name ".*" -exec rm -rf '{}' + } # Hidden from mksrcinfo in silly subfunction. compose_dependencies() { depends=($(version-range ${pkgname%%-*})) }