summaryrefslogtreecommitdiff
path: root/libre/icedove-l10n/PKGBUILD
blob: 5cd5e791177d9709933313b9c546543ffb4a744a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Maintainer (arch): Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer (arch): Jan de Groot <jgc@archlinux.org>
# Contributor (arch): Andrea Scarpino <andrea@archlinux.org>
# Contributor (arch): Thomas Baechler <thomas@archlinux.org>
# Maintainer: Andreas Grapentin <andreas@grapentin.org>
# Contributor: André Silva <emulatorman@hyperbola.info>
# Contributor: Márcio Silva <coadde@hyperbola.info>
# Contributor: bill-auger <bill-auger@programmer.net>


# parabola changes and rationale:
#  - rebranded to icedove
#  - added replaces, conflicts: thunderbird-i18n-*
#  - incorperate iceowl


_pkgbase=icedove
pkgbase=${_pkgbase}-l10n
epoch=1
_pkgver_armv7h=68.6.0
_pkgver_i686=68.9.0
_pkgver_x86_64=68.9.0
_pkgrel_armv7h=1
_pkgrel_i686=1
_pkgrel_x86_64=1
eval "pkgver=\$_pkgver_${CARCH}" # this is actually an 'any' package
eval "pkgrel=\$_pkgrel_${CARCH}" # but our different arches do not always roll at the same speed
# https://developer.mozilla.org/en-US/docs/Mozilla/Calendar/Calendar_Versions
_calbase=iceowl
_calver=$pkgver
pkgdesc="Language pack for ${_pkgbase^} and ${_calbase}."
arch=('armv7h' 'i686' 'x86_64')
url="https://wiki.parabola.nu/icedove"
license=('MPL' 'GPL')
makedepends=('unzip' 'zip')

_src_url=https://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/${pkgver}/linux-x86_64/xpi

pkgname=()
source=(brand.dtd
        brand.properties
        region.properties
        languages.${CARCH}
        sha512sums.${CARCH})

_languages_x86_64_shasum="8c60f7ce41e9c3db79716746932c506cdda6fff5cba6f47885222bd89a97c04dabb9c2134e68703967432e8cda2ec726838568d0f173df258ecf36ec0c431e48"
_languages_i686_shasum="8c60f7ce41e9c3db79716746932c506cdda6fff5cba6f47885222bd89a97c04dabb9c2134e68703967432e8cda2ec726838568d0f173df258ecf36ec0c431e48"
_languages_armv7h_shasum="8c60f7ce41e9c3db79716746932c506cdda6fff5cba6f47885222bd89a97c04dabb9c2134e68703967432e8cda2ec726838568d0f173df258ecf36ec0c431e48"
_languages_list_shasum="_languages_${CARCH}_shasum"

_sha512sums_x86_64_shasum="0cde0eabb54642aa00dae4362bca31d9686103049b74c2859c1f7deb105c886d7134f62b8de9f11272567618bc3049c32e162b8b3eeec0037fc370ad60678e74"
_sha512sums_i686_shasum="0cde0eabb54642aa00dae4362bca31d9686103049b74c2859c1f7deb105c886d7134f62b8de9f11272567618bc3049c32e162b8b3eeec0037fc370ad60678e74"
_sha512sums_armv7h_shasum="0cde0eabb54642aa00dae4362bca31d9686103049b74c2859c1f7deb105c886d7134f62b8de9f11272567618bc3049c32e162b8b3eeec0037fc370ad60678e74"
_sha512sums_list_shasum="_sha512sums_${CARCH}_shasum"

# parse locales and package names from language list files
# NOTE: there is currently no localization for Iceowl:
#       https://bugzilla.mozilla.org/show_bug.cgi?id=1469678
#       might be temporarily fixable through this:
#       https://gist.github.com/progandy/ce857358c4f3b8eb09887a085e4bea30
source languages.${CARCH} # sets $_languages
source sha512sums.${CARCH} # sets $_sha512sums
for _lang in "${_languages[@]}"; do
  _locale=${_lang%% *}
  _pkgname=$pkgbase-${_locale,,}
  # _calurl=https://ftp.mozilla.org/pub/calendar/lightning/candidates/$_calver-candidates/build1/linux-${_src_arch}

  pkgname+=($_pkgname)
  source+=("$pkgbase-$pkgver-$_locale.xpi::$_src_url/$_locale.xpi")
           # "$_calbase-l10n-$_calver-$_locale.xpi::$_calurl/lightning-$_calver.$_locale.linux-${_src_arch}.xpi")

  eval "package_$_pkgname() {
    _package $_lang
  }"
