1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Support disable valgrind

This commit is contained in:
winlin 2017-02-28 14:47:00 +08:00
parent 89a5fa69d1
commit cdfded6a74
5 changed files with 96 additions and 114 deletions

View file

@ -101,19 +101,23 @@ function Ubuntu_prepare()
sudo apt-get install -y --force-yes unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The unzip is installed."
fi
valgrind --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing valgrind."
require_sudoer "sudo apt-get install -y --force-yes valgrind"
sudo apt-get install -y --force-yes valgrind; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The valgrind is installed."
if [[ $SRS_VALGRIND == YES ]]; then
valgrind --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing valgrind."
require_sudoer "sudo apt-get install -y --force-yes valgrind"
sudo apt-get install -y --force-yes valgrind; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The valgrind is installed."
fi
fi
if [[ ! -f /usr/include/valgrind/valgrind.h ]]; then
echo "Installing valgrind-dev."
require_sudoer "sudo apt-get install -y --force-yes valgrind-dev"
sudo apt-get install -y --force-yes valgrind-dev; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The valgrind-dev is installed."
if [[ $SRS_VALGRIND == YES ]]; then
if [[ ! -f /usr/include/valgrind/valgrind.h ]]; then
echo "Installing valgrind-dev."
require_sudoer "sudo apt-get install -y --force-yes valgrind-dev"
sudo apt-get install -y --force-yes valgrind-dev; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The valgrind-dev is installed."
fi
fi
if [ $SRS_NGINX = YES ]; then
@ -208,19 +212,23 @@ function Centos_prepare()
sudo yum install -y unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The unzip is installed."
fi
valgrind --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing valgrind."
require_sudoer "sudo yum install -y valgrind"
sudo yum install -y valgrind; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The valgrind is installed."
if [[ $SRS_VALGRIND == YES ]]; then
valgrind --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing valgrind."
require_sudoer "sudo yum install -y valgrind"
sudo yum install -y valgrind; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The valgrind is installed."
fi
fi
if [[ ! -f /usr/include/valgrind/valgrind.h ]]; then
echo "Installing valgrind-devel."
require_sudoer "sudo yum install -y valgrind-devel"
sudo yum install -y valgrind-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The valgrind-devel is installed."
if [[ $SRS_VALGRIND == YES ]]; then
if [[ ! -f /usr/include/valgrind/valgrind.h ]]; then
echo "Installing valgrind-devel."
require_sudoer "sudo yum install -y valgrind-devel"
sudo yum install -y valgrind-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The valgrind-devel is installed."
fi
fi
if [ $SRS_NGINX = YES ]; then
@ -341,12 +349,14 @@ function OSX_prepare()
brew install unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The unzip is installed."
fi
valgrind --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing valgrind."
echo "brew install valgrind"
brew install valgrind; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The valgrind is installed."
if [[ $SRS_VALGRIND == YES ]]; then
valgrind --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "Installing valgrind."
echo "brew install valgrind"
brew install valgrind; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "The valgrind is installed."
fi
fi
if [ $SRS_NGINX = YES ]; then
@ -436,10 +446,13 @@ fi
#####################################################################################
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# check the cross build flag file, if flag changed, need to rebuild the st.
_ST_MAKE=linux-debug && _ST_EXTRA_CFLAGS="-DMD_HAVE_EPOLL -DMD_VALGRIND"
_ST_MAKE=linux-debug && _ST_EXTRA_CFLAGS="-DMD_HAVE_EPOLL"
# for osx, use darwin for st, donot use epoll.
if [ $OS_IS_OSX = YES ]; then
_ST_MAKE=darwin-debug && _ST_EXTRA_CFLAGS="-DMD_HAVE_KQUEUE -DMD_VALGRIND -I/usr/local/include"
_ST_MAKE=darwin-debug && _ST_EXTRA_CFLAGS="-DMD_HAVE_KQUEUE -I/usr/local/include"
fi
if [[ $SRS_VALGRIND == YES ]]; then
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_VALGRIND"
fi
# Patched ST from https://github.com/ossrs/state-threads/tree/srs
if [ $SRS_CROSS_BUILD = YES ]; then

View file

@ -72,6 +72,8 @@ SRS_MEM_WATCH=NO
SRS_EXPORT_LIBRTMP_PROJECT=NO
# export the srs-librtmp to a single .h and .c, NO to disable it.
SRS_EXPORT_LIBRTMP_SINGLE=NO
# valgrind
SRS_VALGRIND=YES
#
################################################################
# presets
@ -201,6 +203,7 @@ Experts:
--memory-watch enable memory watch to detect memory leaking(hurts performance).
--export-librtmp-project=<path> export srs-librtmp to specified project in path.
--export-librtmp-single=<path> export srs-librtmp to a single file(.h+.cpp) in path.
--no-valgrind donot support valgrind for memory check.
Workflow:
1. apply "Presets". if not specified, use default preset.
@ -290,6 +293,7 @@ function parse_user_option() {
--memory-watch) SRS_MEM_WATCH=YES ;;
--export-librtmp-project) SRS_EXPORT_LIBRTMP_PROJECT=${value} ;;
--export-librtmp-single) SRS_EXPORT_LIBRTMP_SINGLE=${value} ;;
--no-valgrind) SRS_VALGRIND=NO ;;
--with-http-callback) SRS_HTTP_CALLBACK=YES ;;
--with-http-api) SRS_HTTP_API=YES ;;

View file

@ -23,6 +23,7 @@ SrsGperfMDSummaryColor="\${GREEN}(Disabled) "; if [ $SRS_GPERF_MD = YES ]; then
SrsGperfMPSummaryColor="\${GREEN}(Disabled) "; if [ $SRS_GPERF_MP = YES ]; then SrsGperfMPSummaryColor="\${YELLOW}"; fi
SrsGperfCPSummaryColor="\${GREEN}(Disabled) "; if [ $SRS_GPERF_CP = YES ]; then SrsGperfCPSummaryColor="\${YELLOW}"; fi
SrsGprofSummaryColor="\${GREEN}(Disabled) "; if [ $SRS_GPROF = YES ]; then SrsGprofSummaryColor="\${YELLOW}"; fi
SrsValgrindSummaryColor="\${YELLOW}(Disabled) "; if [ $SRS_VALGRIND = YES ]; then SrsValgrindSummaryColor="\${GREEN}"; fi
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
cat <<END > ${SRS_OBJS}/${SRS_BUILD_SUMMARY}
@ -54,6 +55,7 @@ echo -e " | ${SrsHttpServerSummaryColor}Aoubt embeded http-server, pleas
echo -e " | ${SrsHttpApiSummaryColor}About http-api, please read https://github.com/ossrs/srs/wiki/v3_CN_HTTPApi\${BLACK}"
echo -e " | ${SrsStreamCasterSummaryColor}About stream-caster, please read https://github.com/ossrs/srs/wiki/v2_CN_Streamer\${BLACK}"
echo -e " | ${SrsKafkaSummaryColor}About kafka, please read https://github.com/ossrs/srs/wiki/v3_CN_Kafka\${BLACK}"
echo -e " | ${SrsValgrindSummaryColor}About VALGRIND, please read https://github.com/ossrs/state-threads/issues/2\${BLACK}"
echo -e " \${BLACK}+------------------------------------------------------------------------------------\${BLACK}"
echo -e "\${GREEN}binaries, please read https://github.com/ossrs/srs/wiki/v2_CN_Build\${BLACK}"