forked from Zren/plasma-applet-eventcalendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
executable file
·70 lines (57 loc) · 2.21 KB
/
build
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
#!/bin/bash
# Version 13
### User Variables
qtMinVer="5.12"
kfMinVer="5.68"
plasmaMinVer="5.13"
filenameTag="-plasma${plasmaMinVer}"
### Misc
startDir=$PWD
### Check QML Versions
# See https://zren.github.io/kde/versions/ for distro versions
if [ -f checkimports.py ]; then
python3 checkimports.py --qt="$qtMinVer" --kf="$kfMinVer" --plasma="$plasmaMinVer"
if [ $? == 1 ]; then
exit 1
fi
fi
### Translations
if [ -d "package/translate" ]; then
echo "[build] translate dir found, running merge."
(cd package/translate && sh ./merge)
(cd package/translate && sh ./build)
if [ "$(git diff --stat .)" != "" ]; then
echo "[build] Changed detected. Cancelling build."
git diff --stat .
exit 1
fi
fi
### Variables
packageNamespace=`kreadconfig5 --file="$PWD/package/metadata.desktop" --group="Desktop Entry" --key="X-KDE-PluginInfo-Name"`
packageName="${packageNamespace##*.}" # Strip namespace (Eg: "org.kde.plasma.")
packageVersion=`kreadconfig5 --file="$PWD/package/metadata.desktop" --group="Desktop Entry" --key="X-KDE-PluginInfo-Version"`
packageAuthor=`kreadconfig5 --file="$PWD/package/metadata.desktop" --group="Desktop Entry" --key="X-KDE-PluginInfo-Author"`
packageAuthorEmail=`kreadconfig5 --file="$PWD/package/metadata.desktop" --group="Desktop Entry" --key="X-KDE-PluginInfo-Email"`
packageWebsite=`kreadconfig5 --file="$PWD/package/metadata.desktop" --group="Desktop Entry" --key="X-KDE-PluginInfo-Website"`
packageComment=`kreadconfig5 --file="$PWD/package/metadata.desktop" --group="Desktop Entry" --key="Comment"`
### metadata.desktop => metadata.json
if command -v desktoptojson &> /dev/null ; then
genOutput=`desktoptojson --serviceType="plasma-applet.desktop" -i "$PWD/package/metadata.desktop" -o "$PWD/package/metadata.json"`
if [ "$?" != "0" ]; then
exit 1
fi
# Tabify metadata.json
sed -i '{s/ \{4\}/\t/g}' "$PWD/package/metadata.json"
fi
### *.plasmoid
filename="${packageName}-v${packageVersion}${filenameTag}.plasmoid"
rm ${packageName}-v*.plasmoid # Cleanup
(cd package \
&& zip -r $filename * \
&& mv $filename $startDir/$filename \
)
cd $startDir
echo "[plasmoid] md5: $(md5sum $filename | awk '{ print $1 }')"
echo "[plasmoid] sha256: $(sha256sum $filename | awk '{ print $1 }')"
### Done
cd $startDir