-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathapp
executable file
·101 lines (85 loc) · 2.31 KB
/
app
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
#!/bin/bash
arg=$1
function prepare_gschema {
mkdir ~/.cache/temp_gschemas 2> /dev/null
cp data/com.github.calo001.fondo.gschema.xml ~/.cache/temp_gschemas/
glib-compile-schemas ~/.cache/temp_gschemas/
export GSETTINGS_SCHEMA_DIR=~/.cache/temp_gschemas/
}
function clear_gschema {
rm ~/.cache/temp_gschemas/* 2> /dev/null
}
function initialize {
meson build --prefix=/usr
result=$?
if [ $result -gt 0 ]; then
echo "Unable to initialize, please review log"
exit 1
fi
cd build
ninja
result=$?
if [ $result -gt 0 ]; then
echo "Unable to build project, please review log"
exit 2
fi
}
function test {
initialize
export DISPLAY=:0
./com.github.calo001.fondo --run-tests
result=$?
export DISPLAY=":0.0"
echo ""
if [ $result -gt 0 ]; then
echo "Failed testing"
exit 100
fi
echo "Tests passed!"
}
case $1 in
"clean")
clear_gschema
sudo rm -rf ./build
;;
"generate-i18n")
initialize
ninja com.github.calo001.fondo-pot
ninja com.github.calo001.fondo-update-po
ninja extra-update-po
;;
"install")
initialize
sudo ninja install
;;
"install-deps")
checkdeps=$(which dpkg-checkbuilddeps)
output=$(${checkdeps[@]} 2>&1)
[ "$?" -eq "0" ] && echo "All dependencies are installed" && exit 0 ;
packages=$(echo $output | sed 's/dpkg-checkbuilddeps: error: Unmet build dependencies: //g')
packages=$(echo $packages | sed -r -e 's/(\([>=<0-9. ]+\))+//g')
command="sudo apt install $packages"
$command
;;
"run")
prepare_gschema
initialize
GOBJECT_DEBUG=instance-count ./com.github.calo001.fondo "${@:2}"
;;
"uninstall")
initialize
sudo ninja uninstall
;;
*)
echo "Usage:"
echo " ./app [OPTION]"
echo ""
echo "Options:"
echo " clean Removes build directories (can require sudo)"
echo " generate-i18n Generates .pot and .po files for i18n (multi-language support)"
echo " install Builds and installs application to the system (requires sudo)"
echo " install-deps Installs missing build dependencies"
echo " run Builds and runs the application"
echo " uninstall Removes the application from the system (requires sudo)"
;;
esac