void-packages/srcpkgs/vscode/template
Alex Lohr 73aca8daf9 vscode: update to 1.45.1
[skip ci]
2020-05-19 11:38:35 -05:00

52 lines
1.8 KiB
Bash

# Template file for 'vscode'
pkgname=vscode
version=1.45.1
revision=1
hostmakedepends="pkg-config python nodejs-lts-10 yarn tar"
makedepends="libxkbfile-devel libsecret-devel"
depends="libXtst libxkbfile nss dejavu-fonts-ttf xdg-utils"
short_desc="Microsoft Code for Linux"
maintainer="shizonic <realtiaz@gmail.com>"
license="MIT"
homepage="https://code.visualstudio.com/"
distfiles="https://github.com/Microsoft/vscode/archive/${version}.tar.gz"
checksum=5436bd5e0d1b2490ed34c930c650ad7761aec08b40e99691c03d972a80cbf724
patch_args="-Np1"
# Due to electron
archs="x86_64"
nostrip_files="code-oss"
pre_build() {
# Use yarn to install dependencies
echo "" > build/npm/preinstall.js
# redirect telemetry urls to 0.0.0.0
# src: vscodium/undo_telemetry.sh
_TELEMETRY_URLS="(dc\.services\.visualstudio\.com)|(vortex\.data\.microsoft\.com)"
_REPLACEMENT="s/$_TELEMETRY_URLS/0\.0\.0\.0/g"
grep -rl --exclude-dir=.git -E $_TELEMETRY_URLS | xargs sed -i -E $_REPLACEMENT
}
do_build() {
# The default memory limit may be too low for current versions of node
# to successfully build vscode. This sets it to 4GB, but
# change this number if it still doesn't work for your system.
_mem_limit="--max_old_space_size=4095"
export NODE_OPTIONS="${_mem_limit}"
yarn install --ignore-engines --arch=x64
yarn run gulp vscode-linux-x64-min
}
do_install() {
vmkdir usr/lib/code-oss
vcopy ../VSCode-linux-x64/* usr/lib/code-oss
vmkdir usr/bin
ln -sf /usr/lib/code-oss/bin/code-oss ${DESTDIR}/usr/bin/
vmkdir usr/share/applications
ln -sf /usr/lib/code-oss/resources/app/resources/linux/code.desktop ${DESTDIR}/usr/share/applications/code-oss.desktop
vmkdir usr/share/pixmaps
ln -sf /usr/lib/code-oss/resources/app/resources/linux/code.png ${DESTDIR}/usr/share/pixmaps/code-oss.png
vlicense LICENSE.txt
}