summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5e07de9029150822f40830bc80626958e39b2698 (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
# Maintainer: Mark Collins <tera_1225 hat hotmail ðot com>
# Partially adapted from https://github.com/wasta-linux/lameta-snap
pkgname=lameta
pkgver=2.3.10_beta
_electron=electron23
pkgrel=1
pkgdesc="The Metadata Editor for Transparent Archiving of language document materials"
arch=('x86_64')
url="https://github.com/onset/lameta"
license=('MIT')
depends=(
	bash
	"$_electron"
	nodejs
)
makedepends=(
	asar
	npm
	yarn
)
source=(
  "${pkgname}-${pkgver}.zip::${url}/archive/refs/tags/v${pkgver//_/-}.tar.gz"
	"${pkgname}.desktop"
  'no_node_pin.patch'
)
sha256sums=('d455d375e7dc12f4f5d89ff640e47efd980963fdd858401664484b313788370b'
            '874e1acc986076e9c876c6ccd2efc7ee0dcda322733c018fb8e3d0bf010b8791'
            '7bc59aee62f8a77217d76ae42f6445ed51375f5c1c158c678aa56c208edbdc28')

prepare() {
	cd "${srcdir}/${pkgname}-${pkgver//_/-}"
	echo -e 'logFilters:\n  - code: "YN0013"\n    level: "discard"' >> .yarnrc.yml
  echo "Applying patch to unpin node and yarn versions"
  patch --forward --strip=1 --input="${srcdir}/no_node_pin.patch"
}

build() {
	cd "${srcdir}/${pkgname}-${pkgver//_/-}"
  yarn
  yarn install --frozen-lockfile
  yarn build
  yarn lingui-compile
	./node_modules/.bin/electron-builder \
	  --linux --x64 --dir \
    --config.electronDist=/usr/lib/"$_electron"
}

package() {
	cd "${srcdir}"
	install -Dm644 "${pkgname}.desktop" -t "${pkgdir}/usr/share/applications/"
	cd "${srcdir}/${pkgname}-${pkgver//_/-}"
  install -Dm644 "LICENSE" \
   "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
	install -Dm644 "assets/icon.png" \
		"$pkgdir/usr/share/icons/$pkgname/$pkgname.png"
	install -dm755 "${pkgdir}/var/log/lameta"
  install -d "$pkgdir/usr/lib/$pkgname/"
  asar e "release/linux-unpacked/resources/app.asar" "$pkgdir/usr/lib/$pkgname/"
  rm -R "${pkgdir}/usr/lib/$pkgname/node_modules/ffprobe-static/bin/darwin"
  rm -R "${pkgdir}/usr/lib/$pkgname/node_modules/ffprobe-static/bin/linux/ia32"
  rm -R "${pkgdir}/usr/lib/$pkgname/node_modules/flatted/python/"
  install -Dm755 /dev/null "${pkgdir}/usr/bin/$pkgname"
  cat >>"${pkgdir}/usr/bin/$pkgname" <<EOD
#! /usr/bin/sh
exec $_electron /usr/lib/$pkgname "\$@"
EOD
	echo "This build dir is rather large:"
  du -h -d0 "$(dirname "$srcdir/../")"
  echo "Maybe you should consider deleting it"
}