forked from webmastak/gnome-shell-extensions-mediaplayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
executable file
·60 lines (52 loc) · 1.17 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
#!/usr/bin/sh
# Possible arguments
#./build --install
#To build and install locally.
#./build --zip-file
#To build and the zip file.
BUILD_DIR="builddir"
LOCAL_PREFIX="$HOME/.local"
UUID="[email protected]"
TMP_DIR="/tmp/share/gnome-shell/extensions/$UUID"
build_type=$1
if [ -z $build_type ]; then
build_type="--install"
fi
if [ -d "$PWD/$BUILD_DIR" ]; then
echo "A current build directory already exists. Would you like to remove it?"
select yn in "Yes" "No"; do
case $yn in
Yes )
rm -rf "$PWD/$BUILD_DIR"
echo "Build directory was removed succesufly"
break;;
No )
echo "The old build directory must be removed first. Exiting"
exit;;
esac
done
fi
function build {
prefix=$1
meson $BUILD_DIR --prefix=$prefix
ninja -C $BUILD_DIR install
}
case $build_type in
"--install"*)
build $LOCAL_PREFIX
;;
"--zip-file"*)
build "/tmp"
dest=$PWD
cd $TMP_DIR || exit
zip -rq $dest/$UUID.zip .
if [ -d $TMP_DIR ]; then
rm -rf $TMP_DIR
fi
cd $dest
;;
esac
if [ -d "$PWD/$BUILD_DIR" ]; then
rm -rf $PWD/$BUILD_DIR
fi
echo "Done"