done

# Don't extract anything
noextract=(${source[@]%%::*})

_package() {
  pkgdesc="$2 for Icedove and Iceowl."
  depends=("$_pkgbase>=$epoch:$pkgver")
  replaces=(thunderbird-i18n-${1,,})
  provides=(thunderbird-i18n-${1,,})

  mkdir $1

  unzip $_pkgbase-l10n-$pkgver-$1.xpi -d $1/$_pkgbase
  rm -v $_pkgbase-l10n-$pkgver-$1.xpi

  #unzip $_calbase-l10n-$_calver-$1.xpi -d $1/$_calbase
  #rm -v $_calbase-l10n-$_calver-$1.xpi

  local localizedRe
  localizedRe="$(cat $1/$_pkgbase/chrome/$1/locale/$1/messenger-region/region.properties | grep '^[^#]*localizedRe')"
  if [ -z "$localizedRe" ]; then
    localizedRe="mailnews.localizedRe="
  fi

  install -vDm644 $srcdir/brand.dtd $1/$_pkgbase/chrome/$1/locale/$1/branding
  install -vDm644 $srcdir/brand.properties $1/$_pkgbase/chrome/$1/locale/$1/branding
  install -vDm644 $srcdir/region.properties $1/$_pkgbase/chrome/$1/locale/$1/messenger-region
  echo "$localizedRe" >> $1/$_pkgbase/chrome/$1/locale/$1/messenger-region/region.properties

  #cp -R $1/$_calbase/chrome/calendar-$1 $1/$_pkgbase/chrome/
  #cp -R $1/$_calbase/chrome/lightning-$1 $1/$_pkgbase/chrome/

#  cat >> $1/$_pkgbase/chrome/de.manifest << EOF
#locale calendar de calendar-de/locale/de/calendar/
#locale lightning de lightning-de/locale/de/lightning/
#EOF

  sed -i -e 's/thunderbird/icedove/' $1/$_pkgbase/manifest.json
  sed -i -e 's/Thunderbird/Icedove/' $1/$_pkgbase/manifest.json
  rm -rv $1/$_pkgbase/chrome/$1/locale/$1/global-platform/{mac,win}
  # searchplugins have gone from the translation?
  #rm -rv $1/$_pkgbase/chrome/$1/locale/$1/messenger/searchplugins
  #cp -av /usr/lib/mozilla/searchplugins $1/$_pkgbase/chrome/$1/locale/$1/messenger

  cd $1/$_pkgbase
  zip -r langpack-$1@$_pkgbase.mozilla.org.xpi .
  mv -v langpack-$1@$_pkgbase.mozilla.org.xpi $srcdir
  cd ../..
  rm -rv $1

  install -vDm644 langpack-$1@$_pkgbase.mozilla.org.xpi \
    "$pkgdir/usr/lib/$_pkgbase/extensions/langpack-$1@$_pkgbase.mozilla.org.xpi"
}

sha512sums=('75d15604c01e76acd6d1dfd872ebc23296c8e76ed936f4a20a5616a73fa42a04a5a509946a4b728e6c052cc7f2ae81306a48cd27b4b1aae63d2d6a3cbff2ade6'
            '934b0e299f1366d19b3a88f572971a36c94213004182fc3de1d2400a5de987aeb57821ad3f5ba8cda81655fcf24394e1779936541acbed646709a6417be3165b'
            'd3120b7e0072b1951ea8d5cdd950fca2ed6bcc4dca2a93a3d40e88bfde0cab288590cb03e7d1359201072c21331fe422bfc3440a38effc1f164155d82c2a0b76'
            "${!_languages_list_shasum}"
            "${!_sha512sums_list_shasum}"
            "${_sha512sums[@]}")