summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: befc013d64f15f1de821eeb9b56e605d88cd794e (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
# Maintainer: Webarch <contact@webarch.ro>
pkgname=windsurf-next
pkgver=1.3.101_next
pkgrel=3
pkgdesc="Windsurf-next - Next version of the Windsurf editor"
arch=('x86_64')
url="https://codeium.com"
license=('Custom')
depends=(
    'vulkan-driver'
    'ffmpeg'
    'glibc'
    'libglvnd'
)
makedepends=('curl' 'jq')
options=('!strip')

pkgver() {
    local api_response
    api_response=$(curl -s "https://windsurf-next.codeium.com/api/update/linux-x64/next/latest")
    echo "$api_response" | jq -r '.windsurfVersion' | sed 's/-/_/g'
}

source=(
    "$pkgname-$pkgver.tar.gz::$(curl -s "https://windsurf-next.codeium.com/api/update/linux-x64/next/latest" | jq -r '.url')"
)
sha256sums=('SKIP')

prepare() {
    local api_response
    api_response=$(curl -s "https://windsurf-next.codeium.com/api/update/linux-x64/next/latest")
    local expected_sha256
    expected_sha256=$(echo "$api_response" | jq -r '.sha256hash')
    echo "Verifying SHA256 hash..."
    echo "$expected_sha256 $srcdir/$pkgname-$pkgver.tar.gz" | sha256sum -c
}

package() {
    cd "$srcdir/Windsurf"
    
    # Create installation directory
    install -dm755 "$pkgdir/opt/$pkgname"
    
    # Copy all files
    cp -a * "$pkgdir/opt/$pkgname/"
    
    # Install shell completions
    if [ -d resources/completions ]; then
        if [ -d resources/completions/bash ]; then
            install -dm755 "$pkgdir/usr/share/bash-completion/completions"
            cp -r resources/completions/bash/* "$pkgdir/usr/share/bash-completion/completions/"
        fi
        if [ -d resources/completions/zsh ]; then
            install -dm755 "$pkgdir/usr/share/zsh/site-functions"
            cp -r resources/completions/zsh/* "$pkgdir/usr/share/zsh/site-functions/"
        fi
    fi

    # Create executable symlink
    install -dm755 "$pkgdir/usr/bin"
    ln -s "/opt/$pkgname/windsurf-next" "$pkgdir/usr/bin/$pkgname"
    
    # Install desktop entry
    install -Dm644 /dev/null "$pkgdir/usr/share/applications/$pkgname.desktop"
    cat > "$pkgdir/usr/share/applications/$pkgname.desktop" << EOF
[Desktop Entry]
Name=Windsurf Next
Comment=Windsurf Editor (Next Version)
Exec=$pkgname
Icon=/opt/$pkgname/resources/app/resources/linux/code-next.png
Terminal=false
Type=Application
Categories=Development;TextEditor;
EOF
}