-
Notifications
You must be signed in to change notification settings - Fork 28
/
build.sh
executable file
·57 lines (49 loc) · 1.06 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
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
export SYNCER_HOME="${ROOT}"
OPTS="$(getopt \
-n "$0" \
-o 'j:' \
-l 'clean' \
-l 'output:' \
-- "$@")"
eval set -- "${OPTS}"
SYNCER_OUTPUT="${SYNCER_HOME}/output"
PARALLEL="$(($(nproc) / 4 + 1))"
while true; do
case "$1" in
-j)
PARALLEL="$2"
shift 2
;;
--clean)
CLEAN=1
shift
;;
--output)
SYNCER_OUTPUT="$2"
shift 2
;;
--)
shift
break
;;
*)
echo "Internal error, opt: $OPTS"
exit 1
;;
esac
done
export GOMAXPROCS=${PARALLEL}
mkdir -p ${SYNCER_OUTPUT}/bin
mkdir -p ${SYNCER_OUTPUT}/log
mkdir -p ${SYNCER_OUTPUT}/db
if [[ "${CLEAN}" -eq 1 ]]; then
rm -rf ${SYNCER_HOME}/bin
exit 0
fi
make ccr_syncer
cp ${SYNCER_HOME}/bin/ccr_syncer ${SYNCER_OUTPUT}/bin/
cp ${SYNCER_HOME}/shell/* ${SYNCER_OUTPUT}/bin/
cp -r ${SYNCER_HOME}/doc ${SYNCER_OUTPUT}/
cp ${SYNCER_HOME}/CHANGELOG.md ${SYNCER_OUTPUT}/
cp ${SYNCER_HOME}/README.md ${SYNCER_OUTPUT}/