-
Notifications
You must be signed in to change notification settings - Fork 12
/
package.sh
72 lines (57 loc) · 2.06 KB
/
package.sh
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
#!/bin/bash
# Exit immediately if something fails
set -e
if [ -z "$1" ]; then
echo "Usage: $0 [debian|generic]"
exit 1
fi
# Set up clean build directory
mkdir build 2> /dev/null || rm -rf build/*
cd build
# Fetch current version
version=$(grep X-KDE-PluginInfo-Version ../plasma-runner-symbols.desktop|grep -oE "[0-9]+\..*\..*"|tr '.' ' ')
vmajor=$(echo $version|awk '{print $1}')
vminor=$(echo $version|awk '{print $2}')
vpatch=$(echo $version|awk '{print $3}')
if [ "$1" == "generic" ]; then
# Build generic "flat" package to be installed via install.sh
# Build the plugin in the build/ directory without any folder hierarchy
cmake .. -DLOCATION_PLUGIN=. -DLOCATION_DESKTOP=. -DLOCATION_CONFIG=. \
-DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
# Package the plugin
make package
# Copy files from build directory
outfile="krunner-symbols-$vmajor.$vminor.$vpatch-Linux.tar.gz"
cp "$outfile" ..
cd ..
echo
echo "======================================"
echo "Package created successfully: $outfile"
echo "Install package by executing <bash install.sh> in this directory."
echo
else
# Build DEB package
# Get correct installation directories: relative paths without leading prefix.
prefix=$(kf5-config --prefix)
loc_plugin=$(kf5-config --qt-plugins|sed 's.^'"$prefix"'/..')
loc_desktop=$(kf5-config --path services|awk -F ':' '{print $NF}'|sed 's.^'"$prefix"'/..')
loc_config=share/config
# Build the plugin
cmake .. -DCPACK_DEBIAN=true -DCMAKE_INSTALL_PREFIX=$prefix \
-DLOCATION_PLUGIN=$loc_plugin \
-DLOCATION_DESKTOP=$loc_desktop \
-DLOCATION_CONFIG=$loc_config \
-DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
# Package the plugin
make package
# Copy file from build directory
outfile="krunner-symbols-$vmajor.$vminor.$vpatch.deb"
cp "$outfile" ..
echo
echo "======================================"
echo "Package created successfully: $outfile"
echo "Install package by executing <sudo dpkg -i $outfile>."
echo
fi