summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 120a61a437b6e9a9f2e60526f36822b2eadbc409 (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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Maintainer: Kevin <developer@kev314.dev>

# This PKGBUILD repackages Anthropic's official Debian package for Arch.
# Only the .deb's file payload (data.tar.xz) is used: its embedded install
# scripts do Debian/Ubuntu-specific work (apt repository registration and
# an AppArmor exception for Ubuntu's user namespace restriction), so none
# of that is reproduced here.

pkgname=claude-desktop
pkgver=1.49585.0
pkgrel=1
pkgdesc="Official Claude AI desktop app from Anthropic — Chat, Cowork, and Claude Code"
arch=('x86_64' 'aarch64')
url="https://claude.com/download"
license=('LicenseRef-Proprietary')

# Runtime dependencies, from two sources:
#  - the .deb's "Depends:" field, translated to Arch names (Debian and
#    Arch name the same libraries differently, e.g. libgtk-3-0 -> gtk3);
#  - libraries namcap verified the shipped binaries link directly
#    (cairo, dbus, libx11, ... — otherwise they would only be reachable
#    transitively through gtk3's own dependencies, which is fragile).
# alsa-lib is only a "Recommends:" on Debian, but Chromium needs it for
# audio output, so it is a hard dependency here.
# namcap flags some of these as "may not be needed": those are loaded
# with dlopen(), spawned as programs, or used via D-Bus, all invisible
# to namcap's ELF-header analysis. They are needed.
depends=('alsa-lib'
         'at-spi2-core'
         'cairo'
         'dbus'
         'expat'
         'gcc-libs'
         'glib2'
         'glibc'
         'gtk3'
         'hicolor-icon-theme'
         'libcap-ng'
         'libcups'
         'libdrm'
         'libnotify'
         'libseccomp'
         'libsecret'
         'libx11'
         'libxcb'
         'libxcomposite'
         'libxdamage'
         'libxext'
         'libxfixes'
         'libxkbcommon'
         'libxrandr'
         'libxtst'
         'mesa'
         'nspr'
         'nss'
         'pango'
         'socat'
         'systemd-libs'
         'util-linux-libs'
         'virtiofsd'
         'xdg-desktop-portal'
         'xdg-utils')

# The Cowork feature runs its sandbox inside a QEMU virtual machine.
# Upstream ships the VM stack under "Recommends:", which apt installs by
# default — depending on it here gives Arch users the same out-of-the-box
# experience.
depends_x86_64=('qemu-system-x86' 'edk2-ovmf')
depends_aarch64=('qemu-system-aarch64' 'edk2-aarch64')

optdepends=('gnome-keyring: credential storage via Secret Service (GNOME)'
            'kwallet: credential storage (KDE Plasma)'
            'libayatana-appindicator: system tray icon'
            'xdg-desktop-portal-gtk: portal backend for GTK desktops'
            'xdg-desktop-portal-kde: portal backend for KDE Plasma')

conflicts=('claude' 'claude-desktop-bin')

# makepkg normally strips debug symbols from binaries after package().
# These are prebuilt Electron/Chromium binaries: stripping can corrupt
# them (embedded resources, V8 snapshot data) and saves nothing, so it
# is disabled. !debug disables the companion -debug package, which only
# makes sense when compiling from source.
options=('!strip' '!debug')

_baseurl="https://downloads.claude.ai/claude-desktop/apt/stable/pool/main/c/claude-desktop"
source_x86_64=("${_baseurl}/${pkgname}_${pkgver}_amd64.deb")
source_aarch64=("${_baseurl}/${pkgname}_${pkgver}_arm64.deb")
sha256sums_x86_64=('e0b4ce6313943a69e9bd61749a293bfca241b4dfb37f88df6411b4b69ec67a40')
sha256sums_aarch64=('8a3ae3e007c36a213a16b1b5394e3a0c836baf0cf88a08491e8202952ae27020')

package() {
  # A .deb is an ar archive, which makepkg unpacks like any other source:
  # $srcdir holds debian-binary, control.tar.xz (package metadata and the
  # maintainer scripts, both unused here) and data.tar.xz — the file
  # payload, which is the entire package.
  tar -xf data.tar.xz -C "$pkgdir"

  # chrome-sandbox is Chromium's setuid sandbox helper: mode 4755
  # (setuid root) lets it create the browser sandbox on kernels where
  # unprivileged user namespaces are disabled. Arch enables those, so
  # this is only a fallback (e.g. linux-hardened), but we ship it the
  # way upstream and every Chromium-based package does. The tarball
  # already carries this mode; setting it explicitly documents that the
  # setuid bit is intentional.
  chmod 4755 "$pkgdir/usr/lib/claude-desktop/chrome-sandbox"

  # lintian is Debian's package linter; its override file has no
  # consumer on Arch.
  rm -r "$pkgdir/usr/share/lintian"

  # --- Cowork compatibility shims -------------------------------------
  # The app hardcodes Debian's filesystem paths for the Cowork VM stack;
  # these symlinks map them to where Arch actually installs the pieces.
  #
  # virtiofsd: Debian ships it in /usr/bin, Arch in /usr/lib.
  ln -s ../lib/virtiofsd "$pkgdir/usr/bin/virtiofsd"

  # UEFI firmware: on x86_64 the app opens /usr/share/OVMF/OVMF_CODE_4M.fd
  # (Debian naming). On Arch, /usr/share/OVMF is a compat symlink to
  # /usr/share/edk2 (owned by our edk2-ovmf dependency), so links with
  # the Debian names are placed in /usr/share/edk2, pointing at the real
  # firmware in its x64/ subdirectory. Verified against edk2-ovmf 202605.
  #
  # aarch64 needs no such shim: there the app opens
  # /usr/share/AAVMF/AAVMF_CODE.fd, and edk2-aarch64 installs the firmware
  # under exactly that Debian-compatible path.
  if [[ $CARCH == x86_64 ]]; then
    install -d "$pkgdir/usr/share/edk2"
    ln -s x64/OVMF_CODE.4m.fd "$pkgdir/usr/share/edk2/OVMF_CODE_4M.fd"
    ln -s x64/OVMF_VARS.4m.fd "$pkgdir/usr/share/edk2/OVMF_VARS_4M.fd"
  fi
  #
  # Cowork's host<->VM channel also needs the vhost_vsock kernel module,
  # but no configuration is shipped for it: the module declares a
  # devname alias ("devname:vhost-vsock"), so its device node exists at
  # boot and the kernel auto-loads the module on first open (verified on
  # a live Cowork session).

  # Arch convention: every package with a non-common license installs
  # its license text under /usr/share/licenses/<pkgname>/.
  install -Dm644 "$pkgdir/usr/share/doc/claude-desktop/copyright" \
    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}