summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2b18f23375761d15e78d44a0d215250d3a23d593 (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: Nathan Chere <git@nathanchere.com.au>
pkgname=grayjay-git
pkgver=3.r55.g1dd9774
pkgrel=1
pkgdesc="Grayjay Desktop - follow creators, not platforms (privacy- and freedom-respecting client for YouTube, Rumble, Twitch, Spotify etc)"
arch=('x86_64')
provides=('grayjay')
conflicts=('grayjay-bin')
url="https://github.com/futo-org/Grayjay.Desktop"
license=('Source First License 1.1')
depends=('dotnet-runtime' 'gtk3' 'libnotify' 'nss' 'libxss' 'libxtst' 'xdg-utils' 'at-spi2-core' 'libsecret' 'libappindicator-gtk3')
makedepends=('dotnet-sdk' 'git')
options=(!debug)
source=("grayjay-desktop::git+https://github.com/futo-org/Grayjay.Desktop.git")
sha256sums=('SKIP')

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

prepare() {
    cd "$srcdir/grayjay-desktop"
    git config submodule.FUTO.MDNS.url https://github.com/futo-org/FUTO.MDNS.git
    git config submodule.Grayjay.Engine.url https://github.com/futo-org/Grayjay.Engine.git
    git config submodule.JustCef.url https://github.com/futo-org/JustCef.git
    git submodule update --init --recursive
}

build() {
    cd "$srcdir/grayjay-desktop"
    bash ./build.sh
}

package() {
    cd "${srcdir}/grayjay-desktop/Grayjay.Desktop.CEF/bin/Release/net8.0/linux-x64/publish"

    # Create necessary directories
    install -dm755 "${pkgdir}/usr/share/grayjay"
    install -dm755 "${pkgdir}/usr/bin"
    install -dm755 "${pkgdir}/usr/share/applications"
    install -dm755 "${pkgdir}/usr/share/icons/hicolor/512x512/apps"

    # Create launcher script that copies app to user directory on first run
    cat > "${pkgdir}/usr/bin/grayjay" << 'EOF'
#!/bin/sh
APP_DIR="$HOME/.local/share/grayjay"

# Check if app is already installed in user directory
if [ ! -d "$APP_DIR" ]; then
    echo "First run - installing Grayjay to $APP_DIR"
    mkdir -p "$APP_DIR"
    cp -r /usr/share/grayjay/* "$APP_DIR/"
    chmod u+w -R "$APP_DIR"
fi

exec sh -c "cd '$APP_DIR' && exec ./Grayjay \"\$@\"" -- "$@"
EOF
    chmod 755 "${pkgdir}/usr/bin/grayjay"

    # Copy application files to system directory (will be copied to user dir on first run)
    cp -a ./* "${pkgdir}/usr/share/grayjay/"
    chmod -R u=rwX,g=rX,o=rX "${pkgdir}/usr/share/grayjay/"

    # Create desktop entry
    cat > "${pkgdir}/usr/share/applications/grayjay.desktop" << EOF
[Desktop Entry]
Name=Grayjay
Comment=Privacy-respecting client for YouTube, Rumble, Twitch, Spotify etc
Exec=/usr/bin/grayjay
Icon=grayjay
Terminal=false
Type=Application
Categories=Network;Video;AudioVideo;
EOF

    # Install icon
    cd "${srcdir}/grayjay-desktop/Grayjay.Desktop.CEF"
    install -Dm644 "grayjay.png" \
        "${pkgdir}/usr/share/icons/hicolor/512x512/apps/grayjay.png"
}