ptrcports/code-oss/APKBUILD

105 lines
3.7 KiB
Text

# Maintainer: psykose <alice@ayaya.dev>
pkgname=code-oss
pkgver=1.69.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
enable-extensions.patch
launcher.patch
no-git.patch
"
builddir="$srcdir/vscode-$pkgver"
options="!check"
export ELECTRON_SKIP_BINARY_DOWNLOAD=1
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
prepare() {
default_prepare
# fuck you husky
git init . -b xD
yarn config set python python3
yarn install
}
build() {
node --max_old_space_size=3400 ./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="
415418d382123478596801ef83a8b3644e276da984c5d49d3536687da01c80db770977de371bc7840c677c9f776d3f47e4883b25d0529c5621f459ee15caa7ce code-oss-1.69.0.tar.gz
2d35c518c19caf3e7bbbe51a0e91b78ea9a6349136f08692b1e28b9066dd8fd5e40e9668a518dbf2966920d9f8b79365c01188c9fd5b08002f11cdae42a07e8b electron-version.patch
c074df64f63a8f8d733b748d05e8b91b7de0cbb39788dba972032672eea5ddc3c21b72c2df3029b241207c2c61a292eb2dd200f5eb0a6033a0c5db4e8377f69e enable-extensions.patch
445fde371eab1df87a74024cb624bf8f89cf7dd2c50c912de2ab9f6fa05546b2fbb1595dd316e7febca959c5c671c554faf8fef499de520811ea91b48bd1ee15 launcher.patch
b91c35bed74da482d63137f43529ec38dc10a293f52a4d1d1c0d6955d84d5f19e61512147302eaa0901152632bf148bf7b99775315e8e0c00bcf2a2e9e585a0a no-git.patch
"