summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 00570fba239effe517653577824617921a366cd3 (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
85
86
87
88
89
90
91
92
93
94
# Maintainer: Kainoa Kanter <kainoa@t1c.dev>

pkgname=cohesion-git
pkgrel=2
pkgver=r194.g6dbadfb
pkgdesc="Notion client for Linux"
arch=(x86_64)
url="https://github.com/brunofin/cohesion"
license=("MIT")
depends=(electron libxss nss gtk3 libxcrypt-compat libnotify)
makedepends=(git)
provides=(cohesion)
conflicts=(cohestion)

source=("git+${url}.git")
sha512sums=('SKIP')

getnvm() {
    if command -v nvm; then
        echo "nvm command found, using system version.."
    else

        if test -f "/usr/share/nvm/init-nvm.sh"; then
            echo "found init-nvm.sh in /usr/share/nvm, sourcing..."
            unset npm_config_prefix
            source "/usr/share/nvm/init-nvm.sh"
        else
            echo "nvm could not be found, installing"
            unset npm_config_prefix
            folderName=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 12)
            git clone https://aur.archlinux.org/nvm.git "$folderName"
            cd "$folderName" || exit
            makepkg -si --asdeps
            source /usr/share/nvm/init-nvm.sh
            cd ../
            rm -rf "$folderName"
        fi
    fi
}

pkgver() {
    cd "${srcdir}/${pkgname%-git}" || exit
    printf "r%s.g%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    getnvm
    cd "${srcdir}/${pkgname%-git}" || exit
    nvm install lts/gallium
    nvm use lts/gallium
    npm install
}

build() {
    getnvm
    cd "${srcdir}/${pkgname%-git}" || exit
    npm run build
}

package() {
    cd "${srcdir}/${pkgname%-git}" || exit

    install -d "${pkgdir}/opt/cohesion/" "${pkgdir}/usr/bin" "${pkgdir}/usr/share/doc" "${pkgdir}/usr/share/licenses"

    cp -r build/linux-unpacked/* "${pkgdir}/opt/cohesion/"
    

    chmod +x "${pkgdir}/opt/cohesion/cohesion"

    ln -s "/opt/cohesion/cohesion" "${pkgdir}/usr/bin/cohesion"

    install -Dm 644 "data/io.github.brunofin.Cohesion.desktop" "${pkgdir}/usr/share/applications/cohesion.desktop"

    install -Dm 644 "data/icons/hicolor/128x128/apps/io.github.brunofin.Cohesion-greyscale.png" "${pkgdir}/usr/share/icons/hicolor/128x128/apps/io.github.brunofin.Cohesion-greyscale.png"
    install -Dm 644 "data/icons/hicolor/128x128/apps/io.github.brunofin.Cohesion-greyscale-unread.png" "${pkgdir}/usr/share/icons/hicolor/128x128/apps/io.github.brunofin.Cohesion-greyscale-unread.png"
    install -Dm 644 "data/icons/hicolor/128x128/apps/io.github.brunofin.Cohesion.png" "${pkgdir}/usr/share/icons/hicolor/128x128/apps/io.github.brunofin.Cohesion.png"
    install -Dm 644 "data/icons/hicolor/128x128/apps/io.github.brunofin.Cohesion-unread.png" "${pkgdir}/usr/share/icons/hicolor/128x128/apps/io.github.brunofin.Cohesion-unread.png"

    install -Dm 644 "data/icons/hicolor/512x512/apps/io.github.brunofin.Cohesion-greyscale.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/io.github.brunofin.Cohesion-greyscale.png"
    install -Dm 644 "data/icons/hicolor/512x512/apps/io.github.brunofin.Cohesion-greyscale-unread.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/io.github.brunofin.Cohesion-greyscale-unread.png"
    install -Dm 644 "data/icons/hicolor/512x512/apps/io.github.brunofin.Cohesion.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/io.github.brunofin.Cohesion.png"
    install -Dm 644 "data/icons/hicolor/512x512/apps/io.github.brunofin.Cohesion-unread.png" "${pkgdir}/usr/share/icons/hicolor/512x512/apps/io.github.brunofin.Cohesion-unread.png"
	
    install -Dm 644 "data/icons/hicolor/scalable/apps/io.github.brunofin.Cohesion-greyscale.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/io.github.brunofin.Cohesion-greyscale.svg"
    install -Dm 644 "data/icons/hicolor/scalable/apps/io.github.brunofin.Cohesion-greyscale-unread.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/io.github.brunofin.Cohesion-greyscale-unread.svg"
    install -Dm 644 "data/icons/hicolor/scalable/apps/io.github.brunofin.Cohesion.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/io.github.brunofin.Cohesion.svg"
    install -Dm 644 "data/icons/hicolor/scalable/apps/io.github.brunofin.Cohesion-unread.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/io.github.brunofin.Cohesion-unread.svg"
	
    install -Dm 644 "README.md" "${pkgdir}/usr/share/doc/${pkgname}/README.md"
    install -Dm 644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

    ln -s "/opt/cohesion/LICENSE.electron.txt" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.electron.txt"
    ln -s "/opt/cohesion/LICENSES.chromium.html" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSES.chromium.html"
}