-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path_zynth_lib.sh
134 lines (115 loc) · 2.64 KB
/
_zynth_lib.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
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/sh
###############################################################################
# GLOBAL VARS
###############################################################################
_git_options=""
PROJECT=`basename ${0} .sh`
###############################################################################
# FUNCTIONS
###############################################################################
quote_path () {
echo ${1} | sed 's/\//\\\//g'
}
zynth_build_request () {
flag=${1}
if [ "x${flag}" = "xclear" ]
then
rm -f "${ZYNTHIAN_SW_BUILD_DIR}/${PROJECT}_build"
elif [ "x${flag}" = "xready" ]
then
touch "${ZYNTHIAN_SW_BUILD_DIR}/${PROJECT}_build"
fi
}
zynth_svn () {
ret=0
if [ ${2} ]
then
tmp=`basename ${2}`
else
tmp=`basename ${1}`
fi
repo_dir=`basename ${tmp} -code`
if [ -d "${repo_dir}" ]
then
cd "${repo_dir}"
svn update 2>&1 | grep "At revision"
if [ ${?} -eq 1 ]
then
ret=1
fi
cd ..
else
svn checkout "${1}" "${repo_dir}"
ret=1
fi
return ${ret}
}
zynth_git () {
ret=0
tmp=`basename ${1}`
repo_dir=`basename ${tmp} .git`
if [ -d "${repo_dir}" ]
then
cd "${repo_dir}"
git_message=`git pull 2>&1`
if [ ! `echo "${message}" | grep -Eq "up-to-date"` ]
then
zynth_build_request ready
else
ret=99
zynth_build_request clear
fi
cd ..
else
if [ "x${_git_options}" = "x" ]
then
git clone "${1}"
else
git clone "${_git_options}" "${1}"
fi
ret=1
fi
return ${ret}
}
zynth_git_recursive () {
_git_options="--recursive"
ret=`zynth_git $*`
return ${ret}
}
###############################################################################
# MAIN
###############################################################################
echo "PROJECT: $PROJECT"
if [ "${1}" = "build" ]
then
shift
build="build"
zynth_build_request clear
elif [ "${1}" = "clean" ]
then
shift
build="clean"
zynth_build_request clear
fi
if [ ! -d "${ZYNTHIAN_SW_DIR}/.build" ]
then
mkdir "${ZYNTHIAN_SW_DIR}/.build"
fi
ZYNTHIAN_SW_BUILD_DIR="${ZYNTHIAN_SW_DIR}/.build"
machine=`uname -m 2>/dev/null || echo unknown`
if [ "${machine}" = "armv7l" ]
then
model=`cat /sys/firmware/devicetree/base/model` 2>/dev/null || echo unknown
if echo "${model}" | egrep -Eq '[3]'
then
CPU="-mcpu=cortex-a53"
FPU="-mfpu=neon-fp-armv8"
else
CPU="-mcpu=cortex-a7 -mthumb"
FPU="-mfpu=neon-vfpv4"
fi
FPU="${FPU} -mneon-for-64bits"
export RASPI=true
export CFLAGS="${CPU} ${FPU}"
export CXXFLAGS="${CFLAGS}"
fi