Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
devel:tools:ide:vscode
code
code.spec
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File code.spec of Package code
# # spec file for package code # # Copyright (c) 2022 Bruno Pitrus. # Based on the Arch Linux PKGBUILD (c) Filipe Laíns, Michael Hansen, Francisco Magalhães # %global flavor @BUILD_FLAVOR@%{nil} # Do not check for npm requires or provides in app.asar %if "%{flavor}" == "" %global __provides_exclude ^npm(.*)|^nodejs(.*) %global __requires_exclude ^npm(.*)|^nodejs(.*)|^/usr/lib %endif %if "%{flavor}" == "languageservers" %global __requires_exclude ^npm(.*) %endif %global onig_req_version 1.7.0 %if "%{flavor}" == "" Name: code License: Apache-2.0 and (Apache-2.0 or MPL-2.0) and BSD-3-Clause and CC-BY-4.0 and ISC and MIT and MPL-2.0 and Unicode-DFS-2016 and W3C-20150513 Summary: Visual Studio Code. Code editing. Redefined. Group: Development/Tools/IDE %endif %if "%{flavor}" == "languageservers" Name: vscode-languageservers License: MIT Summary: Language servers for CSS, JSON and Markdown Group: Development/Tools/Other %endif Version: 1.89.1 Release: 0 URL: https://github.com/microsoft/vscode %if "%{flavor}" == "" #x86 electron requires SSE2 %ifarch %ix86 ExclusiveArch: i586 i686 BuildArch: i686 %{expand:%%global optflags %(echo "%optflags") -march=pentium4 -mtune=generic} %endif %endif %if "%{flavor}" == "languageservers" BuildArch: noarch %endif #Needed for devtools jsmaps to work %define git_commit dc96b837cf6bb4af9cd736aa3af08cf8279f7685 Source0: https://github.com/microsoft/vscode/archive/refs/tags/%{version}.tar.gz #created by prepare-vendor.sh Source1: vendor.tar.zst Source3: code-oss.js # openSUSE-specific fixes Patch1: product_json.patch Patch3: remove-git.patch Patch4: remove-marketplace-extensions.patch Patch5: do-not-download-electron.patch Patch6: no-asar.patch Patch7: install-font-systemwide.patch Patch13: product.json-reproducible-date.patch %ifarch %ix86 %arm Patch15: do-not-gulp-all-memory.patch %else Source15: do-not-gulp-all-memory.patch %endif Patch16: do-not-check-for-yarn.patch #Remove prebuild-install which is incorrectly specified as runtime dependency and brings a lot of garbage #see https://github.com/microsoft/vscode/issues/143395 Patch17: Remove-build-time-dependencies.patch Patch18: vscode-l10n-dev-use-tree-sitter.patch Patch20: no-comments-or-sourcemaps.patch Patch21: webpack-no-source-maps.patch Patch22: code.sh.patch # patches to use system libs Patch1005: ripgrep.patch Patch1006: Use-system-spdlog.patch Patch1007: sqlite-remove-gcc-symbol-versions.patch Patch1008: system-esbuild.patch # patches fixing interaction with third-party software Patch2000: Fix-restart-opening-electron-default-app.patch Patch2009: fix-exe-path.patch Patch2012: webpack-openssl-3-0.patch Patch2013: extensions-promise-rejected.patch # https://github.com/electron/electron/issues/34885 Patch2014: remove-deprecated-AccessorSignatures.patch Patch2015: nan_callbacks_12_inl-node21.patch # patches that should be submitted upstream verbatim or near-verbatim Patch3001: asar-deterministic.patch Patch3002: electron29-nan-SetAccessor.patch # openSUSE added features that upstream does not want Patch4010: https://raw.githubusercontent.com/VSCodium/vscodium/1.79.0.23159/patches/merge-user-product.patch # patches to remove upstream hostility (DRM etc.) Patch5000: esbuild_version.patch Patch5001: extensions-esbuild_version.patch Patch5014: allow-proposed-extension-apis.patch Patch5015: https://github.com/VSCodium/vscodium/raw/1.80.1.23208/patches/remove-mangle.patch Patch5016: extensions-disable-mangler.patch #tools we use explicitly %if "%{flavor}" == "" BuildRequires: increase-file-max %if 0%{?fedora_version} BuildRequires: yarnpkg %define _ttfontsdir %{_datadir}/fonts/truetype %else BuildRequires: yarn %endif BuildRequires: fontpackages-devel ImageMagick jq sed BuildRequires: nodejs-electron-devel >= 27 #Tools used by yarn BuildRequires: pkgconfig(libsecret-1) pkgconfig(sqlite3) pkgconfig(x11) pkgconfig(xkbfile) spdlog-devel BuildRequires: pkgconfig(krb5) # there are breaking API changes between esbuild 0.16 and 0.17 BuildRequires: esbuild >= 0.17 # for tree sitter BuildRequires: nodejs-devel BuildRequires: nodejs-vscode-oniguruma-devel = %onig_req_version Requires: nodejs-vscode-oniguruma = %onig_req_version Requires: nodejs-electron%{_isa} >= 27 Requires: /usr/bin/rg %endif %if "%{flavor}" == "languageservers" Enhances: kate-plugins %endif BuildRequires: fdupes BuildRequires: nodejs-packaging %if 0%{?fedora} >= 37 BuildRequires: nodejs-npm %else BuildRequires: npm %endif BuildRequires: zstd %if "%{flavor}" == "" %description Visual Studio Code is an IDE developed by Microsoft that combines the simplicity of a code editor with what developers need for the core edit-build-debug cycle. This is an open-source release of Code built from the official code-oss repository. %endif %if "%{flavor}" == "languageservers" %description These are the standalone versions of the language servers included in Visual Studio Code. They are usable in any editor implementing the LSP client protocol, such as Kate. This package includes the CSS, JSON and Markdown servers. %package -n vscode-html-languageserver Summary: Language server for HTML Group: Development/Tools/Other Requires: npm(typescript) Enhances: kate-plugins %description -n vscode-html-languageserver This is a standalone version of the HTML language server included in Visual Studio Code. It is usable in any editor implementing the LSP client protocol, such as Kate. %endif %prep ulimit -Ha %autosetup -p1 -n vscode-%{version} -a 1 rm -v node_modules/@vscode/ripgrep/lib/{download,postinstall}.js # see remove-build-time-dependencies.patch and ripgrep.patch rm -rvf node_modules/@vscode/sqlite3/node_modules/{tar,minipass} rm -rvf node_modules/@vscode/ripgrep/node_modules/{agent-base,https-proxy-agent,debug,yauzl} rm -rvf node_modules/@vscode/windows-mutex/{LICENSE,node_modules/bindings} #fails to build, only used in @vscode/proxy-ageng and guarded by `process.platform === 'win32'` rm -rvf {,remote/}node_modules/@vscode/windows-ca-certs %if "%{flavor}" == "" #Sanity check that we've declared the correct version in header test $(jq -cj '.version' node_modules/vscode-oniguruma/package.json) = %{onig_req_version} find -name vscode-oniguruma -exec sh -c 'rm -rf {} && ln -sv %{nodejs_sitelib}/vscode-oniguruma {}' \; ||true %endif sed -i 's#XXXLIBEXECDIRXXX#%{_libexecdir}#g' src/vs/platform/lifecycle/electron-main/lifecycleMainService.ts src/vs/code/node/cli.ts sed -i 's#XXXLIBDIRXXX#%{_libdir}#g' resources/linux/bin/code.sh %if "%{flavor}" == "" #Remove postinstall script jq -cj 'del(.scripts.postinstall)' package.json > tmp mv -v tmp package.json %endif # Install font systemwide mv -v src/vs/base/browser/ui/codicons/codicon/codicon.ttf %{_builddir}/ mv -v extensions/theme-seti/icons/seti.woff %{_builddir}/ rm -v extensions/simple-browser/node_modules/vscode-codicons/dist/codicon.ttf #Set up yarn sed -i 's/^target .*/target "'%{SYSTEM_ELECTRON_VERSION}'"/' .yarnrc echo 'yarn-offline-mirror "%{_builddir}/vendor"' >> .yarnrc echo 'nodedir %{_includedir}/electron' >> .yarnrc echo 'sqlite /usr' >> .yarnrc %if "%{flavor}" == "" # Make `node` and `npm` binaries refer to Electron %if 0%{?suse_version} NODEJS_DEFAULT_VER=$(echo %nodejs_version|sed 's/\..*//') %else NODEJS_DEFAULT_VER= %endif # Electron has a little known feature that make it work like a nodejs binary. # We make use of it since the system node may be too bleeding-edge # and to avoid building the same modules twice. # Not all scripts work when run under electron, # but importantly npm/yarn and GYP do. mkdir %{_builddir}/path cat <<EOF > %{_builddir}/path/node #!/bin/sh ELECTRON_RUN_AS_NODE=1 exec %{_libdir}/electron/electron "\$@" EOF # HACK: This will refer to /usr/bin/npm17 on openSUSE, /usr/bin/npm on Fedora which are Node scripts cat <<EOF > %{_builddir}/path/npm #!/bin/sh exec node %{_bindir}/npm${NODEJS_DEFAULT_VER} "\$@" EOF cat <<EOF > %{_builddir}/path/npx #!/bin/sh exec node %{_bindir}/npx${NODEJS_DEFAULT_VER} "\$@" EOF cat <<EOF > %{_builddir}/path/node-gyp #!/bin/sh exec node %{nodejs_sitelib}/.bin/node-gyp "\$@" EOF # On Fedora, /usr/bin/yarn is a node script. On openSUSE, it is a shell script. %if 0%{?fedora} cat <<EOF > %{_builddir}/path/yarn #!/bin/sh exec node %{_bindir}/yarn "\$@" EOF %endif chmod -v +x %{_builddir}/path/* #some scripts have #1/usr/bin/env python ln -sv %{_bindir}/python3 %{_builddir}/path/python %endif %build #work around bsc#1216691 export SOURCE_DATE_EPOCH="$(stat --printf=%Y LICENSE.txt)" export CFLAGS="%{optflags} -fpic -fno-semantic-interposition -fvisibility=hidden" export CXXFLAGS="%{optflags} -fpic -fno-semantic-interposition -fvisibility=hidden" export LDFLAGS="%{?build_ldflags}" export MAKEFLAGS="%{_smp_mflags}" export AR=gcc-ar export NM=gcc-nm export RANLIB=gcc-ranlib %if "%{flavor}" == "" export YARN_CACHE_FOLDER=%{_builddir}/Yarn export ELECTRON_SKIP_BINARY_DOWNLOAD=1 export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 export ESBUILD_BINARY_PATH=/usr/bin/esbuild #see build/lib/getVersion.js export BUILD_SOURCEVERSION=%{git_commit} export VSCODE_BUILD_VERBOSE=1 cd %{_builddir}/vscode-%{version} # Build native deps using electron instead of node because the system node may be too new find -name node_modules -print0 > modules_list <modules_list sed -z '/node_modules\/.*\/node_modules/d' | sed -z 's/node_modules$//' | PATH="%{_builddir}/path:$PATH" xargs -0 -I{} -n1 -t -- sh -c ' cd {} && npm rebuild --verbose --foreground-scripts --sqlite=/usr --nodedir=%{_includedir}/electron || exit 255' #spurious makefiles remaining, should not get published rm -rvf node_modules/node-pty/node-addon-api # see vscode-l10n-dev-use-tree-sitter.patch cp -prvT {build/,}node_modules/tree-sitter cp -prvT {build/,}node_modules/tree-sitter-typescript # Rebuild this for node, this module does not work in electron so we cannot run gulp in electron pushd node_modules/tree-sitter rm -rf build %if 0%{?suse_version} NODEJS_DEFAULT_VER=$(echo %nodejs_version|sed 's/\..*//') %else NODEJS_DEFAULT_VER= %endif CFLAGS="${CFLAGS} -I%{_includedir}/node${NODEJS_DEFAULT_VER}" \ CXXFLAGS="${CXXFLAGS} -I%{_includedir}/node${NODEJS_DEFAULT_VER}" \ npm rebuild --verbose --foreground-scripts \ --nodedir=%{_includedir}/node${NODEJS_DEFAULT_VER} popd pushd node_modules/tree-sitter-typescript rm -rf build CFLAGS="${CFLAGS} -I%{_includedir}/node${NODEJS_DEFAULT_VER}" \ CXXFLAGS="${CXXFLAGS} -I%{_includedir}/node${NODEJS_DEFAULT_VER}" \ npm rebuild --verbose --foreground-scripts \ --nodedir=%{_includedir}/node${NODEJS_DEFAULT_VER} popd #Despite the task name, this is actually arch independent. yarn gulp vscode-linux-x64-min yarn gulp vscode-linux-x64-prepare-rpm #Prepare multiple size icons cd resources/win32 [ $(identify code.ico | wc -l) = 4 ] #Sanity check convert code.ico -strip extracted.png identify extracted-0.png | grep -F 16x16 identify extracted-1.png | grep -F 32x32 identify extracted-2.png | grep -F 128x128 identify extracted-3.png | grep -F 256x256 identify code_70x70.png | grep -F 70x70 identify code_150x150.png | grep -F 150x150 cd ../linux identify code.png | grep -F 1024x1024 %endif %if "%{flavor}" == "languageservers" for i in 'css' 'html' 'json' 'markdown'; do pushd extensions/$i-language-features/server npm rebuild --verbose --foreground-scripts popd done for i in 'css' 'html' 'json' 'markdown'; do pushd extensions/$i-language-features/server #ignore errors PATH="%{_builddir}/vscode-%{version}/node_modules/.bin:$PATH" tsc || true popd done %endif %install %if "%{flavor}" == "" cp -alr .build/linux/rpm/x86_64/rpmbuild/BUILD/usr %{buildroot} #Native code does not go in /usr/share mkdir -pv %{buildroot}%{_libdir} mv -v %{buildroot}%{_datadir}/code %{buildroot}%{_libdir} sed -i 's[/usr/share/code/code[code[g' %{buildroot}%{_datadir}/applications/*.desktop chmod 644 %{buildroot}%{_datadir}/applications/*.desktop install -pvDm644 %{_builddir}/codicon.ttf -t%{buildroot}%{_ttfontsdir} install -pvDm644 %{_builddir}/seti.woff -t%{buildroot}%{_ttfontsdir} install -pvDm755 .build/linux/rpm/x86_64/rpmbuild/BUILD/usr/share/code/bin/code -t %{buildroot}%{_bindir} install -pvDm755 %{_sourcedir}/code-oss.js -t %{buildroot}%{_libexecdir} sed -i 's[XXXLIBDIRXXX[%{_libdir}[g' %{buildroot}%{_bindir}/code %{buildroot}%{_libexecdir}/code-oss.js cd %{buildroot}%{_libdir}/code rm -rvf bin rm -rvf resources/completions #HACK: Sort a json that gets generated non-deterministically jq -cjS . out/nls.metadata.json >tmp mv -v tmp out/nls.metadata.json #Remove development garbage find -name '*~' -type f -delete find -name 'obj.target' -print0 |xargs -r0 -- rm -rvf rm -rvf 'node_modules.asar.unpacked/@vscode/ripgrep/bin' rm -rvf 'node_modules.asar.unpacked/@vscode/sqlite3/tools' find . -type d -empty -print -delete #link wasm module which is compiled elsewhere rm -rvf 'node_modules.asar.unpacked/vscode-oniguruma' ln -sv %{nodejs_sitelib}/vscode-oniguruma node_modules.asar.unpacked/ #Fix file mode chmod -v 644 out/vs/workbench/contrib/terminal/browser/media/*.sh #They are snippets, not programs, and don't have a shebang chmod -R og-w . cd node_modules.asar.unpacked find . -type f -exec chmod 644 {} \; find . -name '*.node' -exec chmod -v 755 {} \; #for RPM dependency resolution %fdupes %{buildroot}%{_libdir} #Install icons rm -frv %{buildroot}%{_datadir}/pixmaps mkdir -pv %{buildroot}%{_datadir}/icons/hicolor/1024x1024/apps mv -v %{buildroot}%{_libdir}/code/resources/linux/code.png %{buildroot}%{_datadir}/icons/hicolor/1024x1024/apps/code-oss.png ln -srvf %{buildroot}%{_datadir}/icons/hicolor/1024x1024/apps/code-oss.png %{buildroot}%{_libdir}/code/resources/linux/code.png cd %{_builddir}/vscode-%{version}/resources/win32 install -pvDm644 code_70x70.png %{buildroot}%{_datadir}/icons/hicolor/70x70/apps/code-oss.png install -pvDm644 code_150x150.png %{buildroot}%{_datadir}/icons/hicolor/150x150/apps/code-oss.png install -pvDm644 extracted-0.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/code-oss.png install -pvDm644 extracted-1.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/code-oss.png install -pvDm644 extracted-2.png %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/code-oss.png install -pvDm644 extracted-3.png %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/code-oss.png %if 0%{?suse_version} %reconfigure_fonts_scriptlets %endif %check # Sanity check that we don't have unresolved symbols. It does not fail the build in the case of a shared library. # Stolen from signal-desktop specfile. # All unresolved symbols should start with napi / uv , they are exported by electron itself and are ABI-stable. cd %{buildroot}%{_libdir}/%{name} find . -name '*.node' -print0 | xargs -0 -t -IXXX sh -c '! ldd -d -r XXX | \ grep '\''^undefined symbol'\'' | \ grep -v '\''^undefined symbol: napi_'\'' | \ grep -v '\''^undefined symbol: uv_'\'' ' # Check that all native modules are loadable. find . -name '*.node' -print0 | xargs -0 -t -IXXX env ELECTRON_RUN_AS_NODE=1 %{_libdir}/electron/electron -e 'require("XXX")' %endif %if "%{flavor}" == "languageservers" mkdir -pv %{buildroot}%{_bindir} for i in 'css' 'html' 'json' 'markdown' ; do printf '%%s\n' '#!/usr/bin/node' "require('%{nodejs_sitelib}/vscode-${i}-languageserver')" >%{buildroot}%{_bindir}/vscode-${i}-languageserver pushd extensions/$i-language-features/server rm -rf node_modules/@types mkdir -pv %{buildroot}%{nodejs_sitelib}/vscode-${i}-languageserver cp -alrv node_modules out package.json -t %{buildroot}%{nodejs_sitelib}/vscode-${i}-languageserver popd done mkdir -pv "%buildroot/%_docdir/%name" pushd extensions/json-language-features/server cp -lvT README.md "%buildroot/%_docdir/%name"/json-README.md popd pushd extensions/markdown-language-features/server cp -lvT README.md "%buildroot/%_docdir/%name"/markdown-README.md popd for i in 'css' 'html' 'json' 'markdown' ; do sed -i '1s/env //' %{buildroot}%{nodejs_sitelib}/vscode-${i}-languageserver/node_modules/vscode-languageserver/bin/installServerIntoExtension done sed -i '1s/env //' %{buildroot}%{nodejs_sitelib}/vscode-markdown-languageserver/node_modules/he/bin/he chmod -v 755 %{buildroot}%{_bindir}/* pushd %{buildroot}%{nodejs_sitelib} find -name '*.md' -type f -print -delete find -name '*.map' -type f -print -delete find -name '*.ts' -type f -print -delete find -name tsconfig.json -type f -print -delete find -name '.yarn*' -type f -print -delete find -name .github -print0 |xargs -r0 -- rm -rvf -- find -name '.lsifrc*' -type f -print -delete find -name .editorconfig -type f -print -delete find -name '.eslint*' -type f -print -delete find -name '.prettier*' -type f -print -delete find . -type d -empty -print -delete popd mkdir -pv %{buildroot}%{nodejs_sitelib}/vscode-html-languageserver/lib cp -lv extensions/html-language-features/server/lib/*.d.ts -t %{buildroot}%{nodejs_sitelib}/vscode-html-languageserver/lib %fdupes %{buildroot}%{nodejs_sitelib} %endif %files %defattr(-,root,root) %if "%{flavor}" == "" %{_bindir}/code %{_libdir}/code %{_libexecdir}/code-oss.js %{_datadir}/applications/code.desktop %{_datadir}/applications/code-url-handler.desktop %{_datadir}/bash-completion %{_ttfontsdir} %{_datadir}/appdata/code.appdata.xml %{_datadir}/icons/hicolor/16x16/apps/code-oss.png %{_datadir}/icons/hicolor/32x32/apps/code-oss.png %{_datadir}/icons/hicolor/70x70 %{_datadir}/icons/hicolor/128x128/apps/code-oss.png %{_datadir}/icons/hicolor/150x150 %{_datadir}/icons/hicolor/256x256/apps/code-oss.png %{_datadir}/icons/hicolor/1024x1024 %{_datadir}/mime/packages/code-workspace.xml %{_datadir}/zsh %endif %if "%{flavor}" == "languageservers" %{_bindir}/vscode-css-languageserver %{_bindir}/vscode-json-languageserver %{_bindir}/vscode-markdown-languageserver %dir %{nodejs_sitelib} %{nodejs_sitelib}/vscode-css-languageserver %{nodejs_sitelib}/vscode-json-languageserver %{nodejs_sitelib}/vscode-markdown-languageserver %_docdir/%name %files -n vscode-html-languageserver %{_bindir}/vscode-html-languageserver %dir %{nodejs_sitelib} %{nodejs_sitelib}/vscode-html-languageserver %endif %changelog
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor