|
|
|
@ -16,13 +16,36 @@ if [[ -f ${GLOBAL_DIR_OBJS}/st-1.9/obj/libst.a && -f ${GLOBAL_DIR_OBJS}/st-1.9/o
|
|
|
|
|
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)
|
|
|
|
|
(
|
|
|
|
|
rm -rf ${GLOBAL_DIR_OBJS}/st-1.9 && cd ${GLOBAL_DIR_OBJS} &&
|
|
|
|
|
unzip -q ../3rdparty/st-1.9.zip && cd st-1.9 && make linux-debug &&
|
|
|
|
|
cd .. && rm -f st && ln -sf st-1.9/obj st
|
|
|
|
|
)
|
|
|
|
|
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 -q ../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 &&
|
|
|
|
|
cd .. && rm -f hp && ln -sf http-parser-2.1 hp
|
|
|
|
|
)
|
|
|
|
|
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.
|
|
|
|
|
#####################################################################################
|
|
|
|
@ -53,18 +76,16 @@ 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"
|
|
|
|
|
Performance="-pg"
|
|
|
|
|
# enable gdb debug
|
|
|
|
|
GDBDebug="-g -O0"
|
|
|
|
|
# the warning level.
|
|
|
|
|
WarnLevel="-Wall -Wextra"
|
|
|
|
|
WarnLevel="-Wall"
|
|
|
|
|
# the compile standard.
|
|
|
|
|
CppStd="-std=c++98"
|
|
|
|
|
# other macros defined
|
|
|
|
|
UserMacros=""
|
|
|
|
|
CppStd="-ansi"
|
|
|
|
|
# the cxx flag generated.
|
|
|
|
|
CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug} ${Performance} ${UserMacros}"
|
|
|
|
|
CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug}"
|
|
|
|
|
#CXXFLAGS="${CppStd} ${WarnLevel} ${GDBDebug} ${Performance}"
|
|
|
|
|
cat << END > ${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE}
|
|
|
|
|
CXXFLAGS = ${CXXFLAGS}
|
|
|
|
|
GCC = g++
|
|
|
|
@ -78,19 +99,21 @@ default:
|
|
|
|
|
END
|
|
|
|
|
|
|
|
|
|
# Libraries
|
|
|
|
|
LibSTRoot="${GLOBAL_DIR_OBJS}/st-1.9/obj"
|
|
|
|
|
LibSTRoot="${GLOBAL_DIR_OBJS}/st"
|
|
|
|
|
LibSTfile="${LibSTRoot}/libst.a"
|
|
|
|
|
LibHttpParserRoot="${GLOBAL_DIR_OBJS}/hp"
|
|
|
|
|
LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a"
|
|
|
|
|
|
|
|
|
|
#Core Module
|
|
|
|
|
MODULE_ID="CORE"
|
|
|
|
|
MODULE_DEPENDS=()
|
|
|
|
|
ModuleLibIncs=(${LibSTRoot})
|
|
|
|
|
ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot})
|
|
|
|
|
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_auto_free" "srs_core_protocol" "srs_core_amf0"
|
|
|
|
|
"srs_core_autofree" "srs_core_protocol" "srs_core_amf0"
|
|
|
|
|
"srs_core_stream" "srs_core_source" "srs_core_codec"
|
|
|
|
|
"srs_core_complex_handshake" "srs_core_pithy_print"
|
|
|
|
|
"srs_core_handshake" "srs_core_pithy_print"
|
|
|
|
|
"srs_core_config" "srs_core_refer" "srs_core_reload")
|
|
|
|
|
MODULE_DIR="src/core" . auto/modules.sh
|
|
|
|
|
CORE_OBJS="${MODULE_OBJS[@]}"
|
|
|
|
@ -107,7 +130,7 @@ MAIN_OBJS="${MODULE_OBJS[@].o}"
|
|
|
|
|
MAIN_ENTRANCES=("srs_main_server")
|
|
|
|
|
|
|
|
|
|
# srs(simple rtmp server) over st(state-threads)
|
|
|
|
|
ModuleLibFiles=(${LibSTfile})
|
|
|
|
|
ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile})
|
|
|
|
|
MODULE_OBJS="${CORE_OBJS[@]} ${CONFIG_OBJS[@]} ${PROTOCOL_OBJS[@]} ${MAIN_OBJS[@]}"
|
|
|
|
|
BUILD_KEY="simple_rtmp_server" APP_MAIN="srs_main_server" APP_NAME="simple_rtmp_server" LINK_OPTIONS="-ldl -lssl" SO_PATH="" . auto/apps.sh
|
|
|
|
|
|
|
|
|
|