summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 44968b284b3899bacd75bf155e7371f51a14fc3b (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
pkgname=mx-puppet-discord-git
pkgver=v0.1.1.r5.gfd44022
pkgrel=3
# strip the -git suffix from name
_dirname="${pkgname%-git}"
_basename="${pkgname%-git}"
pkgdesc='This is a Matrix bridge for Discord'
arch=('x86_64' 'armv7h' 'aarch64')
url='https://gitlab.com/mx-puppet/discord/mx-puppet-discord.git'
license=('apache')
depends=('nodejs-lts-hydrogen' 'cairo' 'pango' 'libjpeg-turbo' 'sqlite')
source=("git+${url}" "${_basename}.tmpfiles" "${_basename}.sysusers" "${_basename}.service")
sha256sums=('SKIP'
            '52882939775b359aceb0b1f16f46d8c2063dab100d58bd2d3753bae66638490d'
            '34f11759a1202f9e4448dd493b2aad253bf2c7f233f70fcf95c33f5a2ab19984'
            '6c3b68dcb11603996aff7daf3b9432c74eed0138eb1ba2cca30a926dbbb786d4')
backup=("etc/${_basename}/config.yaml")
install="${_basename}.install"
# npm is strangely necessary during better-sqlite build or it'll fail
makedepends+=('git' 'yarn' 'npm')
# some users likely have issues from strip exausting machine resources
options=(!strip)
# conflict/provide the same package as the non -git version
provides=("${_basename}")
conflicts=("${_basename}")

pkgver() {
	cd "${srcdir}/${_dirname}"
	( 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)"
	)
	# 0.9.9.r27.g2b039da # if tags exist
	# r1581.2b039da      # else fallback
}

prepare() {
	cd "${srcdir}/${_dirname}"
	yarn install --mode skip-build
}


build(){
	cd "${srcdir}/${_dirname}"
	yarn install
	yarn build
	rm -r 'node_modules/.bin'
}

package() {
	cd "${srcdir}/${_dirname}"

	install -Dvm 644 "${srcdir}/${_basename}.sysusers" "${pkgdir}/usr/lib/sysusers.d/${_basename}.conf"
	install -Dvm 644 "${srcdir}/${_basename}.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${_basename}.conf"
	install -Dvm 644 "${srcdir}/${_basename}.service" "${pkgdir}/usr/lib/systemd/system/${_basename}.service"

	install -Dvm 640 sample.config.yaml "${pkgdir}/etc/${_basename}/config.yaml"

	find 'build' -exec install -D {} "${pkgdir}/usr/lib/node_modules/${_basename}/{}" \;

	find 'node_modules' -exec install -D {} "${pkgdir}/usr/lib/node_modules/${_basename}/{}" \;
}