You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
3.0 KiB

  1. # Copyright 1999-2021 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=7
  4. inherit desktop pax-utils xdg
  5. DESCRIPTION="Multiplatform Visual Studio Code from Microsoft"
  6. HOMEPAGE="https://code.visualstudio.com"
  7. SRC_URI="
  8. amd64? ( https://update.code.visualstudio.com/${PV}/linux-x64/stable -> ${P}-amd64.tar.gz )
  9. arm? ( https://update.code.visualstudio.com/${PV}/linux-armhf/stable -> ${P}-arm.tar.gz )
  10. arm64? ( https://update.code.visualstudio.com/${PV}/linux-arm64/stable -> ${P}-arm64.tar.gz )
  11. "
  12. S="${WORKDIR}"
  13. RESTRICT="mirror strip bindist"
  14. LICENSE="
  15. Apache-2.0
  16. BSD
  17. BSD-1
  18. BSD-2
  19. BSD-4
  20. CC-BY-4.0
  21. ISC
  22. LGPL-2.1+
  23. Microsoft-vscode
  24. MIT
  25. MPL-2.0
  26. openssl
  27. PYTHON
  28. TextMate-bundle
  29. Unlicense
  30. UoI-NCSA
  31. W3C
  32. "
  33. SLOT="0"
  34. KEYWORDS="-* ~amd64 ~arm ~arm64"
  35. RDEPEND="
  36. app-accessibility/at-spi2-atk:2
  37. app-accessibility/at-spi2-core:2
  38. app-crypt/libsecret[crypt]
  39. dev-libs/atk
  40. dev-libs/expat
  41. dev-libs/glib:2
  42. dev-libs/nspr
  43. dev-libs/nss
  44. media-libs/alsa-lib
  45. media-libs/mesa
  46. sys-apps/dbus
  47. x11-libs/cairo
  48. x11-libs/gdk-pixbuf:2
  49. x11-libs/gtk+:3
  50. x11-libs/libdrm
  51. x11-libs/libX11
  52. x11-libs/libxcb
  53. x11-libs/libXcomposite
  54. x11-libs/libXdamage
  55. x11-libs/libXext
  56. x11-libs/libXfixes
  57. x11-libs/libxkbcommon
  58. x11-libs/libxkbfile
  59. x11-libs/libXrandr
  60. x11-libs/libxshmfence
  61. x11-libs/pango
  62. "
  63. QA_PREBUILT="
  64. /opt/vscode/code
  65. /opt/vscode/libEGL.so
  66. /opt/vscode/libffmpeg.so
  67. /opt/vscode/libGLESv2.so
  68. /opt/vscode/libvulkan.so*
  69. /opt/vscode/chrome-sandbox
  70. /opt/vscode/libvk_swiftshader.so
  71. /opt/vscode/swiftshader/libEGL.so
  72. /opt/vscode/swiftshader/libGLESv2.so
  73. /opt/vscode/resources/app/extensions/*
  74. /opt/vscode/resources/app/node_modules.asar.unpacked/*
  75. "
  76. src_install() {
  77. if use amd64; then
  78. cd "${WORKDIR}/VSCode-linux-x64" || die
  79. elif use arm; then
  80. cd "${WORKDIR}/VSCode-linux-armhf" || die
  81. elif use arm64; then
  82. cd "${WORKDIR}/VSCode-linux-arm64" || die
  83. else
  84. die "Visual Studio Code only supports amd64, arm and arm64"
  85. fi
  86. # Cleanup
  87. rm -r ./resources/app/LICENSES.chromium.html ./resources/app/LICENSE.rtf ./resources/app/licenses || die
  88. # Install
  89. pax-mark m code
  90. insinto "/opt/${PN}"
  91. doins -r *
  92. fperms +x /opt/${PN}/{,bin/}code
  93. fperms 4711 /opt/${PN}/chrome-sandbox
  94. fperms 755 /opt/${PN}/resources/app/extensions/git/dist/askpass.sh
  95. fperms 755 /opt/${PN}/resources/app/extensions/git/dist/askpass-empty.sh
  96. fperms -R +x /opt/${PN}/resources/app/out/vs/base/node
  97. fperms +x /opt/${PN}/resources/app/node_modules.asar.unpacked/vscode-ripgrep/bin/rg
  98. dosym "../../opt/${PN}/bin/code" "usr/bin/vscode"
  99. dosym "../../opt/${PN}/bin/code" "usr/bin/code"
  100. domenu "${FILESDIR}/vscode.desktop"
  101. domenu "${FILESDIR}/vscode-url-handler.desktop"
  102. domenu "${FILESDIR}/vscode-wayland.desktop"
  103. domenu "${FILESDIR}/vscode-url-handler-wayland.desktop"
  104. newicon "resources/app/resources/linux/code.png" "vscode.png"
  105. }
  106. pkg_postinst() {
  107. xdg_pkg_postinst
  108. elog "You may want to install some additional utils, check in:"
  109. elog "https://code.visualstudio.com/Docs/setup#_additional-tools"
  110. }