summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 091c2704928b99a1f6fa0a920e54b4748f1537d3 (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
# Maintainer: Tuure Piitulainen <tuure.piitulainen@gmail.com>

pkgname="vivify"
pkgver="0.6.3"
pkgrel=1
pkgdesc="Markdown preview tool which can be used standalone or plug into an editor like (Neo)Vim"
arch=("x86_64")
url="https://github.com/jannis-baum/vivify"
license=("GPL-3.0-or-later")
depends=("gcc-libs" "sh")
makedepends=("yarn" "nvm" "zip")
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/jannis-baum/${pkgname}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=("4922f4ddfae48b5c351328427b1cfddb921a52e093974e4e397a80f369c4b85c")

# Stripping 'unneeded symbols' causes vivify-server executable to break
# (segmentation fault)
options=(!strip)

# https://wiki.archlinux.org/title/Node.js_package_guidelines#Using_nvm
_ensure_local_nvm() {
        which nvm >/dev/null 2>&1 && nvm deactivate && nvm unload
        export NVM_DIR="${srcdir}/.nvm"
        source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]]
}

build() {
	cd "Vivify-${pkgver}"

        # This package uses Node SEA, which is alpha and experimental
        # https://nodejs.org/api/single-executable-applications.html
        # Using system node results in a segfaulting binary
        # As a workaround, use latest node from nvm
        _ensure_local_nvm
        nvm install node

        yarn install
        VIV_VERSION="v${pkgver}-${pkgrel}-aur" make linux
}

package() {
	cd "Vivify-${pkgver}"

        install -Dm755 ./build/linux/viv           "${pkgdir}/usr/bin/viv"
        install -Dm755 ./build/linux/vivify-server "${pkgdir}/usr/bin/vivify-server"
        install -Dm644 ./LICENSE                   "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}