summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1ecdd9e1a4aee716685986267d9646ca34793be8 (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
pkgbase=revolution-desktop-git
pkgver=r9235.99ae606c
pkgrel=7
pkgname=(revolution-web-git revolution-desktop-git)
pkgdesc="A glossy Matrix collaboration client for the desktop."
arch=('x86_64')
url="https://gitlab.eastcoast.hosting/ponies/riot-web"
license=('custom:CSL')
depends=('electron')
makedepends=('git' 'nodejs' 'jq' 'yarn' 'npm' 'python' 'rust' 'sqlcipher' 'electron')
provides=('revolution-desktop')
backup=("etc/revolution/config.json")
_giturl='git+https://gitlab.eastcoast.hosting/ponies'
source=("matrix-js-sdk::${_giturl}/matrix-js-sdk.git"
	"matrix-react-sdk::${_giturl}/matrix-react-sdk.git"
	"riot-web::${_giturl}/riot-web.git"
        "riot-desktop::${_giturl}/riot-desktop.git"
        "revolution-desktop.desktop"
        "revolution-desktop.sh"
	"CSL.txt")
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            '822db5d897392092db26a12331d6800983061094f2626a47d33c323ac206aac8'
            '88e1ffc56fe389c5e692ce247243961ac827126f3da50aa591a1a8c792cfd896'
            'cb356a66b835aee9a277953efd754616b7da51e1b4cacd6027a0eea90a700b98'
)

pkgver() {
  cd "$srcdir/riot-web"

  ( set -o pipefail
    git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
  )
}

build() {
  cd matrix-js-sdk
  yarn install
  yarn build
  yarn link

  cd ../matrix-react-sdk
  yarn install
  yarn build
  yarn link

  cd ../riot-web
  yarn link matrix-js-sdk
  yarn link matrix-react-sdk
  yarn install
  yarn build

  cd ../riot-desktop
  yarn install
  yarn run build:native
  yarn add electron
  yarn run build
}

package_revolution-web-git() {
  pkgdesc="Glossy Matrix collaboration client for the web."
  provides=(vector-web)
  replaces=(vector-web)

  cd riot-web

  install -d "${pkgdir}"/{usr/share/webapps,etc/webapps}/revolution

  cp -r webapp/* "${pkgdir}"/usr/share/webapps/revolution/
  install -Dm644 config.sample.json -t "${pkgdir}"/etc/webapps/revolution/
  ln -s /etc/webapps/revolution/config.json "${pkgdir}"/usr/share/webapps/revolution/
  echo "${pkgver}" > "${pkgdir}"/usr/share/webapps/revolution/version

  # Install license
  install -Dm644 ../CSL.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_revolution-desktop-git() {
  pkgdesc="Glossy Matrix collaboration client for the desktop."
  depends=("revolution-web-git=${pkgver}" electron sqlcipher)
  backup=('etc/revolution/config.json')

  cd riot-desktop

  install -d "${pkgdir}"{/usr/lib/revolution,/etc/webapps/revolution}

  # Install the app content, replace the webapp with a symlink to the system package
  cp -r dist/linux-unpacked/resources/* "${pkgdir}"/usr/lib/revolution/
  ln -s /usr/share/webapps/revolution "${pkgdir}"/usr/lib/revolution/webapp

  # Config file
  ln -s /etc/revolution/config.json "${pkgdir}"/etc/webapps/revolution/config.json
  
  install -Dm644 ../riot-web/config.sample.json -t "${pkgdir}"/etc/revolution/
  mv "${pkgdir}"/etc/revolution/config.sample.json "${pkgdir}"/etc/revolution/config.json

  # Required extras
  install -Dm644 ../revolution-desktop.desktop "${pkgdir}"/usr/share/applications/revolution-desktop.desktop
  install -Dm755 ../revolution-desktop.sh "${pkgdir}"/usr/bin/revolution-desktop

  # Icons
  install -Dm644 ../riot-web/res/themes/riot/img/logos/riot-im-logo.svg "${pkgdir}"/usr/share/icons/hicolor/scalable/apps/revolution.svg
  for i in 16 24 48 64 96 128 256 512; do
    install -Dm644 build/icons/${i}x${i}.png "${pkgdir}"/usr/share/icons/hicolor/${i}x${i}/apps/revolution.png
  done

  # Install license
  install -Dm644 ../CSL.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}