summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f497f69af9c10682567651e1470e80fc236bca7a (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
# Maintainer: BrLi <brli@chakralinux.org>

pkgname=zettlr
pkgver=1.3.0
pkgrel=1
pkgdesc="A markdown editor for writing academic texts and taking notes"
arch=('x86_64')
url="https://www.zettlr.com"
license=('GPL')
depends=(electron ttf-webhostinghub-glyphs otf-crimson-text)
makedepends=(yarn git)
optdepends=('pandoc: For exporting to various format'
            'texlive-bin: For Latex support'
            'ttf-lato: Display output in a more comfortable way')
source=($pkgname::git+https://github.com/Zettlr/Zettlr.git#tag=v$pkgver)
sha1sums=(SKIP)

build() {
    cd $srcdir/$pkgname
    yarn install --pure-lockfile
    yarn less
    yarn handlebars
    yarn lang:refresh

    cd $srcdir/$pkgname/source
    yarn install --pure-lockfile
}

package() {
    install -dm 755 "$pkgdir"/usr/lib/$pkgname

    cd $srcdir/$pkgname/
    cp -r --no-preserve=ownership --preserve=mode source/* "$pkgdir"/usr/lib/$pkgname/

    # Remove unneeded addin
    find $pkgdir/usr/lib/zettlr -name "fonts" -exec rm -rfv "{}"\;
    find $pkgdir/usr/lib/zettlr -name ".gitignore" -or -name ".eslintrc.json" -or -name ".npmignore" -exec rm -rfv "{}"\;

    install -Dm755 /dev/stdin $pkgdir/usr/bin/$pkgname <<END
#!/bin/bash
exec electron /usr/lib/$pkgname "$@"
END

    for px in 16 24 32 48 64 96 128 256; do
        install -Dm644 resources/icons/png/"$px"x"$px".png \
        $pkgdir/usr/share/icons/hicolor/"$px"x"$px"/apps/$pkgname.png
    done

    install -Dm644 /dev/stdin $pkgdir/usr/share/applications/$pkgname.desktop <<END
[Desktop Entry]
Name=Zettlr
Comment=A powerful Markdown Editor with integrated tree view
Exec="$pkgname" %U
Terminal=false
Type=Application
Icon=$pkgname
StartupWMClass=Zettlr
MimeType=text/markdown;
Categories=Office;
END
}