blob: 005df50773e04bcf7a888d463d369a5f7d2cd022 (
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
# Maintainer: Richardn <rniu at umich dot edu>
# Contributor: HurricanePootis <hurricanepootis@protonmail.com>
# Contributor: Łukasz Mariański <lmarianski at protonmail dot com>
_pkgname=vscodium
_electron=electron32
_nodejs="20.18.0"
pkgname=${_pkgname}-electron
pkgver=1.95.3.24321
pkgrel=1
pkgdesc="VS Code without MS branding/telemetry/licensing. - System-wide Electron edition"
arch=('x86_64' 'aarch64' 'armv7h')
url="https://github.com/VSCodium/vscodium"
license=('MIT')
options=(!strip !debug)
depends=("$_electron" 'libsecret' 'libx11' 'libxkbfile' 'ripgrep')
optdepends=(
'gvfs: For move to trash functionality'
'libdbusmenu-glib: For KDE global menu'
)
makedepends=('git' 'python' 'nvm' 'jq')
provides=(
'codium'
'vscodium'
)
conflicts=(
'codium'
'vscodium'
'vscodium-bin'
'vscodium-git'
)
source=(
"git+https://github.com/VSCodium/vscodium.git#tag=${pkgver}"
"vscodium-electron.patch"
"${_pkgname}.sh"
"${_pkgname}.js"
"${_pkgname}.desktop"
"${_pkgname}-uri-handler.desktop"
)
sha256sums=(
SKIP
'bb9a14bf25358e02cb0a5d925a39e038aedf6703bf48cb262c1087d84a785493'
'da8fbd6dcafa667e2b3368ae87ed216e7e76f56ce4a3e4ede426dc129e8f8349'
'28a271ba5b2e50b11259abd794ad2ab083612c78bee2d617bb5a8702932c8f44'
'3a5bc109974fcf408855c13965f6d6be0997655c5b359de0bfd19a678c00844e'
'6eef345b65bf2679c928c763529540435ab9c6e1836917319810a7a2d484ae1b'
)
# Even though we don't officially support other archs, let's
# allow the user to use this PKGBUILD to compile the package
# for his architecture
case "$CARCH" in
i686)
_vscode_arch=ia32
;;
x86_64)
_vscode_arch=x64
;;
armv7h)
_vscode_arch=arm
;;
*)
# Needed for mksrcinfo
_vscode_arch=DUMMY
;;
esac
shopt -s extglob
_ensure_local_nvm() {
# let's be sure we are starting clean
which nvm >/dev/null 2>&1 && nvm deactivate && nvm unload
# Use non-hidden nvm folder
export NVM_DIR="${srcdir}/nvm"
# The init script returns 3 if version specified
# in ./.nvrc is not (yet) installed in $NVM_DIR
# but nvm itself still gets loaded ok
source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]]
}
prepare() {
# Abort early if the user does not have the selected electron version installed
if ! which $_electron; then
echo "Selected electron missing from system. Modify PKGBUILD and retry."
exit 1
fi
# Point to system electron in launcher scripts
# Do not use inplace sed so that user could change electron version in rebuilds
sed "s/@ELECTRON@/${_electron}/" "$srcdir/vscodium.sh" > "$srcdir/vscodium-electron.sh"
sed "s/@ELECTRON@/${_electron}/" "$srcdir/vscodium.js" > "$srcdir/vscodium-electron.js"
cd "$srcdir/vscodium"
# Remove old build
if [ -d vscode ]; then
rm -rf vscode VSCode*
fi
# Mangle original vscodium build script to build against system electron
patch -u build.sh -i $srcdir/vscodium-electron.patch
}
build() {
_ensure_local_nvm
nvm install "${_nodejs}"
nvm use "${_nodejs}"
npm install --global yarn node-gyp
# Contain yarn, electron and node
export HOME=$srcdir
# Use non-hidden yarn cache folder
yarn config set cache-folder "$srcdir/yarn-cache"
cd "$srcdir/vscodium"
# the app will be updated with pacman
export DISABLE_UPDATE="yes"
# https://github.com/nodejs/node/issues/51555
export DISABLE_V8_COMPILE_CACHE=1
. build/build.sh
}
package() {
# Reference: https://aur.archlinux.org/packages/vscodium
install -d -m755 ${pkgdir}/usr/bin
install -d -m755 ${pkgdir}/usr/share/{${_pkgname},applications,pixmaps}
install -d -m755 ${pkgdir}/usr/share/licenses/${_pkgname}
# vscodium-electron modification: put resource files and vscodium.js under /usr/lib/
install -dm755 "${pkgdir}/usr/lib/${_pkgname}"
# vscodium-electron modification: Only install licenses, files and shell completions under resources/
install -Dm644 ${srcdir}/${_pkgname}/VSCode-linux-${_vscode_arch}/resources/app/LICENSE.txt -t "${pkgdir}/usr/share/licenses/${_pkgname}/"
install -Dm644 ${srcdir}/${_pkgname}/VSCode-linux-${_vscode_arch}/resources/app/ThirdPartyNotices.txt -t "${pkgdir}/usr/share/licenses/${_pkgname}/"
cp -r --no-preserve=ownership --preserve=mode ${srcdir}/${_pkgname}/VSCode-linux-${_vscode_arch}/resources/app/!(LICENSE.txt|ThirdPartyNotices.txt) "$pkgdir/usr/lib/${_pkgname}/"
cp -r --no-preserve=ownership --preserve=mode ${srcdir}/${_pkgname}/VSCode-linux-${_vscode_arch}/resources/completions "$pkgdir/usr/lib/${_pkgname}/"
# vscodium-electron modification: Use custom launcher scripts
install -Dm755 "${srcdir}/vscodium-electron.sh" "${pkgdir}/usr/bin/${_pkgname}"
install -Dm755 "${srcdir}/vscodium-electron.js" "${pkgdir}/usr/lib/${_pkgname}/vscodium.js"
ln -s "/usr/bin/${_pkgname}" "${pkgdir}/usr/bin/codium"
# vscodium-electron modification: We handle Wayland at vscodium.sh level
install -D -m644 ${_pkgname}.desktop ${pkgdir}/usr/share/applications/${_pkgname}.desktop
install -D -m644 ${_pkgname}-uri-handler.desktop ${pkgdir}/usr/share/applications/${_pkgname}-uri-handler.desktop
install -D -m644 ${srcdir}/${_pkgname}/VSCode-linux-${_vscode_arch}/resources/app/resources/linux/code.png ${pkgdir}/usr/share/pixmaps/${_pkgname}.png
# Symlink shell completions
install -d -m755 ${pkgdir}/usr/share/zsh/site-functions
install -d -m755 ${pkgdir}/usr/share/bash-completion/completions
# vscodium-electrion modification: Shell completion files changed locations
ln -s /usr/lib/${_pkgname}/completions/zsh/_codium ${pkgdir}/usr/share/zsh/site-functions
ln -s /usr/lib/${_pkgname}/completions/bash/codium ${pkgdir}/usr/share/bash-completion/completions
# vscodium-electron modification: Replace bundled ripgrep with system ripgrep
ln -sf /usr/bin/rg ${pkgdir}/usr/lib/$_pkgname/node_modules/@vscode/ripgrep/bin/rg
}
|