-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathbuild.sh
executable file
·77 lines (66 loc) · 2.05 KB
/
build.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
#!/bin/bash
###
# @Description: Build script of AlgHelmetWearingMonitoring.
# @version: 1.0
# @Author: Ricardo Lu<[email protected]>
# @Date: 2022-07-01 10:12:47
# @LastEditors: Ricardo Lu
# @LastEditTime: 2022-07-11 20:10:55
###
#set -x
ALGNAME=yolov5s
CURUSER=`whoami`
SUDO=""
[ "$CURUSER" == "root" ] || SUDO="sudo"
#------------------------------------------------------------------------------
# calculate version
#------------------------------------------------------------------------------
VERSION=2.0
#------------------------------------------------------------------------------
# prepare
#------------------------------------------------------------------------------
pushd ${0%/*} > /dev/null 2>&1
rm -rf build > /dev/null 2>&1
mkdir -p build > /dev/null 2>&1
pushd build > /dev/null 2>&1
#------------------------------------------------------------------------------
# build & install
#------------------------------------------------------------------------------
echo -n -e "build and install ALG $ALGNAME \t... "
cmake .. > /dev/null 2>&1
if [ $? != 0 ]; then
echo "[failed]"
popd -n -2 > /dev/null 2>&1
exit 1
fi
make -j4 > /dev/null 2>&1
if [ $? != 0 ]; then
echo "[failed]"
popd -n -2 > /dev/null 2>&1
exit 1
fi
$SUDO make install > /dev/null 2>&1
if [ $? != 0 ]; then
echo "[failed]"
popd -n -2 > /dev/null 2>&1
exit 1
fi
echo "[ok]"
#------------------------------------------------------------------------------
# build deb package
#------------------------------------------------------------------------------
echo -n -e "build ALG $ALGNAME deb package \t... "
checkinstall -D -y --install=no --maintainer=THUNDERCOMM \
--pkgversion=$VERSION --pkgrelease=rel --pkggroup=algorithm \
--pkgname=Alg-${ALGNAME}-01-Linux > /dev/null 2>&1
if [ $? != 0 ]; then
echo "[failed]"
popd -n -2 > /dev/null 2>&1
exit 1
fi
echo "[ok]"
#------------------------------------------------------------------------------
# end
#------------------------------------------------------------------------------
popd -n -2 > /dev/null 2>&1
exit 0