summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9f92ae0263414259355157c6ce656ebd8f95621a (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Maintainer: r3f <r3flector@pm.me>
# Maintainer: iFlygo <iflygo@outlook.com>

pkgname=warp-terminal
_srcname=warp
_pkgver=2026.05.27.09.22
pkgver=v0.${_pkgver}.stable
pkgrel=1
pkgdesc="Warp, the Rust-based terminal for developers and teams (built from source, OSS channel)"
arch=('x86_64' 'aarch64')
url='https://github.com/warpdotdev/warp'
license=('AGPL-3.0-only' 'MIT')
depends=(
    'alsa-lib'
    'bash'
    'bzip2'
    'curl'
    'default-cursors'
    'fontconfig'
    'hicolor-icon-theme'
    'libegl'
    'libx11'
    'libxcb'
    'libxcursor'
    'libxi'
    'libxkbcommon-x11'
    'opengl-driver'
    'xdg-utils'
    'xz'
    'zlib'
)
makedepends=(
    'git'
    'rust'
    'cmake'
    'pkgconf'
    'protobuf'
    'openssl'
    'freetype2'
    'expat'
    'libgit2'
    'brotli'
    'jq'
    'cargo-about'
    'mold'
)
optdepends=(
    'adwaita-cursors: fallback when no default cursor theme is installed'
    'kdialog: for file dialogs in KDE'
    'org.freedesktop.secrets: for securely storing passwords'
    'python: to run bundled helper skills'
    'python-yaml: to run bundled helper skills'
    'zenity: for file dialogs in Gnome'
)
provides=("warp-terminal-oss=${pkgver}")
options=('!lto' '!debug')
source=("${url}/archive/refs/tags/${pkgver}_00.tar.gz")
sha256sums=('SKIP')

prepare() {
    cd "${srcdir}/warp-0.${_pkgver}.stable_00"
    # Use the system rust (1.95+) instead of the rustup toolchain pinned upstream (1.92).
    rm -f rust-toolchain.toml

    export CARGO_HOME="${srcdir}/cargo-home"
    cargo fetch --locked
}

build() {
    cd "${srcdir}/warp-0.${_pkgver}.stable_00"
    export CARGO_TARGET_DIR="${srcdir}/target"
    export CARGO_HOME="${srcdir}/cargo-home"
    # Override system RUSTFLAGS instead of appending: avoids portability-breaking
    # flags like `-C target-cpu=native` (CachyOS) and conflicting linker choices.
    export RUSTFLAGS="-C opt-level=3 -C link-arg=-fuse-ld=mold -C split-debuginfo=unpacked --remap-path-prefix=${srcdir}=/build"
    export CFLAGS+=" -ffile-prefix-map=${srcdir}=/build"
    export CXXFLAGS+=" -ffile-prefix-map=${srcdir}=/build"
    cargo build \
        --release \
        --frozen \
        --package warp \
        --bin warp-oss \
        --features 'release_bundle,gui,nld_classifier_v2'
}

package() {
    local opt_dir="/opt/warpdotdev/${pkgname}"
    cd "${srcdir}/warp-0.${_pkgver}.stable_00"

    # Binary.
    install -Dm755 "${srcdir}/target/release/warp-oss" \
        "${pkgdir}${opt_dir}/warp-oss"

    # Bundled resources (skills, fonts, etc) plus THIRD_PARTY_LICENSES.txt
    # generated by cargo-about (required by AGPL/MIT compliance for shipped
    # third-party code). Settings schema is skipped — it requires an extra
    # cargo invocation and isn't strictly necessary at runtime.
    SKIP_SETTINGS_SCHEMA=1 \
        ./script/prepare_bundled_resources \
        "${pkgdir}${opt_dir}/resources" \
        oss

    # .desktop entry and icon from the OSS channel.
    install -Dm644 "app/channels/oss/dev.warp.WarpOss.desktop" \
        "${pkgdir}/usr/share/applications/dev.warp.WarpOss.desktop"
    install -Dm644 "app/channels/oss/icon/no-padding/512x512.png" \
        "${pkgdir}/usr/share/icons/hicolor/512x512/apps/dev.warp.WarpOss.png"

    # Rewrite Exec= so the menu entry launches via /usr/bin/${pkgname}.
    sed -i "s|^Exec=.*|Exec=/usr/bin/${pkgname} %U|" \
        "${pkgdir}/usr/share/applications/dev.warp.WarpOss.desktop"

    # Launcher: picks up ~/.config/${pkgname}-flags.conf, mirroring upstream.
    install -d "${pkgdir}/usr/bin"
    cat > "${pkgdir}/usr/bin/${pkgname}" <<EOF
#!/bin/bash
XDG_CONFIG_HOME=\${XDG_CONFIG_HOME:-~/.config}
if [[ -f \$XDG_CONFIG_HOME/${pkgname}-flags.conf ]]; then
    WARP_USER_FLAGS="\$(grep -v '^#' \$XDG_CONFIG_HOME/${pkgname}-flags.conf)"
fi
exec ${opt_dir}/warp-oss \$WARP_USER_FLAGS "\$@"
EOF
    chmod 755 "${pkgdir}/usr/bin/${pkgname}"

    # Licenses.
    install -Dm644 LICENSE-AGPL "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE-AGPL"
    install -Dm644 LICENSE-MIT  "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE-MIT"
}