Skip to content

Commit

Permalink
for ossrs#155, osx(darwin) support demo with nginx and ffmpeg. 2.0.143.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Mar 17, 2015
2 parents 79fbeeb + ab673e1 commit 9f81a8b
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 60 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ Supported operating systems and hardware:

### SRS 2.0 history

* v2.0, 2015-03-17, for [#155](https://github.com/winlinvip/simple-rtmp-server/issues/155), osx(darwin) support demo with nginx and ffmpeg. 2.0.143.
* v2.0, 2015-03-15, start [2.0release branch](https://github.com/winlinvip/simple-rtmp-server/tree/2.0release), 80773 lines.
* v2.0, 2015-03-14, fix [#324](https://github.com/winlinvip/simple-rtmp-server/issues/324), support hstrs(http stream trigger rtmp source) edge mode. 2.0.140.
* v2.0, 2015-03-14, for [#324](https://github.com/winlinvip/simple-rtmp-server/issues/324), support hstrs(http stream trigger rtmp source) origin mode. 2.0.139.
Expand Down
19 changes: 19 additions & 0 deletions trunk/3rdparty/patches/5.x264.osx.gcc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
*** configure Sat Nov 30 05:45:08 2013
--- ../x264-snapshot-20131129-2245-stable-patch/configure Tue Mar 17 21:42:24 2015
***************
*** 466,472 ****
;;
darwin*)
SYS="MACOSX"
! CFLAGS="$CFLAGS -falign-loops=16"
libm="-lm"
if [ "$pic" = "no" ]; then
cc_check "" -mdynamic-no-pic && CFLAGS="$CFLAGS -mdynamic-no-pic"
--- 466,472 ----
;;
darwin*)
SYS="MACOSX"
! CFLAGS="$CFLAGS"
libm="-lm"
if [ "$pic" = "no" ]; then
cc_check "" -mdynamic-no-pic && CFLAGS="$CFLAGS -mdynamic-no-pic"
1 change: 1 addition & 0 deletions trunk/auto/build_ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ else
cd $ff_current_dir &&
rm -rf x264-snapshot-20131129-2245-stable && unzip -q ${ff_src_dir}/x264-snapshot-20131129-2245-stable.zip &&
cd x264-snapshot-20131129-2245-stable &&
chmod +w configure && patch -p0 <../../../3rdparty/patches/5.x264.osx.gcc.patch &&
./configure --prefix=${ff_release_dir} --disable-opencl --bit-depth=8 \
--enable-static --disable-avs --disable-swscale --disable-lavf \
--disable-ffms --disable-gpac &&
Expand Down
93 changes: 53 additions & 40 deletions trunk/auto/depends.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ function Ubuntu_prepare()
sudo apt-get install -y --force-yes unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install unzip success"
fi

if [ $SRS_NGINX = YES ]; then
if [[ ! -f /usr/include/pcre.h ]]; then
echo "install libpcre3-dev"
require_sudoer "sudo apt-get install -y --force-yes libpcre3-dev"
sudo apt-get install -y --force-yes libpcre3-dev; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install libpcre3-dev success"
fi
fi

if [ $SRS_FFMPEG_TOOL = YES ]; then
autoconf --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
Expand All @@ -113,13 +122,6 @@ function Ubuntu_prepare()
echo "install libtool success"
fi

if [[ ! -f /usr/include/pcre.h ]]; then
echo "install libpcre3-dev"
require_sudoer "sudo apt-get install -y --force-yes libpcre3-dev"
sudo apt-get install -y --force-yes libpcre3-dev; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install libpcre3-dev success"
fi

if [[ ! -f /usr/include/zlib.h ]]; then
echo "install zlib1g-dev"
require_sudoer "sudo apt-get install -y --force-yes zlib1g-dev"
Expand Down Expand Up @@ -188,6 +190,15 @@ function Centos_prepare()
sudo yum install -y unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install unzip success"
fi

if [ $SRS_NGINX = YES ]; then
if [[ ! -f /usr/include/pcre.h ]]; then
echo "install pcre-devel"
require_sudoer "sudo yum install -y pcre-devel"
sudo yum install -y pcre-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install pcre-devel success"
fi
fi

if [ $SRS_FFMPEG_TOOL = YES ]; then
automake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
Expand All @@ -211,13 +222,6 @@ function Centos_prepare()
echo "install libtool success"
fi

if [[ ! -f /usr/include/pcre.h ]]; then
echo "install pcre-devel"
require_sudoer "sudo yum install -y pcre-devel"
sudo yum install -y pcre-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install pcre-devel success"
fi

if [[ ! -f /usr/include/zlib.h ]]; then
echo "install zlib-devel"
require_sudoer "sudo yum install -y zlib-devel"
Expand Down Expand Up @@ -271,14 +275,6 @@ function OSX_prepare()
echo "OSX does not support stat, use --without-stat"
exit 1
fi
if [ $SRS_FFMPEG_TOOL = YES ]; then
echo "OSX does not support ffmpeg, use --without-ffmpeg"
exit 1
fi
if [ $SRS_NGINX = YES ]; then
echo "OSX does not support nginx, use --without-nginx"
exit 1
fi
fi

brew --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
Expand Down Expand Up @@ -322,7 +318,16 @@ function OSX_prepare()
brew install unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install unzip success"
fi


if [ $SRS_NGINX = YES ]; then
if [[ ! -f /usr/local/include/pcre.h ]]; then
echo "install pcre"
echo "brew install pcre"
brew install pcre; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install pcre success"
fi
fi

if [ $SRS_FFMPEG_TOOL = YES ]; then
automake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install automake"
Expand All @@ -338,25 +343,18 @@ function OSX_prepare()
echo "install autoconf success"
fi

libtool --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
which libtool >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install libtool"
echo "brew install libtool"
brew install libtool; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install libtool success"
fi

if [[ ! -f /usr/include/pcre.h ]]; then
echo "install pcre-devel"
echo "brew install pcre-devel"
brew install pcre-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install pcre-devel success"
fi

if [[ ! -f /usr/include/zlib.h ]]; then
echo "install zlib-devel"
echo "brew install zlib-devel"
brew install zlib-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install zlib-devel success"

brew info zlib >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install zlib"
echo "brew install zlib"
brew install zlib; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install zlib success"
fi
fi

Expand All @@ -368,6 +366,19 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
OSX_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "OSX prepare failed, ret=$ret"; exit $ret; fi
fi

#####################################################################################
# check the os.
#####################################################################################
# user must specifies something what a fuck, we suppport following os:
# centos/ubuntu/osx,
# embeded system, for example, mips or arm,
# export srs-librtmp
# others is invalid.
if [[ $OS_IS_UBUNTU = NO && $OS_IS_CENTOS = NO && $OS_IS_OSX = NO && $SRS_EMBEDED_CPU = NO && $SRS_EXPORT_LIBRTMP_PROJECT = NO ]]; then
echo "what a fuck, os not supported."
exit 1
fi

#####################################################################################
# st-1.9
#####################################################################################
Expand Down Expand Up @@ -435,8 +446,6 @@ if [ $SRS_HTTP_PARSER = YES ]; then
rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip &&
cd http-parser-2.1 &&
patch -p0 < ../../3rdparty/patches/2.http.parser.patch &&
sed -i "s/CPPFLAGS_FAST +=.*$/CPPFLAGS_FAST = \$\(CPPFLAGS_DEBUG\)/g" Makefile &&
sed -i "s/CFLAGS_FAST =.*$/CFLAGS_FAST = \$\(CFLAGS_DEBUG\)/g" Makefile &&
make CC=${SrsArmCC} AR=${SrsArmAR} package &&
cd .. && rm -rf hp && ln -sf http-parser-2.1 hp &&
cd .. && touch ${SRS_OBJS}/_flag.st.hp.tmp
Expand Down Expand Up @@ -504,7 +513,11 @@ if [ $__SRS_BUILD_NGINX = YES ]; then
# 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
if [ $OS_IS_OSX = YES ]; then
sed -i '' "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf
else
sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf
fi
fi

# the demo dir.
Expand Down
10 changes: 5 additions & 5 deletions trunk/etc/init.d/srs-api
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ CONFIG="8085"
########################################################################
# utility functions
########################################################################
RED="\\e[31m"
GREEN="\\e[32m"
YELLOW="\\e[33m"
BLACK="\\e[0m"
POS="\\e[60G"
RED="\\033[31m"
GREEN="\\033[32m"
YELLOW="\\033[33m"
BLACK="\\033[0m"
POS="\\033[60G"

ok_msg(){
echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]"
Expand Down
10 changes: 5 additions & 5 deletions trunk/etc/init.d/srs-demo
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ DEFAULT_LOG_FILE='./objs/srs.demo.log'
########################################################################
# utility functions
########################################################################
RED="\\e[31m"
GREEN="\\e[32m"
YELLOW="\\e[33m"
BLACK="\\e[0m"
POS="\\e[60G"
RED="\\033[31m"
GREEN="\\033[32m"
YELLOW="\\033[33m"
BLACK="\\033[0m"
POS="\\033[60G"

ok_msg() {
echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]"
Expand Down
10 changes: 5 additions & 5 deletions trunk/etc/init.d/srs-demo-19350
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ DEFAULT_LOG_FILE='./objs/srs.demo.19350.log'
########################################################################
# utility functions
########################################################################
RED="\\e[31m"
GREEN="\\e[32m"
YELLOW="\\e[33m"
BLACK="\\e[0m"
POS="\\e[60G"
RED="\\033[31m"
GREEN="\\033[32m"
YELLOW="\\033[33m"
BLACK="\\033[0m"
POS="\\033[60G"

ok_msg() {
echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]"
Expand Down
11 changes: 6 additions & 5 deletions trunk/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ src_dir='src'
if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; exit 1; fi

# linux shell color support.
RED="\\e[31m"
GREEN="\\e[32m"
YELLOW="\\e[33m"
BLACK="\\e[0m"
RED="\\033[31m"
GREEN="\\033[32m"
YELLOW="\\033[33m"
BLACK="\\033[0m"

./etc/init.d/srs-demo restart; ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动SRS失败"; exit $ret; fi
echo "启动SRS服务器成功"
Expand All @@ -32,7 +32,8 @@ cat<<END
http://$ip:$port/players/srs_bwt.html?key=35c9b402c12a7246868752e2878f7e0e&vhost=bandcheck.srs.com
END

if [[ `getenforce` != 'Disabled' ]]; then
which getenforce >/dev/null 2>&1
if [[ 0 -eq $? && `getenforce` != 'Disabled' ]]; then
echo -e "${RED}请关闭selinux:${BLACK}";
echo -e "${RED} 打开配置文件:sudo vi /etc/sysconfig/selinux${BLACK}";
echo -e "${RED} 修改为:SELINUX=disabled${BLACK}";
Expand Down
1 change: 1 addition & 0 deletions trunk/src/core/srs_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define VERSION_REVISION 0
#define VERSION_REVISION 143

// server info.
#define RTMP_SIG_SRS_KEY "SRS"
Expand Down

0 comments on commit 9f81a8b

Please sign in to comment.