packages/packages/codium/PKGBUILD

141 lines
4.9 KiB
Bash

# Maintainer: MedzikUser <nivua1fn@duck.com>
pkgname='codium'
provides=('vscodium')
conflicts=('vscodium')
pkgdesc='Free/Libre Open Source Software Binaries of VSCode without MS branding/telemetry/licensing'
pkgver="1.74.3.23010"
pkgrel=1
arch=('x86_64')
microsofturl='https://github.com/microsoft/vscode'
url="https://github.com/VSCodium/vscodium"
license=('MIT')
# Important: Remember to check https://github.com/microsoft/vscode/blob/master/.yarnrc (choose correct tag) for target electron version
_electron='electron18'
depends=("${_electron}" 'libsecret' 'libx11' 'libxkbfile' 'ripgrep')
makedepends=('nodejs-lts-gallium' 'npm' 'yarn' 'gulp' 'jq' 'libxdmcp' 'git' 'git-lfs' 'patch' 'python' 'pkg-config')
optdepends=('gvfs: For move to trash functionality'
'libdbusmenu-glib: For KDE global menu'
'x11-ssh-askpass: SSH authentication'
'org.freedesktop.secrets: Keyring password store support'
'codium-features: Unblock some features in VSCodium'
'codium-marketplace: Enable VS-Code marketplace in VSCodium')
source=("vscodium::git+${url}#tag=${pkgver}"
"vscode::git+${microsofturl}#tag=${pkgver}"
"${pkgname}.desktop"
"${pkgname}-uri-handler.desktop"
"${pkgname}.js"
"${pkgname}.sh")
sha256sums=('SKIP'
'SKIP'
'c1339ef39bb4a3b4d79cedb0b5a9837b95259424677eb6483e38eb02fbf7a485'
'cbbb81153ae784d08c20b450c172f6068501558487c6ea8d587506594d6828fe'
'8163558373e5093988717a5e576003718713a6aa97b62ef68f077badddbead03'
'a23f31a316fa2965fab5333f748388854935fb9e23fa1a6ea0e88e323909aee4')
# Even though we don't officially support other archs, let's allow the
# user to use this PKGBUILD to compile the package for their architecture.
case "${CARCH}" in
x86_64)
_vscode_arch=x64
;;
aarch64)
_vscode_arch=arm64
;;
armv7h)
_vscode_arch=arm
;;
*)
# Needed for mksrcinfo
_vscode_arch=DUMMY
;;
esac
prepare() {
# Change electron binary name to the target electron
sed -i "s|exec electron |exec ${_electron} |" ${pkgname}.sh
sed -i "s|#!/usr/bin/electron|#!/usr/bin/${_electron}|" ${pkgname}.js
# Move vscode repo
cd "vscodium"
# Normally, we would execute get_repo.sh to clone the Microsoft repo here, but makepkg can't do this.
# So we rely on the clone that happened earlier, and move the git directory to the expected place.
rm -rf 'vscode'
mv '../vscode' 'vscode'
}
_setup_nvm() {
# Set a temporary NVM directory to make sure the nvm in this script does not clash with a system-wide nvm install
export NVM_DIR="${srcdir}/.nvm"
source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]]
# TODO: Remove this when VSCodium adds the .nvmrc file
if [ ! -f .nvmrc ]
then
echo "v14.19.0" > .nvmrc
fi
# TODO: End remove this
# Install the correct version of NodeJS (read from .nvmrc)
nvm install $(cat .nvmrc)
nvm use
# Check if the correct version of node is being used
if [[ "$(node --version)" != "$(cat .nvmrc)" ]]
then
echo "Using the wrong version of NodeJS! Expected ["$(cat .nvmrc)"] but using ["$(node --version)"]."
exit 1
fi
}
build() {
cd "vscodium"
# Export some environment variables that would normally be set by Travis CI
export SHOULD_BUILD="yes"
export VSCODE_ARCH="${_vscode_arch}"
export OS_NAME="linux"
export LATEST_MS_COMMIT=$(git rev-list --tags --max-count=1)
export LATEST_MS_TAG=$(git describe --tags "${LATEST_MS_COMMIT}")
# Disable building rpm, deb, and AppImage packages which are not needed in an AUR build
export SKIP_LINUX_PACKAGES="True"
# Install Node.js (using nvm)
#_setup_nvm
# Build
./build.sh
}
package() {
cd "vscodium/VSCode-linux-${_vscode_arch}"
# Install resource files
install -d "${pkgdir}/usr/lib/${pkgname}"
cp -r --no-preserve=ownership --preserve=mode resources/app/* "${pkgdir}/usr/lib/${pkgname}/"
# Replace statically included binary with system copy
ln -sf /usr/bin/rg "${pkgdir}/usr/lib/${pkgname}/node_modules.asar.unpacked/@vscode/ripgrep/bin/rg"
# Install bash and zsh completions
install -Dm 644 "resources/completions/bash/${pkgname}" "${pkgdir}/usr/share/bash-completion/completions/${pkgname}"
install -Dm 644 "resources/completions/zsh/_${pkgname}" "${pkgdir}/usr/share/zsh/site-functions/_${pkgname}"
install -Dm 644 "resources/app/resources/linux/code.png" "${pkgdir}/usr/share/pixmaps/${pkgname}.png"
# Install start scripts
cd "${srcdir}"
install -Dm 755 "${pkgname}.sh" "${pkgdir}/usr/bin/${pkgname}"
install -Dm 755 "${pkgname}.js" "${pkgdir}/usr/lib/${pkgname}/${pkgname}.js"
# Install appdata and desktop files
install -d "${pkgdir}/usr/share/{${pkgname},applications,pixmaps}"
install -Dm 644 "${pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop"
install -Dm 644 "${pkgname}-uri-handler.desktop" "${pkgdir}/usr/share/applications/${pkgname}-uri-handler.desktop"
}