blob: 72b2e3165cc33a47a752cdefe42aba88a46fd55f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
# Maintainer: Curve <curve.platin at gmail.com>
# Contributor: Francisco Magalhães <franmagneto gmail com>
# Contributor: Filipe Laíns (FFY00) <lains@archlinux.org>
# Contributor: Curve <curve.platin at gmail.com>
pkgname=vscode-transparent-insiders
pkgdesc='The Open Source build of Visual Studio Code (vscode) editor - with transparency enabled - based on insiders commit'
_pkgname=code
_electron=electron
_commit=04770364fdc1bebeca9d1a257df2cacce06b35d6
pkgver=1.55.0_insiders
pkgrel=1
arch=('i686' 'x86_64' 'armv7h')
url='https://github.com/microsoft/vscode'
license=('MIT')
depends=("$_electron" 'libsecret' 'libx11' 'libxkbfile' 'ripgrep')
optdepends=('bash-completion: Bash completions'
'zsh-completions: ZSH completitons'
'x11-ssh-askpass: SSH authentication')
makedepends=('git' 'gulp' 'npm' 'python2' 'yarn' 'nodejs-lts-fermium')
conflicts=('code')
provides=('code')
install='code-transparent.install'
source=("$_pkgname::git+$url.git#commit=$_commit"
"${_pkgname}.js"
"${_pkgname}.sh"
"transparency.diff"
"product_json.diff"
"code-liveshare.diff")
sha512sums=('SKIP'
'a97cbc79d76d2dad2ced74d66fa57b9a0aa3d82767d420b520bbaaf007c03ac60d61134668895ab4a8bd38951974c42afc59c03105ccc892742b34fee9b2c509'
'9bd93ec7ba946c005d3a12ea71ae2903593d17d3e4dcf55b4a5b612ebc82237338f0aaec59613eb77f355b0116aeb31320d0d32cd993233f140479ced44dfdbf'
'3d950836294e2ceb57851a2903c0789deff29e60c76a89d3615d450d19ac27c84f5a1a85166d47a3bb2cbe0617836d81172b3b529e70a17f7a928e8ba9133abf'
'108f97f6a1cc5f12e23525ee288c375f961c4aaf1ef598d20618349386e9b6b5514143066876de1eff279235faecaaf5a8f8a54cfe46ea98d5e4e667b584193c'
'a9f2f3e07f8ffe9def036cb2aa6d587444ea1cf9d9e1b29637b3d86ccf98e3ee2c50d219405155449c06654f753a296a820b11bdab48928baf25043217f149a0')
# Even though we don't officially support other archs, let's
# allow the user to use this PKGBUILD to compile the package
# for his architecture
case "$CARCH" in
i686)
_vscode_arch=ia32
;;
x86_64)
_vscode_arch=x64
;;
armv7h)
_vscode_arch=arm
;;
*)
# Needed for mksrcinfo
_vscode_arch=DUMMY
;;
esac
prepare() {
cd $_pkgname
git checkout $_commit
# Change electron binary name to the target electron
sed -i "s|exec electron |exec $_electron |" ../code.sh
patch -p0 < ../product_json.diff
patch -p1 <../transparency.diff
# Set the commit and build date
local _commit=$(git rev-parse HEAD)
local _datestamp=$(date -u -Is | sed 's/\+00:00/Z/')
sed -e "s/@COMMIT@/$_commit/" -e "s/@DATE@/$_datestamp/" -i product.json
patch -p1 -i "${srcdir}/code-liveshare.diff"
# Build native modules for system electron
local _target=$(</usr/lib/$_electron/version)
sed -i "s/^target .*/target \"${_target//v/}\"/" .yarnrc
# Patch appdata and desktop file
sed -i 's|/usr/share/@@NAME@@/@@NAME@@|@@NAME@@|g
s|@@NAME_SHORT@@|Code|g
s|@@NAME_LONG@@|Code - OSS|g
s|@@NAME@@|code-oss|g
s|@@ICON@@|com.visualstudio.code.oss|g
s|@@EXEC@@|/usr/bin/code-oss|g
s|@@LICENSE@@|MIT|g
s|@@URLPROTOCOL@@|vscode|g
s|inode/directory;||' resources/linux/code{.appdata.xml,.desktop,-url-handler.desktop}
sed -i 's|MimeType=.*|MimeType=x-scheme-handler/code-oss;|' resources/linux/code-url-handler.desktop
# Add completitions for code-oss
cp resources/completions/bash/code resources/completions/bash/code-oss
cp resources/completions/zsh/_code resources/completions/zsh/_code-oss
# Patch completitions with correct names
sed -i 's|@@APPNAME@@|code|g' resources/completions/{bash/code,zsh/_code}
sed -i 's|@@APPNAME@@|code-oss|g' resources/completions/{bash/code-oss,zsh/_code-oss}
# Fix bin path
sed -i "s|return path.join(path.dirname(execPath), 'bin', \`\${product.applicationName}\`);|return '/usr/bin/code';|g
s|return path.join(appRoot, 'scripts', 'code-cli.sh');|return '/usr/bin/code';|g" \
src/vs/platform/environment/node/environmentService.ts
}
build() {
# https://github.com/mapbox/node-sqlite3/issues/1044
mkdir -p path
ln -sf /usr/bin/python2 path/python
export PATH="$PWD/path:$PATH"
cd $_pkgname
yarn install --arch=$_vscode_arch
# The default memory limit may be too low for current versions of node
# to successfully build vscode. Change it if this number still doesn't
# work for your system.
mem_limit="--max_old_space_size=8192"
if ! /usr/bin/node $mem_limit /usr/bin/gulp vscode-linux-$_vscode_arch-min
then
echo
echo "*** NOTE: If the build failed due to running out of file handles (EMFILE),"
echo "*** you will need to raise your max open file limit."
echo "*** You can check this for more information on how to increase this limit:"
echo "*** https://ro-che.info/articles/2017-03-26-increase-open-files-limit"
exit 1
fi
}
package() {
# Install resource files
install -dm 755 "$pkgdir"/usr/lib/$_pkgname
cp -r --no-preserve=ownership --preserve=mode VSCode-linux-$_vscode_arch/resources/app/* "$pkgdir"/usr/lib/$_pkgname/
# Replace statically included binary with system copy
ln -sf /usr/bin/rg "$pkgdir"/usr/lib/code/node_modules.asar.unpacked/vscode-ripgrep/bin/rg
# Install binary
install -Dm 755 code.sh "$pkgdir"/usr/bin/code-oss
install -Dm 755 code.js "$pkgdir"/usr/lib/$_pkgname/code.js
ln -sf /usr/bin/code-oss "$pkgdir"/usr/bin/code
# Install appdata and desktop file
install -Dm 644 $_pkgname/resources/linux/code.appdata.xml "$pkgdir"/usr/share/metainfo/code-oss.appdata.xml
install -Dm 644 $_pkgname/resources/linux/code.desktop "$pkgdir"/usr/share/applications/code-oss.desktop
install -Dm 644 $_pkgname/resources/linux/code-url-handler.desktop "$pkgdir"/usr/share/applications/code-oss-url-handler.desktop
install -Dm 644 VSCode-linux-$_vscode_arch/resources/app/resources/linux/code.png "$pkgdir"/usr/share/pixmaps/com.visualstudio.code.oss.png
# Install bash and zsh completions
install -Dm 644 $_pkgname/resources/completions/bash/code "$pkgdir"/usr/share/bash-completion/completions/code
install -Dm 644 $_pkgname/resources/completions/bash/code-oss "$pkgdir"/usr/share/bash-completion/completions/code-oss
install -Dm 644 $_pkgname/resources/completions/zsh/_code "$pkgdir"/usr/share/zsh/site-functions/_code
install -Dm 644 $_pkgname/resources/completions/zsh/_code-oss "$pkgdir"/usr/share/zsh/site-functions/_code-oss
# Install license files
install -Dm 644 VSCode-linux-$_vscode_arch/resources/app/LICENSE.txt "$pkgdir"/usr/share/licenses/$_pkgname/LICENSE
install -Dm 644 VSCode-linux-$_vscode_arch/resources/app/ThirdPartyNotices.txt "$pkgdir"/usr/share/licenses/$_pkgname/ThirdPartyNotices.txt
}
|