summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f0d13f8876784575b4283bcc5e9c56732d97d730 (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
# Maintainer: Gunar C. Gessner <gunargessner@gmail.com>
_pkgname="alva"
pkgname="${_pkgname}-git"
pkgver=v0.8.0
pkgrel=2
pkgdesc="Create living prototypes with code components."
arch=("i686" "x86_64")
url="https://meetalva.io"
license=('MIT')
groups=()
depends=(gconf libxss nss gtk3 electron)
makedepends=(git npm nodejs)
optdepends=()
provides=(alva)
conflicts=(alva)
replaces=()
backup=()
options=()
install=
changelog=
source=("${pkgname}::git+http://github.com/meetalva/${_pkgname}.git")
noextract=()
md5sums=(SKIP)

# https://wiki.archlinux.org/index.php/VCS_package_guidelines
pkgver() {
  cd "$srcdir/$pkgname"
# Use latest tag
  git tag|tail -n 1
}

build() {
  cd "$pkgname"
  last_tag=$( git tag|tail -n 1 )
  git checkout $last_tag
  npm install
  npm run build
  ./node_modules/.bin/electron-builder -l --dir
}

package() {
  # enter git repo
  cd "$pkgname" 

  # copy license
  install -D -m 644 LICENSE "${pkgdir}/usr/share/licenses/$pkgname/LICENSE"

  # copy electron resources
  mkdir -p "${pkgdir}/usr/share/"
  cp -f dist/linux-unpacked/resources/app.asar "${pkgdir}/usr/share/alva.asar"

  # create run script
  mkdir -p "${pkgdir}/usr/bin"
  printf '%s\n' \
  '#!/bin/sh' \
  'exec electron /usr/share/alva.asar "$@"' \
  > "$pkgdir/usr/bin/alva"
  chmod a+x "$pkgdir/usr/bin/alva"
}