This repository has been archived on 2023-01-08. You can view files and clone it, but cannot push or open issues or pull requests.
ptrcports/code-oss/APKBUILD
2022-06-12 03:32:12 +02:00

107 lines
3.9 KiB
Text

# Maintainer: psykose <alice@ayaya.dev>
pkgname=code-oss
pkgver=1.68.0
pkgrel=0
pkgdesc="Visual Studio Code"
url="https://github.com/microsoft/vscode"
arch="x86_64"
license="haha"
depends="electron ripgrep"
makedepends="
libsecret-dev
libxkbfile-dev
nodejs
npm
python3
yarn
"
subpackages="
$pkgname-bash-completion
$pkgname-zsh-completion
"
source="$pkgname-$pkgver.tar.gz::https://github.com/microsoft/vscode/archive/refs/tags/$pkgver.tar.gz
electron-version.patch
electron19.patch
enable-extensions.patch
launcher.patch
no-git.patch
"
builddir="$srcdir/vscode-$pkgver"
options="!check"
export GIT_DIR="$srcdir"
export ELECTRON_SKIP_BINARY_DOWNLOAD=1
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
prepare() {
default_prepare
yarn config set python python3
yarn install --frozen-lockfile
}
build() {
node --max_old_space_size=4095 ./node_modules/.bin/gulp vscode-linux-x64-min
}
package() {
mkdir -p "$pkgdir"/usr/share/applications
sed -e "s|@@NAME_LONG@@|Code - OSS|g" \
-e "s|@@NAME_SHORT@@|Code - OSS|g" \
-e "s|@@NAME@@|code-oss|g" \
-e "s|@@EXEC@@|/usr/bin/code-oss|g" \
-e "s|@@ICON@@|com.visualstudio.code.oss|g" \
-e "s|@@URLPROTOCOL@@|code-oss|g" \
resources/linux/code.desktop > "$pkgdir"/usr/share/applications/code-oss.desktop
sed -e "s|@@NAME_LONG@@|Code - OSS|g" \
-e "s|@@NAME_SHORT@@|Code - OSS|g" \
-e "s|@@NAME@@|code-oss|g" \
-e "s|@@EXEC@@|/usr/bin/code-oss|g" \
-e "s|@@ICON@@|com.visualstudio.code.oss|g" \
-e "s|@@URLPROTOCOL@@|code-oss|g" \
resources/linux/code-url-handler.desktop > "$pkgdir"/usr/share/applications/code-oss-url-handler.desktop
install -Dm644 resources/linux/code.png "$pkgdir"/usr/share/pixmaps/com.visualstudio.code.oss.png
mkdir -p "$pkgdir"/usr/share/appdata
sed -e "s|@@NAME_LONG@@|Code - OSS|g" \
-e "s|@@NAME@@|code-oss|g" \
-e "s|@@LICENSE@@|MIT|g" \
resources/linux/code.appdata.xml > "$pkgdir"/usr/share/appdata/code-oss.appdata.xml
mkdir -p "$pkgdir"/usr/share/mime/packages
sed -e "s|@@NAME_LONG@@|Code - OSS|g" \
-e "s|@@NAME@@|code-oss|g" \
resources/linux/code-workspace.xml > "$pkgdir"/usr/share/mime/packages/code-oss-workspace.xml
mkdir -p "$pkgdir"/usr/share/bash-completion/completions
sed -e "s|@@APPNAME@@|code-oss|g" \
resources/completions/bash/code > "$pkgdir"/usr/share/bash-completion/completions/code-oss
mkdir -p "$pkgdir"/usr/share/zsh/site-functions
sed -e "s|@@APPNAME@@|code-oss|g" \
resources/completions/zsh/_code > "$pkgdir"/usr/share/zsh/site-functions/_code-oss
mkdir -p "$pkgdir"/usr/lib/code-oss/resources
cp -a ../VSCode-linux-x64/resources/app "$pkgdir"/usr/lib/code-oss/resources/
ln -sfv /usr/bin/rg \
"$pkgdir"/usr/lib/code-oss/resources/app/node_modules.asar.unpacked/@vscode/ripgrep/bin/rg
mkdir -p "$pkgdir"/usr/bin
sed \
-e "s|VSCODE_PATH=/usr/share/vscode|VSCODE_PATH=/usr/lib/code-oss|g" \
-e "s|ELECTRON=.*|ELECTRON=/usr/lib/electron/electron|g" \
-e 's|"$CLI"|"$CLI" --app="${VSCODE_PATH}/resources/app"|g' \
../VSCode-linux-x64/bin/code-oss > "$pkgdir"/usr/bin/code-oss
chmod +x "$pkgdir"/usr/bin/code-oss
}
sha512sums="
2761995f71c336eb82e0ff461898d9616e352ae32314a3dd10caaf3a578f3ac3dea44eaa1f03247aec64461bd5488b02fd68c3306e54e36b65942036272471bd code-oss-1.68.0.tar.gz
f92a6960012ebe280673b7a2d2ff7aedcc6d4404f5ff2e237d07847f8faf4d00ca99c1d84108607fa56399e221707da06dd97faf72e6a95f340e9f61ef8ae128 electron-version.patch
211345de4d34be2a14df69dc027e8440627363aa9937010146211317cf4c1cd699e7085305cfc197680db6ccdeabfccd36797064c416857d9c4156da6b581e29 electron19.patch
062778032c1f29f000fd66143af4d489152c381fce38e95a143d0fa25cf810abd1ec8c17b5b8c5598eaba1d5fb573244cf0aa2bc8256dcaab151538ed07b6545 enable-extensions.patch
445fde371eab1df87a74024cb624bf8f89cf7dd2c50c912de2ab9f6fa05546b2fbb1595dd316e7febca959c5c671c554faf8fef499de520811ea91b48bd1ee15 launcher.patch
b91c35bed74da482d63137f43529ec38dc10a293f52a4d1d1c0d6955d84d5f19e61512147302eaa0901152632bf148bf7b99775315e8e0c00bcf2a2e9e585a0a no-git.patch
"