forked from zouxf1024/libmali
-
Notifications
You must be signed in to change notification settings - Fork 4
/
parse_name.sh
executable file
·59 lines (50 loc) · 964 Bytes
/
parse_name.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
#!/bin/sh
PRINT_GPU=false
PRINT_VERSION=false
PRINT_SUBVERSION=false
PRINT_PLATFORM=false
PLATFORMS="gbm|wayland|x11|only-cl|dummy"
parse_name() {
[ -z "$1" ] && return
GPU=$(echo $1|cut -d'-' -f'2,3')
VERSION=$(echo $1|cut -d'-' -f4)
PLATFORM=$(echo $1|grep -owE "$PLATFORMS"|xargs -n 1|tail -1)
[ -z "$PLATFORM" ] && PLATFORM=x11
SUBVERSION=$(echo ${1%-$PLATFORM}|cut -d'-' -f'5-')
if $PRINT_GPU;then
echo $GPU
elif $PRINT_VERSION;then
echo $VERSION
elif $PRINT_SUBVERSION;then
echo $SUBVERSION
elif $PRINT_PLATFORM;then
echo $PLATFORM
else
echo name=$1
echo gpu=$GPU
echo version=$VERSION
echo subversion=$SUBVERSION
echo platform=$PLATFORM
fi
}
case "$1" in
--gpu)
PRINT_GPU=true
shift
;;
--version)
PRINT_VERSION=true
shift
;;
--subversion)
PRINT_SUBVERSION=true
shift
;;
--platform)
PRINT_PLATFORM=true
shift
;;
esac
for lib in "$@";do
parse_name $(echo $lib|grep -o "libmali-[^\.]*")
done