-
Notifications
You must be signed in to change notification settings - Fork 9
/
make.sh
executable file
·65 lines (56 loc) · 1.14 KB
/
make.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
#!/bin/sh -e
__DIR__=$(cd "$(dirname "$0")";pwd)
COMPILE_PARAMS="--enable-swoole"
if [ "$(uname | grep -i darwin)"x != ""x ]; then
CPU_COUNT="$(sysctl -n machdep.cpu.core_count)"
else
CPU_COUNT="$(/usr/bin/nproc)"
fi
if [ -z ${CPU_COUNT} ]; then
CPU_COUNT=4
fi
cd "${__DIR__}"
if [ "$1" = "cmake" ] ;then
phpize
./configure ${COMPILE_PARAMS}
cmake .
make -j ${CPU_COUNT}
exit 0
fi
if [ "$1" = "clean" ] ;then
make clean
phpize --clean
exit 0
fi
if [ "$1" = "install-module" ] ;then
make tdengine
__EXT_DIR__=$(php-config --extension-dir)
cp lib/tdengine.so "${__EXT_DIR__}"
echo "cp lib/tdengine.so ${__EXT_DIR__}"
exit 0
fi
if [ "$1" = "help" ] ;then
echo "./make.sh cmake"
echo "./make.sh install-module"
echo "./make.sh clean"
echo "./make.sh debug"
echo "./make.sh trace"
echo "./make.sh library [dev]"
echo "./make.sh"
exit 0
fi
phpize
if [ "$1" = "debug" ] ;then
./configure ${COMPILE_PARAMS}
elif [ "$1" = "trace" ] ;then
./configure ${COMPILE_PARAMS}
else
./configure ${COMPILE_PARAMS}
fi
make clean
make -j ${CPU_COUNT}
if [ "$(whoami)" = "root" ]; then
make install
else
sudo make install
fi