summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5ee35c97aba5211f454f02b1d7d36f25d694c869 (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
# Maintainer: éclairevoyant
# Contributor: Constantine Fedotov <zenflak@gmail.com>
# Contributor: aureolebigben <aureolebigben@gmail.com>
# Contributor: fleischie
# Contributor: auk
# Contributor: blind

pkgname=hyper
pkgver=3.4.1
pkgrel=1
pkgdesc="A terminal built on web technologies"
arch=('x86_64')
url="https://hyper.is/"
license=('MIT')
depends=('alsa-lib' 'electron20' 'gtk3' 'libxss' 'nss')
makedepends=('yarn' 'npm')
conflicts=('hyperterm')
replaces=('hyperterm')
source=("$pkgname-$pkgver.tar.gz::https://github.com/vercel/$pkgname/archive/v$pkgver.tar.gz"
        "$pkgname.desktop")
b2sums=('2c480fbd2162f77bfa3b3f5702a50cfb4fb7d88d133c1b916937233b8556ed2c289ab15fb166615dfcd9859a8919dd24423ed751145ae33fdc29f1c072b5b37e'
        '3e204a5417c0c0b5d0de4b25013657e4f27ec951c4c23ad9c5bf661890bcf6e6b7f81454373c5740fc424c6af022a45e6b7f204dffb67afa678cf098c545b590')

_electron_file_list=(
	chrome-sandbox
	chrome_{1,2}00_percent.pak
	chrome_crashpad_handler
	libEGL.so
	libGLESv2.so
	libvk_swiftshader.so
	libvulkan.so.1
)

prepare() {
	cd $pkgname-$pkgver

	# delete husky install from postinstall
	sed -i 's/\ \&\& husky install//g' package.json

	yarn install
}

build() {
	cd $pkgname-$pkgver

	# This build command is the same as the one defined in package.json via
	# npm run dist except that it doesn't build for debian, rpm, etc. and
	# doesn't require some other dependencies

	# add node_modules binaries to PATH
	oldpath="$PATH"
	PATH="$(pwd)/node_modules/.bin:$PATH"

	yarn run build &&
	cross-env BABEL_ENV=production babel target/renderer/bundle.js \
		--out-file target/renderer/bundle.js \
		--no-comments \
		--minified target/renderer/bundle.js &&
	electron-builder --linux --dir

	PATH="$oldpath"

	# clean up bundled electron files
	for i in ${_electron_file_list[@]}; do
		rm dist/linux-unpacked/$i
	done
}

package() {
	install -Dm644 $pkgname.desktop -t "$pkgdir/usr/share/applications/"

	cd $pkgname-$pkgver
	install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
	install -Dm644 app/static/icon.png "$pkgdir/usr/share/pixmaps/$pkgname.png"

	install -dm755 "$pkgdir/usr/lib/$pkgname/"
	cp -R dist/linux-unpacked/* "$pkgdir/usr/lib/$pkgname/"
	for i in ${_electron_file_list[@]}; do
		ln -s /usr/lib/electron/$i "$pkgdir/usr/lib/$pkgname/"
	done

	install -dm755 "$pkgdir/usr/bin/"
	ln -s /usr/lib/$pkgname/$pkgname "$pkgdir/usr/bin/$pkgname"
}