ptrcports/code-oss/APKBUILD

107 lines
3.9 KiB
Text

# Maintainer: psykose <alice@ayaya.dev>
pkgname=code-oss
pkgver=1.68.1
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="
91b1b5c610d2d9564de34634e3b3d4de9703c5422901d5fc96592fe977db663aaa8ceab70cbaddedab13cc93aca0def25b1e42244d196deb0a2eb2fadc04cd6c code-oss-1.68.1.tar.gz
f92a6960012ebe280673b7a2d2ff7aedcc6d4404f5ff2e237d07847f8faf4d00ca99c1d84108607fa56399e221707da06dd97faf72e6a95f340e9f61ef8ae128 electron-version.patch
211345de4d34be2a14df69dc027e8440627363aa9937010146211317cf4c1cd699e7085305cfc197680db6ccdeabfccd36797064c416857d9c4156da6b581e29 electron19.patch
c074df64f63a8f8d733b748d05e8b91b7de0cbb39788dba972032672eea5ddc3c21b72c2df3029b241207c2c61a292eb2dd200f5eb0a6033a0c5db4e8377f69e enable-extensions.patch
445fde371eab1df87a74024cb624bf8f89cf7dd2c50c912de2ab9f6fa05546b2fbb1595dd316e7febca959c5c671c554faf8fef499de520811ea91b48bd1ee15 launcher.patch
b91c35bed74da482d63137f43529ec38dc10a293f52a4d1d1c0d6955d84d5f19e61512147302eaa0901152632bf148bf7b99775315e8e0c00bcf2a2e9e585a0a no-git.patch
"