configure
3.6 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
#!/bin/bash
SRS_MAKEFILE="Makefile"
SRS_OBJS="objs"
SRS_AUTO_HEADERS_H="${SRS_OBJS}/srs_auto_headers.hpp"
mkdir -p ${SRS_OBJS}
# clean the exists
if [[ -f Makefile ]]; then
make clean
fi
# parse user options.
. auto/options.sh
# generate the audo headers file.
echo "#define SRS_CONFIGURE \"${SRS_CONFIGURE}\"" > $SRS_AUTO_HEADERS_H
# apply user options.
. auto/depends.sh
# new empty line to auto headers file.
echo "" >> $SRS_AUTO_HEADERS_H
#####################################################################################
# generate Makefile.
#####################################################################################
echo "generate Makefile"
cat << END > ${SRS_MAKEFILE}
.PHONY: default help clean server _prepare_dir
default: server
help:
@echo "Usage: make <help>|<clean>|<server>"
@echo " help display this help menu"
@echo " clean cleanup project"
@echo " server build the srs(simple rtmp server) over st(state-threads)"
clean:
(rm -f Makefile; cd ${SRS_OBJS}; rm -rf Makefile *.hpp src st_*_load)
server: _prepare_dir
@echo "build the srs(simple rtmp server) over st(state-threads)"
\$(MAKE) -f ${SRS_OBJS}/${SRS_MAKEFILE} simple_rtmp_server
# the ./configure will generate it.
_prepare_dir:
@mkdir -p ${SRS_OBJS}
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"
# enable gdb debug
GDBDebug="-g -O0"
# the warning level.
WarnLevel="-Wall"
# the compile standard.
CppStd="-ansi"
# the cxx flag generated.
CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug}"
#CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug} ${Performance}"
cat << END > ${SRS_OBJS}/${SRS_MAKEFILE}
CXXFLAGS = ${CXXFLAGS}
GCC = g++
LINK = \$(GCC)
AR = ar
.PHONY: default simple_rtmp_server
default:
END
# Libraries
LibSTRoot="${SRS_OBJS}/st"
LibSTfile="${LibSTRoot}/libst.a"
LibHttpParserRoot="${SRS_OBJS}/hp"
LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a"
#Core Module
MODULE_ID="CORE"
MODULE_DEPENDS=()
ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot} ${SRS_OBJS})
MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server"
"srs_core_error" "srs_core_conn" "srs_core_client"
"srs_core_rtmp" "srs_core_socket" "srs_core_buffer"
"srs_core_autofree" "srs_core_protocol" "srs_core_amf0"
"srs_core_stream" "srs_core_source" "srs_core_codec"
"srs_core_handshake" "srs_core_pithy_print"
"srs_core_config" "srs_core_refer" "srs_core_reload"
"srs_core_hls")
MODULE_DIR="src/core" . auto/modules.sh
CORE_OBJS="${MODULE_OBJS[@]}"
#Main Module
MODULE_ID="MAIN"
MODULE_DEPENDS=("CORE")
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS})
MODULE_FILES=("srs_main_server")
MODULE_DIR="src/main" . auto/modules.sh
MAIN_OBJS="${MODULE_OBJS[@].o}"
# all main entrances
MAIN_ENTRANCES=("srs_main_server")
# srs(simple rtmp server) over st(state-threads)
ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile})
MODULE_OBJS="${CORE_OBJS[@]} ${CONFIG_OBJS[@]} ${PROTOCOL_OBJS[@]} ${MAIN_OBJS[@]}"
if [ $SRS_SSL = YES ]; then
LINK_OPTIONS="-ldl -lssl -lcrypto"
else
LINK_OPTIONS="-ldl"
fi
BUILD_KEY="simple_rtmp_server" APP_MAIN="srs_main_server" APP_NAME="simple_rtmp_server" SO_PATH="" . auto/apps.sh
echo 'configure ok! '
# next step.
echo "you can:"
echo "\" make \" to build the srs(simple rtmp server)."
echo "\" make help \" to get the usage of make"
if [ $SRS_HLS = YES ]; then
echo "\" sudo ./objs/nginx/sbin/nginx \" to start the nginx http server for hls"
fi
echo "\" ./objs/simple_rtmp_server -c conf/srs.conf \" to start the srs live server"