blob: 3f94f402e12a11c21cb2770d28e045529b3f4320 (
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
|
# Maintainer: Dmitry Valter <`echo ZHZhbHRlciA8YXQ+IHByb3Rvbm1haWwgPGRvdD4gY29tCg== | base64 -d`>
pkgname=drawio-desktop
pkgver=13.3.5
pkgrel=1
pkgdesc='Diagram drawing application built on web technology'
arch=('x86_64')
url='https://github.com/jgraph/drawio-desktop'
license=('Apache')
depends=(electron libnotify)
makedepends=(yarn ant)
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")
sha256sums=('31d1346e9dfa255795703a2cf56cb0b305f33c2bfe8189934689051908665ce0'
'534cce91473c7610cf125033141328b8ac279b2f914e7c42a593a15ee85e3b06')
build() {
cd "$srcdir/drawio-$pkgver"/etc/build
ant app
cd "$srcdir/drawio-$pkgver"/src/main/webapp
rm -rf "META-INF" "WEB-INF"
# disable updater
sed -e '/electron-updater/d' -i 'package.json'
local updater='const autoUpdater = { on: () => {}, setFeedURL: () => {}, checkForUpdates: () => {} }'
sed -e 's/.*require("electron-updater").*/'"$updater"'/' -e '/checkForUpdates,/d' -i 'electron.js'
# fix version in package.json
sed -i 's/"version": ".*"/"version": "'"$pkgver"'"/g' package.json
yarn install --cache-folder ../npm-cache --prod
yarn autoclean -I
yarn autoclean -F
# remove paths refering build directories
find . -name 'package.json' -exec sed "s,$srcdir/src/drawio-$pkgver/src/main/webapp,/usr/lib/drawio,g" -i {} \;
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-$pkgver"/src/main/webapp
mkdir -p "$pkgdir/usr/lib"
cp -rp . "$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 /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=draw.io' \
'Comment=draw.io desktop' \
'Exec=/usr/bin/draw.io %U' \
'Terminal=false' \
'Type=Application' \
'Icon=draw.io' \
'Categories=Graphics;' \
> "$pkgdir/usr/share/applications/draw.io.desktop"
ln -s /usr/bin/draw.io "$pkgdir/usr/bin/drawio"
MIMETYPE="$(grep mimeType "$srcdir/drawio-desktop-$pkgver/electron-builder-linux-mac.json" | sed 's/.*"mimeType":.*"\(.*\)".*/\1/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
done
}
|