mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add options --with/without -hls/ssl
This commit is contained in:
parent
f8855cfcbb
commit
ec5cb39b96
14 changed files with 260 additions and 93 deletions
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
# params:
|
||||
# $GLOBAL_DIR_OBJS the objs directory. ie. objs
|
||||
# $GLOBAL_FILE_MAKEFILE the makefile name. ie. Makefile
|
||||
# $SRS_OBJS the objs directory. ie. objs
|
||||
# $SRS_MAKEFILE the makefile name. ie. Makefile
|
||||
# $MAIN_ENTRANCES array, all main entrance, disable all except the $APP_MAIN itself
|
||||
# $MODULE_OBJS array, the objects to compile the app.
|
||||
# $BUILD_KEY a string indicates the build key for Makefile. ie. dump
|
||||
|
@ -12,9 +12,9 @@
|
|||
# $LINK_OPTIONS the linker options.
|
||||
# $SO_PATH the libssl.so.10 and other so file path.
|
||||
|
||||
FILE=${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE}
|
||||
FILE=${SRS_OBJS}/${SRS_MAKEFILE}
|
||||
|
||||
APP_TARGET="${GLOBAL_DIR_OBJS}/${APP_NAME}"
|
||||
APP_TARGET="${SRS_OBJS}/${APP_NAME}"
|
||||
|
||||
echo "generate app ${APP_NAME} depends...";
|
||||
|
||||
|
@ -42,7 +42,7 @@ for item in ${MODULE_OBJS[*]}; do
|
|||
continue;
|
||||
fi
|
||||
|
||||
OBJ_FILE=${GLOBAL_DIR_OBJS}/$item
|
||||
OBJ_FILE=${SRS_OBJS}/$item
|
||||
OBJ_FILE="${OBJ_FILE%.*}.o"
|
||||
echo -n "${OBJ_FILE} " >> ${FILE}
|
||||
done
|
||||
|
@ -71,7 +71,7 @@ for item in ${MODULE_OBJS[*]}; do
|
|||
continue;
|
||||
fi
|
||||
|
||||
OBJ_FILE=${GLOBAL_DIR_OBJS}/$item
|
||||
OBJ_FILE=${SRS_OBJS}/$item
|
||||
OBJ_FILE="${OBJ_FILE%.*}.o"
|
||||
echo -n "${OBJ_FILE} " >> ${FILE}
|
||||
done
|
||||
|
|
85
trunk/auto/depends.sh
Normal file
85
trunk/auto/depends.sh
Normal file
|
@ -0,0 +1,85 @@
|
|||
#!/bin/bash
|
||||
|
||||
# TODO: check gcc/g++
|
||||
echo "check gcc/g++/gdb/make/openssl-devel"
|
||||
echo "depends tools are ok"
|
||||
|
||||
#####################################################################################
|
||||
# st-1.9
|
||||
#####################################################################################
|
||||
if [[ -f ${SRS_OBJS}/st-1.9/obj/libst.a && -f ${SRS_OBJS}/st-1.9/obj/libst.so ]]; then
|
||||
echo "st-1.9t is ok.";
|
||||
else
|
||||
echo "build st-1.9t";
|
||||
(
|
||||
rm -rf ${SRS_OBJS}/st-1.9 && cd ${SRS_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 ${SRS_OBJS}/st-1.9/obj/libst.a ]; then echo "build st-1.9 failed."; exit -1; fi
|
||||
if [ ! -f ${SRS_OBJS}/st-1.9/obj/libst.so ]; then echo "build st-1.9 failed."; exit -1; fi
|
||||
|
||||
#####################################################################################
|
||||
# http-parser-2.1
|
||||
#####################################################################################
|
||||
if [[ -f ${SRS_OBJS}/http-parser-2.1/http_parser.h && -f ${SRS_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 ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_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 ${SRS_OBJS}/http-parser-2.1/http_parser.h ]]; then echo "build http-parser-2.1 failed"; exit -1; fi
|
||||
if [[ ! -f ${SRS_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then echo "build http-parser-2.1 failed"; exit -1; fi
|
||||
|
||||
#####################################################################################
|
||||
# nginx for HLS, nginx-1.5.0
|
||||
#####################################################################################
|
||||
if [ $SRS_HLS = YES ]; then
|
||||
if [[ -f ${SRS_OBJS}/nginx-1.5.7/_release/sbin/nginx ]]; then
|
||||
echo "nginx-1.5.7 is ok.";
|
||||
else
|
||||
echo "build nginx-1.5.7";
|
||||
(
|
||||
rm -rf ${SRS_OBJS}/nginx-1.5.7 && cd ${SRS_OBJS} &&
|
||||
unzip -q ../3rdparty/nginx-1.5.7.zip && cd nginx-1.5.7 &&
|
||||
./configure --prefix=`pwd`/_release && make && make install &&
|
||||
ln -sf `pwd`/_release ../nginx
|
||||
)
|
||||
fi
|
||||
# check status
|
||||
ret=$?; if [[ $ret -ne 0 ]]; then echo "build nginx-1.5.7 failed, ret=$ret"; exit $ret; fi
|
||||
if [ ! -f ${SRS_OBJS}/nginx-1.5.7/_release/sbin/nginx ]; then echo "build nginx-1.5.7 failed."; exit -1; fi
|
||||
|
||||
# use current user to config nginx,
|
||||
# srs will write ts/m3u8 file use current user,
|
||||
# nginx default use nobody, so cannot read the ts/m3u8 created by srs.
|
||||
cp ${SRS_OBJS}/nginx/conf/nginx.conf ${SRS_OBJS}/nginx/conf/nginx.conf.bk
|
||||
sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf
|
||||
fi
|
||||
|
||||
if [ $SRS_HLS = YES ]; then
|
||||
echo "#define SRS_HLS" >> $SRS_AUTO_HEADERS_H
|
||||
else
|
||||
echo "#undef SRS_HLS" >> $SRS_AUTO_HEADERS_H
|
||||
fi
|
||||
|
||||
#####################################################################################
|
||||
# openssl, for rtmp complex handshake
|
||||
#####################################################################################
|
||||
if [ $SRS_SSL = YES ]; then
|
||||
echo "#define SRS_SSL" >> $SRS_AUTO_HEADERS_H
|
||||
else
|
||||
echo "#undef SRS_SSL" >> $SRS_AUTO_HEADERS_H
|
||||
fi
|
13
trunk/auto/modules.sh
Executable file → Normal file
13
trunk/auto/modules.sh
Executable file → Normal file
|
@ -1,6 +1,6 @@
|
|||
# params:
|
||||
# $GLOBAL_DIR_OBJS the objs directory. ie. objs
|
||||
# $GLOBAL_FILE_MAKEFILE the makefile name. ie. Makefile
|
||||
# $SRS_OBJS the objs directory. ie. objs
|
||||
# $SRS_MAKEFILE the makefile name. ie. Makefile
|
||||
# $MODULE_DIR the module dir. ie. src/os/linux
|
||||
# $MODULE_ID the id of module. ie. CORE
|
||||
# $MODULE_DEPENDS array, the denpend MODULEs id. ie. (CORE OS)
|
||||
|
@ -10,7 +10,7 @@
|
|||
# returns:
|
||||
# $MODULE_OBJS array, the objects of the modules.
|
||||
|
||||
FILE=${GLOBAL_DIR_OBJS}/${GLOBAL_FILE_MAKEFILE}
|
||||
FILE=${SRS_OBJS}/${SRS_MAKEFILE}
|
||||
|
||||
# INCS
|
||||
INCS_NAME="${MODULE_ID}_INCS"
|
||||
|
@ -46,16 +46,17 @@ echo "" >> ${FILE}; echo "" >> ${FILE}
|
|||
MODULE_OBJS=()
|
||||
for item in ${MODULE_FILES[*]}; do
|
||||
CPP_FILE="${MODULE_DIR}/${item}.cpp"
|
||||
OBJ_FILE="${GLOBAL_DIR_OBJS}/${MODULE_DIR}/${item}.o"
|
||||
OBJ_FILE="${SRS_OBJS}/${MODULE_DIR}/${item}.o"
|
||||
MODULE_OBJS="${MODULE_OBJS[@]} ${CPP_FILE}"
|
||||
if [ -f ${CPP_FILE} ]; then
|
||||
echo "${OBJ_FILE}: \$(${DEPS_NAME}) ${CPP_FILE} " >> ${FILE}
|
||||
echo " \$(GCC) -c \$(CXXFLAGS) \$(${INCS_NAME})-o ${OBJ_FILE} ${CPP_FILE}" >> ${FILE}
|
||||
echo " \$(GCC) -c \$(CXXFLAGS) \$(${INCS_NAME})\\" >> ${FILE}
|
||||
echo " -o ${OBJ_FILE} ${CPP_FILE}" >> ${FILE}
|
||||
fi
|
||||
done
|
||||
echo "" >> ${FILE}
|
||||
|
||||
# Makefile
|
||||
echo " mkdir -p ${GLOBAL_DIR_OBJS}/${MODULE_DIR}" >> ${GLOBAL_FILE_MAKEFILE}
|
||||
echo " mkdir -p ${SRS_OBJS}/${MODULE_DIR}" >> ${SRS_MAKEFILE}
|
||||
|
||||
echo -n "generate module ${MODULE_ID} ok"; echo '!';
|
||||
|
|
66
trunk/auto/options.sh
Normal file
66
trunk/auto/options.sh
Normal file
|
@ -0,0 +1,66 @@
|
|||
#!/bin/bash
|
||||
|
||||
help=no
|
||||
|
||||
SRS_HLS=RESERVED
|
||||
SRS_SSL=RESERVED
|
||||
|
||||
opt=
|
||||
|
||||
for option
|
||||
do
|
||||
opt="$opt `echo $option | sed -e \"s/\(--[^=]*=\)\(.* .*\)/\1'\2'/\"`"
|
||||
|
||||
case "$option" in
|
||||
-*=*) value=`echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) value="" ;;
|
||||
esac
|
||||
|
||||
case "$option" in
|
||||
--help) help=yes ;;
|
||||
|
||||
--with-ssl) SRS_SSL=YES ;;
|
||||
--with-hls) SRS_HLS=YES ;;
|
||||
|
||||
--without-ssl) SRS_SSL=NO ;;
|
||||
--without-hls) SRS_HLS=NO ;;
|
||||
|
||||
*)
|
||||
echo "$0: error: invalid option \"$option\""
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# save all config options to macro.
|
||||
SRS_CONFIGURE="$opt"
|
||||
|
||||
if [ $help = yes ]; then
|
||||
cat << END
|
||||
|
||||
--help print this message
|
||||
|
||||
--with-ssl enable rtmp complex handshake, requires openssl-devel installed.
|
||||
to delivery h264 video and aac audio to flash player.
|
||||
--with-hls enable hls streaming, build nginx as http server for hls.
|
||||
|
||||
--without-ssl disable rtmp complex handshake.
|
||||
--without-hls disable hls, rtmp streaming only.
|
||||
|
||||
END
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
__check_ok=YES
|
||||
if [ $SRS_SSL = RESERVED ]; then
|
||||
echo "you must specifies the ssl, see: ./configure --help";
|
||||
__check_ok=NO
|
||||
fi
|
||||
if [ $SRS_HLS = RESERVED ]; then
|
||||
echo "you must specifies the hls, see: ./configure --help";
|
||||
__check_ok=NO
|
||||
fi
|
||||
if [ $__check_ok = NO ]; then
|
||||
exit 1;
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue