aboutsummarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 09ed8848f81041f26a6b8a34cf8c898da5062d02 (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
# Maintainer: 4s3ti <4s3ti@4s3ti.net>

_pkgver=1.6.1
_appimage="Bazecor-${_pkgver}-x64.AppImage"

pkgname="bazecor"
pkgver=${_pkgver/-/.}
pkgrel=3
pkgdesc="Graphical configurator for Dygma keyboards"
url="https://github.com/Dygmalab/Bazecor"
license=("GPL-3.0-only")
provides=("${pkgname}")
conflicts=("${pkgname}-git")
arch=("x86_64")
depends=('zlib' 'fuse2')
options=(!strip)
noextract=("${_appimage}")

# https://github.com/Dygmalab/Bazecor/releases/download/v1.4.0-rc4/Bazecor-1.4.0-rc.4-x64.AppImage
source=("${url}/releases/download/v${_pkgver}/${_appimage}"
  "10-dygma.rules")
sha256sums=('41ff45a878134820f6ad8a7c3c2fe0607ca261c7c54c92661b8a112bf6dc87c6'
            'aba17eabd0f8cbb5118d6d1013e40f3991e5e7c38f97e68f3053f8f5d098ff3c')

prepare() {
    chmod +x "${_appimage}"
    "./${_appimage}" --appimage-extract
}

build() {
    # Adjust .desktop so it will work outside of AppImage container
    sed -i -E "s|Exec=AppRun|Exec=env DESKTOPINTEGRATION=false /usr/bin/${pkgname/b/B}|"\
        "squashfs-root/${pkgname/b/B}.desktop"
    # Fix permissions; .AppImage permissions are 700 for all directories
    chmod -R a-x+rX squashfs-root/usr
    # Do not use Capital B for exec
    sed -i "s/Exec=Bazecor/Exec=bazecor/" "squashfs-root/${pkgname/b/B}.desktop"

}

package() {
    install -Dm755 "${srcdir}/${_appimage}" "${pkgdir}/opt/${pkgname}/${_appimage}"

    # Desktop file for X
    install -Dm644 "${srcdir}/squashfs-root/${pkgname/b/B}.desktop"\
            "${pkgdir}/usr/share/applications/${pkgname}.desktop"

      # Desktop file for Wayland
    if [[ $XDG_SESSION_TYPE == "wayland" ]]; then
      electronFlags="--UseOzonePlatform --ozone-platform-hint=wayland %U"
      sed -i "s/%U/${electronFlags}/" "${pkgdir}/usr/share/applications/${pkgname}.desktop"
    fi

    # Icon images
    install -dm755 "${pkgdir}/usr/share/"
    cp -a "${srcdir}/squashfs-root/usr/share/icons" "${pkgdir}/usr/share/"

    # Symlink executable
    install -dm755 "${pkgdir}/usr/bin"
    ln -s "/opt/${pkgname}/${_appimage}" "${pkgdir}/usr/bin/${pkgname}"

    # Udev Rules
    # https://github.com/Dygmalab/Bazecor/blob/development/src/main/utils/udev.ts#L6C1-L6C284
    install -Dm644 "${srcdir}/10-dygma.rules" "${pkgdir}/etc/udev/rules.d/10-dygma.rules"
}