blob: df617318b50f4f9cc1b3f0ce0919b95e2bcaa86a (
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
|
# Maintainer: Dmitry Valter <`echo ZHZhbHRlciA8YXQ+IHByb3Rvbm1haWwgPGRvdD4gY29tCg== | base64 -d`>
pkgname=drawio-desktop
pkgver=20.8.16
pkgrel=1
pkgdesc='Diagram drawing application built on web technology'
arch=('any')
url='https://github.com/jgraph/drawio-desktop'
license=('Apache')
_electronver=21
depends=("electron$_electronver" libnotify shared-mime-info)
makedepends=(yarn ant 'nodejs>=12')
options=('!strip')
source=("drawio-$pkgver.tar.gz::https://github.com/jgraph/drawio/archive/v$pkgver.tar.gz"
"drawio-desktop-$pkgver.tar.gz::https://github.com/jgraph/drawio-desktop/archive/v$pkgver.tar.gz"
"drawio.xml")
sha512sums=('c40b1006dac7c07332821e3048e4d6f8247a10b7754b2ec969266c12ec2736431dddf0874265c79230fe09705d6759944779a805c99385a772010f02f20455f5'
'20202a7d527728555b45571954bda24437f4328d43547a0d4211d58aaf5e4a2606f95ea00310388dad0d15e366dcf78516ee3b861068cc11aa4655622fc45a3d'
'8899108b4112f065173a077ca68d4d915780bcc993c69924098e134fa05338a20cb0391720b7b45c27071f789fbe5a6a02228dd633570e91fb4482082c480539')
build() {
rm -rf "$srcdir/drawio-desktop-$pkgver/drawio"
mv "$srcdir/drawio-$pkgver" "$srcdir/drawio-desktop-$pkgver/drawio"
cd "$srcdir/drawio-desktop-$pkgver"/drawio/etc/build
ant app
cd "$srcdir/drawio-desktop-$pkgver"
rm -rf "META-INF" "WEB-INF"
# Electron version compatibility check
grep -qF "\"electron\": \"^$_electronver." 'package.json'
# disable updater
sed -e '/electron-updater/d' -i 'package.json'
sed -e '/"electron":/d' -i 'package.json'
sed -e '/"electron-builder":/d' -i 'package.json'
sed -e '/"electron-notarize":/d' -i 'package.json'
local updater='const autoUpdater = { on: () => {}, setFeedURL: () => {}, checkForUpdates: () => {} }'
sed -e 's/.*require("electron-updater").*/'"$updater"'/' -e '/checkForUpdates,/d' -i 'drawio/src/main/webapp/electron.js'
# fix version in package.json
sed -i 's/"version": ".*"/"version": "'"$pkgver"'"/g' package.json
cd "$srcdir/drawio-desktop-$pkgver"
yarn install --cache-folder ../npm-cache --prod
yarn autoclean -I
yarn autoclean -F
rm -f 'package-lock.json'
find . -name '.yarnclean' -exec rm -fv {} \;
find . -name 'yarn.lock' -exec rm -fv {} \;
find . -name '.airtap.yml' -exec rm -fv {} \;
find . -name '.bin' -exec rm -fvr {} +
find . -name 'well-known' -exec rm -fvr {} +
find . -name '.coveralls.yml' -exec rm -fv {} \;
find . -name '.gitignore' -exec rm -fv {} \;
find . -name '.github' -exec rm -fvr {} +
find . -name '.eslintrc*' -exec rm -fv {} \;
find . -name '.jscs.json' -exec rm -fv {} \;
find . -name '.npmignore' -exec rm -fv {} \;
find . -name '.prettierrc.js' -exec rm -fv {} \;
find . -name '.travis.yml' -exec rm -fv {} \;
find . -name '.tonic_example.js' -exec rm -fv {} \;
}
package() {
cd "$srcdir/drawio-desktop-$pkgver"
mkdir -p "$pkgdir/usr/lib/draw.io"
cp -rp package.json *.js drawio node_modules "$pkgdir/usr/lib/draw.io"
# fix file permissions
chmod -R g+r,o+r "$pkgdir/usr/lib/draw.io"
# create run script
mkdir -p "$pkgdir/usr/bin"
printf '%s\n' \
'#!/bin/sh' \
"exec electron$_electronver /usr/lib/draw.io \"\$@\"" \
> "$pkgdir/usr/bin/draw.io"
chmod a+x "$pkgdir/usr/bin/draw.io"
# create desktop file
mkdir -p "$pkgdir/usr/share/applications"
printf '%s\n' \
'[Desktop Entry]' \
'Name=drawio' \
'Comment=draw.io desktop' \
'Exec=/usr/bin/draw.io %U' \
'Terminal=false' \
'Type=Application' \
'Icon=draw.io' \
'StartupWMClass=draw.io' \
'Categories=Graphics;' \
> "$pkgdir/usr/share/applications/draw.io.desktop"
ln -s /usr/bin/draw.io "$pkgdir/usr/bin/drawio"
# shared-mime-info defines vsdx differently from vsd, thus upstream setup seems to be incorrect
MIMETYPE="$(grep mimeType "$srcdir/drawio-desktop-$pkgver/electron-builder-linux-mac.json" | \
sed 's/.*"mimeType":.*"\(.*\)".*/\1/g' | \
sed 's/vnd\.visio/vnd.ms-visio.drawing.main+xml/g' | tr '\n' ';')"
if [[ -n "${MIMETYPE}" ]]; then
echo "MimeType=${MIMETYPE}" >> "$pkgdir/usr/share/applications/draw.io.desktop"
fi
# create icons
cd "$srcdir/drawio-desktop-$pkgver"
find 'build' -regex '.*/[0-9]+x[0-9]+\.png' |
grep -o '[0-9]\+' |
sort -u |
while read size; do
if [[ -f "build/${size}x${size}.png" ]]; then
install -Dm644 "build/${size}x${size}.png" \
"$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/draw.io.png"
fi
install -Dm644 "$srcdir/drawio.xml" "$pkgdir/usr/share/mime/packages/drawio.xml"
done
}
|