-
Notifications
You must be signed in to change notification settings - Fork 76
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·173 lines (144 loc) · 6.36 KB
/
Copy pathconfigure
File metadata and controls
executable file
·173 lines (144 loc) · 6.36 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#!/bin/bash
GLOBAL_FILE_MAKEFILE="Makefile"
GLOBAL_DIR_OBJS="objs"
mkdir -p ${GLOBAL_DIR_OBJS}
#####################################################################################
# prepare the depends tools
#####################################################################################
# st-1.9
if [[ -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.a && -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.so ]]; then
echo "st-1.9t is ok.";
else
echo "build st-1.9t";
(rm -rf ${GLOBAL_DIR_OBJS}/st-1.9 && cd ${GLOBAL_DIR_OBJS} && unzip ../3rdparty/st-1.9.zip && cd st-1.9 && make linux-debug)
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build st-1.9 failed, ret=$ret"; exit $ret; fi
if [ ! -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.a ]; then echo "build st-1.9 failed."; exit -1; fi
if [ ! -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.so ]; then echo "build st-1.9 failed."; exit -1; fi
# http-parser-2.1
if [[ -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/http_parser.h && -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then
echo "http-parser-2.1 is ok.";
else
echo "build http-parser-2.1";
(
rm -rf ${GLOBAL_DIR_OBJS}/http-parser-2.1 && cd ${GLOBAL_DIR_OBJS} && unzip ../3rdparty/http-parser-2.1.zip &&
cd http-parser-2.1 &&
sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile &&
sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile &&
make package
)
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build http-parser-2.1 failed, ret=$ret"; exit $ret; fi
if [[ ! -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/http_parser.h ]]; then echo "build http-parser-2.1 failed"; exit -1; fi
if [[ ! -f ${GLOBAL_DIR_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then echo "build http-parser-2.1 failed"; exit -1; fi
#####################################################################################
# generate Makefile.
#####################################################################################
echo "generate Makefile"
cat << END > ${GLOBAL_FILE_MAKEFILE}
.PHONY: default help clean http hls all _prepare_dir
default: all
help:
@echo "Usage: make <help>|<clean>|<http>|<hls>|<rtmp>|<all>"
@echo " help display this help menu"
@echo " clean cleanup project"
@echo " http build the http load test tool over st(state-threads)"
@echo " hls build the hls load test tool over st(state-threads)"
@echo " rtmp build the rtmp load test tool over st(state-threads)"
@echo " all build the http/hls load test tool over st(state-threads)"
clean:
(cd ${GLOBAL_DIR_OBJS}; rm -rf src st_*_load)
http: _prepare_dir
@echo "build the http load test tool over st(state-threads)"
\$(MAKE) -f ${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE} st_http_load
rtmp: _prepare_dir
@echo "build the http load test tool over st(state-threads)"
\$(MAKE) -f ${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE} st_rtmp_load
hls: _prepare_dir
@echo "build the HLS load test tool over st(state-threads)"
\$(MAKE) -f ${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE} st_hls_load
all: _prepare_dir
@echo "build the http/hls/rtmp load test tool over st(state-threads)"
\$(MAKE) -f ${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE} st_http_load
\$(MAKE) -f ${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE} st_hls_load
\$(MAKE) -f ${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE} st_rtmp_load
# the ./configure will generate it.
_prepare_dir:
END
echo 'generate Makefile ok!'
# the performance analysis, uncomments the following when use gperf to analysis the performance. see third-party/readme.txt
#Performance="-pg"
#PerformanceLink="-pg"
# enable gdb debug
GDBDebug="-g -O0"
# the warning level.
WarnLevel="-Wall -Wextra"
# the compile standard.
CppStd="-std=c++98"
# other macros defined
UserMacros=""
# the cxx flag generated.
CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug} ${Performance} ${UserMacros}"
cat << END > ${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE}
CXXFLAGS = ${CXXFLAGS}
GCC = g++
LINK = \$(GCC)
AR = ar
.PHONY: default st_http_load st_rtmp_load st_hls_load
default:
END
# Libraries
LibSTRoot="${GLOBAL_DIR_OBJS}/st-1.9/obj"
LibSTfile="${LibSTRoot}/libst.a"
LibHttpParserRoot="${GLOBAL_DIR_OBJS}/http-parser-2.1"
LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a"
#Core Module
MODULE_ID="CORE"
MODULE_DEPENDS=()
ModuleLibIncs=(${LibHttpParserRoot})
MODULE_FILES=("htl_core_log" "htl_core_error" "htl_core_uri" "htl_core_aggregate_ret")
MODULE_DIR="src/core" . auto/modules.sh
CORE_OBJS="${MODULE_OBJS[@]}"
#OS Module
MODULE_ID="OS"
MODULE_DEPENDS=("CORE")
ModuleLibIncs=(${LibSTRoot})
MODULE_FILES=("htl_os_st")
MODULE_DIR="src/os" . auto/modules.sh
OS_OBJS="${MODULE_OBJS[@]}"
#APP Module
MODULE_ID="APP"
MODULE_DEPENDS=("CORE" "OS")
ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot})
MODULE_FILES=("htl_app_hls_load" "htl_app_http_load" "htl_app_http_client" "htl_app_rtmp_client"
"htl_app_m3u8_parser" "htl_app_task_base" "htl_app_rtmp_load" "htl_app_rtmp_protocol")
MODULE_DIR="src/app" . auto/modules.sh
APP_OBJS="${MODULE_OBJS[@]}"
#Main Module
MODULE_ID="MAIN"
MODULE_DEPENDS=("CORE" "OS" "APP")
ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot})
MODULE_FILES=("htl_main_hls_load" "htl_main_http_load" "htl_main_rtmp_load" "htl_main_utility")
MODULE_DIR="src/main" . auto/modules.sh
MAIN_OBJS="${MODULE_OBJS[@].o}"
# all main entrances
MAIN_ENTRANCES=("htl_main_hls_load" "htl_main_http_load" "htl_main_rtmp_load")
# http load test tool over st(state-threads)
ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile})
MODULE_OBJS="${CORE_OBJS[@]} ${OS_OBJS[@]} ${APP_OBJS[@]} ${MAIN_OBJS[@]}"
BUILD_KEY="st_http_load" APP_MAIN="htl_main_http_load" APP_NAME="st_http_load" LINK_OPTIONS="-ldl" SO_PATH="" . auto/apps.sh
# rtmp load test tool over st(state-threads)
ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile})
MODULE_OBJS="${CORE_OBJS[@]} ${OS_OBJS[@]} ${APP_OBJS[@]} ${MAIN_OBJS[@]}"
BUILD_KEY="st_rtmp_load" APP_MAIN="htl_main_rtmp_load" APP_NAME="st_rtmp_load" LINK_OPTIONS="-ldl" SO_PATH="" . auto/apps.sh
# hls load test tool over direct TCP.
ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile})
MODULE_OBJS="${CORE_OBJS[@]} ${OS_OBJS[@]} ${APP_OBJS[@]} ${MAIN_OBJS[@]}"
BUILD_KEY="st_hls_load" APP_MAIN="htl_main_hls_load" APP_NAME="st_hls_load" LINK_OPTIONS="-ldl" SO_PATH="" . auto/apps.sh
echo 'configure ok! '
# next step.
echo "you can:"
echo "\" make \" to build the http/hls load test tools."
echo "\" make help \" to get the usage of make"