forked from boehs/Lightly
-
Notifications
You must be signed in to change notification settings - Fork 8
/
install.sh
executable file
·120 lines (109 loc) · 3.91 KB
/
install.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
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
#!/bin/env bash
QT_BUILD=$1
SRC_DIR=$(pwd)
BUILD_DIR="$SRC_DIR/build"
CMAKE_OPTS=(
-B $BUILD_DIR
-S $SRC_DIR
-DBUILD_TESTING=OFF
-Wno-dev
-DKDE_INSTALL_USE_QT_SYS_PATHS=ON
)
PROJECT="lightly"
_PROJECT="Lightly"
build_qt6() {
echo " *** Building with QT6 *** "
remove_build
remove_qt6_files
cmake "${CMAKE_OPTS[@]}" -DBUILD_QT6=ON -DBUILD_QT5=OFF && cmake --build $BUILD_DIR -j $(nproc) && cd $BUILD_DIR && sudo cmake --install . && echo "Installation completed!" || echo "Installation failed!" && exit 1
cd "$SRC_DIR"
}
build_qt5() {
echo " *** Building with QT5 *** "
remove_build
remove_qt5_files
cmake "${CMAKE_OPTS[@]}" -DBUILD_QT6=OFF -DBUILD_QT5=ON && cmake --build $BUILD_DIR -j $(nproc) && cd $BUILD_DIR && sudo cmake --install . && echo "Installation completed!" || echo "Installation failed!" && exit 1
cd "$SRC_DIR"
}
# build using QT5 and QT6
build_default() {
echo " *** Building with QT5 && QT6 *** "
remove_build
remove_qt5_files
remove_qt6_files
cmake "${CMAKE_OPTS[@]}" && cmake --build $BUILD_DIR -j $(nproc) && cd $BUILD_DIR && sudo cmake --install . && echo "Installation completed!" || echo "Installation failed!" && exit 1
cd "$SRC_DIR"
}
remove_build() {
if [ -d "$SRC_DIR/build" ]; then
echo "Removing existing build directory"
sudo rm -rf $SRC_DIR/build
fi
cd "$SRC_DIR"
}
# if existing
remove_qt6_files() {
files=(
"/usr/lib64/qt6/plugins/styles/${PROJECT}6.so*"
"/usr/lib/qt6/plugins/styles/${PROJECT}6.so*"
"/usr/share/kstyle/themes/${PROJECT}.themerc"
"/usr/lib64/qt6/plugins/kstyle_config/${PROJECT}styleconfig.so*"
"/usr/lib/qt6/plugins/kstyle_config/${PROJECT}styleconfig.so*"
"/usr/share/applications/${PROJECT}styleconfig.desktop"
"/usr/bin/${PROJECT}-settings6"
"/usr/share/icons/hicolor/scalable/apps/${PROJECT}-settings.svgz"
"/usr/lib64/lib${PROJECT}common6.so*"
"/usr/lib/lib${PROJECT}common6.so.*"
"/usr/lib64/lib${PROJECT}common6.so*"
"/usr/lib/lib${PROJECT}common6.so*"
"/usr/lib64/qt6/plugins/org.kde.kdecoration2/org.kde.${PROJECT}.so*"
"/usr/lib/qt6/plugins/org.kde.kdecoration2/org.kde.${PROJECT}.so*"
"/usr/lib64/qt6/plugins/org.kde.kdecoration2.kcm/kcm_${PROJECT}decoration.so*"
"/usr/lib/qt6/plugins/org.kde.kdecoration2.kcm/kcm_${PROJECT}decoration.so*"
"/usr/share/applications/kcm_${PROJECT}decoration.desktop"
"/usr/lib64/cmake/${PROJECT}/${PROJECT}Config.cmake"
"/usr/lib/cmake/${PROJECT}/${PROJECT}Config.cmake"
"/usr/lib64/cmake/${PROJECT}/${PROJECT}ConfigVersion.cmake"
"/usr/lib/cmake/${PROJECT}/${PROJECT}ConfigVersion.cmake"
"/usr/share/color-schemes/${_PROJECT}.colors"
/usr/lib/cmake/"${PROJECT^}"
"/usr/lib/x86_64-linux-gnu/qt6/plugins/org.kde.kdecoration2/org.kde.${PROJECT}.so*"
"/usr/lib/x86_64-linux-gnu/qt6/plugins/kstyle_config/${PROJECT}styleconfig.so*"
"/usr/lib/x86_64-linux-gnu/qt6/plugins/org.kde.kdecoration2.kcm/kcm_${PROJECT}decoration.so*"
"/usr/lib/x86_64-linux-gnu/qt6/plugins/styles/${PROJECT}6.so*"
)
for f in ${files[@]}; do
sudo rm -rf "$f"
done
}
# if existing
remove_qt5_files() {
files=(
"/usr/lib64/qt5/plugins/styles/${PROJECT}5.so*"
"/usr/lib/qt5/plugins/styles/${PROJECT}5.so*"
"/usr/lib64/lib${PROJECT}common5.so*"
"/usr/lib/lib${PROJECT}common5.so*"
"/usr/lib64/lib${PROJECT}common5.so*"
"/usr/lib/lib${PROJECT}common5.so*"
"/usr/lib64/qt/plugins/styles/${PROJECT}5.so*"
"/usr/lib/x86_64-linux-gnu/qt5/plugins/styles/${PROJECT}5.so*"
)
for f in ${files[@]}; do
sudo rm -rf "$f"
done
}
case "$QT_BUILD" in
qt5 | QT5)
build_qt5
;;
qt6 | QT6)
build_qt6
;;
remove)
remove_qt5_files
remove_qt6_files
;;
*)
build_default
;;
esac