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

pkgname=hyper
pkgver=3.3.0
pkgrel=2
pkgdesc="A terminal built on web technologies"
arch=('x86_64')
url="https://hyper.is/"
license=('MIT')
depends=('alsa-lib' 'gtk3' 'libxss' 'nodejs' 'nss')
makedepends=('electron' 'yarn' 'npm')
conflicts=('hyperterm')
replaces=('hyperterm')

source=(
    "$pkgname-$pkgver.tar.gz::https://github.com/vercel/$pkgname/archive/v$pkgver.tar.gz"
    "$pkgname.desktop"
)
sha256sums=('01bd48fb3d8035782c36f409c997e21a1adbdedc8a56e03367683765d1b532a6'
            'ae29bd930c822c3144817a0e2fe2e2a8253fde90d31b0e19ad7880cd35609ebf')

_hyper_src_dir="$pkgname-$pkgver"

prepare() {
    cd "$_hyper_src_dir"

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

    yarn install
}

build() {
    cd "$_hyper_src_dir"

    # 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"
}

package() {
    cd "$_hyper_src_dir"

    _appdir="/usr/lib/$pkgname"
    _libinstall="${pkgdir}${_appdir}"

    mkdir -p "$pkgdir/usr/bin" "$_libinstall"
    cp -R dist/linux-unpacked/* "$_libinstall"

    # link the binary to /usr/bin
    cd "$pkgdir/usr/bin"
    ln -s "../lib/$pkgname/hyper" hyper

    # # TODO: remove included electron libs and use the system ones by symlink
    # cd "$_libinstall"
    # rm libnode.so libffmpeg.so
    # ln -s /usr/share/electron/lib{node,ffmpeg}.so .

    install -Dm644 -t "$pkgdir/usr/share/applications/"      "$srcdir/$pkgname.desktop"
    install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname/" "$srcdir/$_hyper_src_dir/LICENSE"

    install -Dm644 "$srcdir/$_hyper_src_dir/app/static/icon.png" "$pkgdir/usr/share/pixmaps/$pkgname.png"
}