summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8f417c0e4959379c207e852066100e634d4aaad7 (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
# Maintainer: Mahdi Sarikhani <mahdisarikhani@outlook.com>
# Contributor: Antony Ho <ntonyworkshop@gmail.com>

pkgname=session-desktop
pkgver=1.14.5
pkgrel=1
pkgdesc="Onion routing based messenger"
arch=('x86_64')
url="https://getsession.org"
license=('GPL-3.0-only')
_electron=electron31
depends=('bash' "${_electron}" 'gcc-libs' 'glibc' 'hicolor-icon-theme' 'python')
makedepends=('cmake' 'git' 'nvm' 'python-setuptools' 'yarn')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/session-foundation/session-desktop/archive/refs/tags/v${pkgver}.tar.gz"
        "${pkgname}.desktop"
        "${pkgname}.sh")
sha256sums=('f5c747984f4f414e50e6079b9802af6da2c57fd456f9e230fc0cbf6995a84c8a'
            '267d772a94ba49b19e799e7ecee25c0077ded4dd9c853c073ec386a8ab6a7e5c'
            'a5279447d005060aa77536dcabe0ab66226f9cffa668dc0b6e07a2f1e52ab5ce')

prepare() {
  source /usr/share/nvm/init-nvm.sh

  cd "${pkgname}-${pkgver}"
  sed "s/process.resourcesPath/app.getAppPath().replace('app.asar', '')/g" -i ts/mains/main_node.ts
  sed "s/@ELECTRON@/${_electron}/" -i "${srcdir}/${pkgname}.sh"

  mkdir -p .git

  export ELECTRON_SKIP_BINARY_DOWNLOAD=1
  nvm install
  yarn install --frozen-lockfile
}

build() {
  cd "${pkgname}-${pkgver}"
  export NODE_ENV=production
  yarn build-everything
  yarn electron-builder --linux --dir \
    -c.extraMetadata.environment=production \
    -c.electronDist="/usr/lib/${_electron}" \
    -c.electronVersion="$(cat /usr/lib/${_electron}/version)"
}

package() {
  cd "${pkgname}-${pkgver}"
  install -d "${pkgdir}/usr/lib"
  cp -r dist/linux-unpacked/resources "${pkgdir}/usr/lib/${pkgname}"
  for i in 16 32 48 64 128 256 512 1024; do
    install -Dm644 "build/icons/icon_${i}x${i}.png" "${pkgdir}/usr/share/icons/hicolor/${i}x${i}/apps/${pkgname}.png"
  done
  install -Dm755 "${srcdir}/${pkgname}.sh" "${pkgdir}/usr/bin/${pkgname}"
  install -Dm644 "${srcdir}/${pkgname}.desktop" -t "${pkgdir}/usr/share/applications"
}