diff --git a/srcpkgs/vscode/files/code b/srcpkgs/vscode/files/code new file mode 100644 index 00000000000..f53c780abfd --- /dev/null +++ b/srcpkgs/vscode/files/code @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# If root, ensure that --user-data-dir or --file-write is specified +if [ "$(id -u)" = "0" ]; then + for i in $@ + do + if [[ $i == --user-data-dir || $i == --user-data-dir=* || $i == --file-write ]]; then + CAN_LAUNCH_AS_ROOT=1 + fi + done + if [ -z $CAN_LAUNCH_AS_ROOT ]; then + echo "You are trying to start vscode as a super user which is not recommended. If you really want to, you must specify an alternate user data directory using the --user-data-dir argument." 1>&2 + exit 1 + fi +fi +VSCODE_PATH="/usr/lib/code-oss" +ELECTRON="$VSCODE_PATH/code-oss" +CLI="$VSCODE_PATH/resources/app/out/cli.js" +ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@" +exit $? \ No newline at end of file diff --git a/srcpkgs/vscode/files/code.desktop b/srcpkgs/vscode/files/code.desktop index aa65c336fbe..858abaeb363 100644 --- a/srcpkgs/vscode/files/code.desktop +++ b/srcpkgs/vscode/files/code.desktop @@ -4,7 +4,7 @@ Version=1.0 Name=Microsoft Code Comment=Code Editing. Redefined. GenericName=Text Editor -Exec=/usr/bin/code-oss --unity-launch %F +Exec=/usr/bin/code --unity-launch %F Icon=/usr/share/code-oss/resources/app/resources/linux/code.png Type=Application StartupNotify=true @@ -25,6 +25,6 @@ Name[ko]=새 창 Name[ru]=Новое окно Name[zh_CN]=新建窗口 Name[zh_TW]=開新視窗 -Exec=/usr/bin/code-oss --new-window %F +Exec=/usr/bin/code --new-window %F Icon=/usr/share/code-oss/resources/app/resources/linux/code.png diff --git a/srcpkgs/vscode/patches/buildid.patch b/srcpkgs/vscode/patches/buildid.patch new file mode 100644 index 00000000000..7595f46b7bd --- /dev/null +++ b/srcpkgs/vscode/patches/buildid.patch @@ -0,0 +1,11 @@ +--- build/gulpfile.vscode.js 2018-07-11 06:48:42.000000000 -0700 ++++ build/gulpfile.vscode.js 2018-07-14 22:18:48.706459639 -0700 +@@ -265,7 +265,7 @@ function packageTask(platform, arch, opt + const packageJsonStream = gulp.src(['package.json'], { base: '.' }) + .pipe(json({ name, version })); + +- const settingsSearchBuildId = getSettingsSearchBuildId(packageJson); ++ const settingsSearchBuildId = 'BuildId'; + const date = new Date().toISOString(); + const productJsonStream = gulp.src(['product.json'], { base: '.' }) + .pipe(json({ commit, date, checksums, settingsSearchBuildId })); diff --git a/srcpkgs/vscode/template b/srcpkgs/vscode/template index 162ca8aefd9..298168d1363 100644 --- a/srcpkgs/vscode/template +++ b/srcpkgs/vscode/template @@ -1,11 +1,8 @@ # Template file for 'vscode' pkgname=vscode -version=1.21.0 +version=1.25.1 revision=1 -only_for_archs="i686 x86_64" -nocross=yes -nostrip=yes -hostmakedepends="pkg-config python nodejs" +hostmakedepends="pkg-config python nodejs yarn" makedepends="libX11-devel libxkbfile-devel libsecret-devel" depends="GConf libXtst libxkbfile nss" short_desc="Microsoft Code for Linux" @@ -13,7 +10,10 @@ maintainer="Julio Galvan " license="MIT" homepage="https://code.visualstudio.com/" distfiles="https://github.com/Microsoft/vscode/archive/${version}.tar.gz" -checksum=d4773e3c136a311098c245a42f671eb1c90382f8e199f73dca500b0c15e41ba4 +checksum=af95547a64647d4097c1b45902fc53f45d323f053a7558bfa42e1900621d972c +# Due to electron +only_for_archs="i686 x86_64" +nostrip_files="code-oss" case "$XBPS_TARGET_MACHINE" in i686) _ARCH="ia32";; @@ -21,23 +21,17 @@ case "$XBPS_TARGET_MACHINE" in esac do_build() { - npm install -g gulp yarn - yarn install --arch=${_ARCH} - /usr/bin/node --max_old_space_size=2048 /usr/bin/gulp vscode-linux-${_ARCH} + sed -i 's/\"enableTelemetry\":.*/\"enableTelemetry\": false,/g' product.json + echo > build/npm/preinstall.js + yarn install --ignore-engines --arch=${_ARCH} + yarn run gulp vscode-linux-${_ARCH} } do_install() { - cd ../VSCode-linux-${_ARCH} - - sed -i "20,31 d" bin/code-oss - sed -i "20iVSCODE_PATH=\"/usr/share/code-oss\"" bin/code-oss - vbin bin/code-oss - - vlicense resources/app/LICENSE.txt - + vmkdir usr/lib vmkdir usr/share/applications vcopy ${FILESDIR}/code.desktop usr/share/applications/ - - vmkdir usr/share/code-oss - vcopy ./* usr/share/code-oss + mv ../VSCode-linux-${_ARCH} ${DESTDIR}/usr/lib/code-oss + vbin ${FILESDIR}/code + vlicense LICENSE.txt }