summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bd4b7fd7b3acf1ce4ddce1bbf50fc10d0732904a (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
# Maintainer: Conor Anderson <conor@conr.ca>
# Maintainer: Maxim Baz <$pkgname at maximbaz dot com>

pkgname=wire-desktop-beta
_pkgname=${pkgname%-beta}
pkgver=3.5.2881
pkgrel=3
pkgdesc='End-to-end encrypted messenger with file sharing, voice calls and video conferences'
arch=('x86_64')
url='https://wire.com/'
license=('GPL3')
depends=('electron' 'xdg-utils')
makedepends=('cargo' 'npm' 'python2' 'git' 'yarn')
optdepends=('hunspell-en_US: for English spellcheck support'
            'emoji-font: colorful emoji')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/wireapp/${_pkgname}/archive/linux/${pkgver}.tar.gz"
        "${pkgname}.desktop")
sha256sums=('4216cd9c3a2c4920aec2f3c967181b04bfafdb1b47e526a8e823911cce704da1'
            '79505a8ae908a26f74af3d72c24cb09815dc5688eca26ee4bbf57362a865d7c5')

prepare() {
  # Ensure we compile native extensions against system electron version
  local electronver="$(pacman -Q electron | cut -d' ' -f2 | cut -d'-' -f1)"
  msg2 "Compiling against system electron version: $electronver"
  sed -i 's/"electron": ".*"/"electron": "'"$electronver"'"/' "${_pkgname}-linux-${pkgver}/package.json"

  # Create launcher script
  cat << EOF > "${pkgname}"
#!/bin/sh

electron "/usr/lib/${pkgname}" "\$@"
EOF
}

build() {
  cd "${_pkgname}-linux-${pkgver}"
  yarn
  yarn build:ts
  npx grunt 'clean:linux' 'update-keys' 'gitinfo' 'release-internal' 'bundle'
}

package() {
  # Place files
  install -d "${pkgdir}/usr/lib/${pkgname}"
  cp -a "${_pkgname}-linux-${pkgver}/electron"/* "${pkgdir}/usr/lib/${pkgname}"

  # Place launcher script
  install -Dm755 -t "${pkgdir}/usr/bin/" "${pkgname}"

  # Place desktop entry and icon
  desktop-file-install -m 644 --dir "${pkgdir}/usr/share/applications/" "${pkgname}.desktop"
  local res
  for res in 32x32 256x256; do
    install -Dm644 "${_pkgname}-linux-${pkgver}/resources/icons/${res}.png" "${pkgdir}/usr/share/icons/hicolor/${res}/apps/${pkgname}.png"
  done

  # Spellcheck dictionaries
  rm -rf "${pkgdir}/usr/lib/${pkgname}/node_modules/spellchecker/vendor/hunspell_dictionaries"
  ln -s "/usr/share/hunspell" "${pkgdir}/usr/lib/${pkgname}/node_modules/spellchecker/vendor/hunspell_dictionaries"
}