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

osx support build nginx and ffmpeg

This commit is contained in:
winlin 2015-03-17 21:51:19 +08:00
parent f3e5431d0f
commit a28c051c2c
3 changed files with 60 additions and 40 deletions

View file

@ -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"

View file

@ -79,6 +79,7 @@ else
cd $ff_current_dir && cd $ff_current_dir &&
rm -rf x264-snapshot-20131129-2245-stable && unzip -q ${ff_src_dir}/x264-snapshot-20131129-2245-stable.zip && rm -rf x264-snapshot-20131129-2245-stable && unzip -q ${ff_src_dir}/x264-snapshot-20131129-2245-stable.zip &&
cd x264-snapshot-20131129-2245-stable && 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 \ ./configure --prefix=${ff_release_dir} --disable-opencl --bit-depth=8 \
--enable-static --disable-avs --disable-swscale --disable-lavf \ --enable-static --disable-avs --disable-swscale --disable-lavf \
--disable-ffms --disable-gpac && --disable-ffms --disable-gpac &&

View file

@ -98,6 +98,15 @@ function Ubuntu_prepare()
echo "install unzip success" echo "install unzip success"
fi 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 if [ $SRS_FFMPEG_TOOL = YES ]; then
autoconf --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then autoconf --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install autoconf" echo "install autoconf"
@ -113,13 +122,6 @@ function Ubuntu_prepare()
echo "install libtool success" echo "install libtool success"
fi 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 if [[ ! -f /usr/include/zlib.h ]]; then
echo "install zlib1g-dev" echo "install zlib1g-dev"
require_sudoer "sudo apt-get install -y --force-yes zlib1g-dev" require_sudoer "sudo apt-get install -y --force-yes zlib1g-dev"
@ -189,6 +191,15 @@ function Centos_prepare()
echo "install unzip success" echo "install unzip success"
fi 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 if [ $SRS_FFMPEG_TOOL = YES ]; then
automake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then automake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install automake" echo "install automake"
@ -211,13 +222,6 @@ function Centos_prepare()
echo "install libtool success" echo "install libtool success"
fi 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 if [[ ! -f /usr/include/zlib.h ]]; then
echo "install zlib-devel" echo "install zlib-devel"
require_sudoer "sudo yum install -y zlib-devel" require_sudoer "sudo yum install -y zlib-devel"
@ -271,14 +275,6 @@ function OSX_prepare()
echo "OSX does not support stat, use --without-stat" echo "OSX does not support stat, use --without-stat"
exit 1 exit 1
fi 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 fi
brew --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then brew --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
@ -323,6 +319,15 @@ function OSX_prepare()
echo "install unzip success" echo "install unzip success"
fi 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 if [ $SRS_FFMPEG_TOOL = YES ]; then
automake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then automake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install automake" echo "install automake"
@ -338,25 +343,18 @@ function OSX_prepare()
echo "install autoconf success" echo "install autoconf success"
fi 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 "install libtool"
echo "brew install libtool" echo "brew install libtool"
brew install libtool; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi brew install libtool; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install libtool success" echo "install libtool success"
fi fi
if [[ ! -f /usr/include/pcre.h ]]; then brew info zlib >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
echo "install pcre-devel" echo "install zlib"
echo "brew install pcre-devel" echo "brew install zlib"
brew install pcre-devel; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi brew install zlib; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
echo "install pcre-devel success" echo "install zlib 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"
fi fi
fi fi
@ -448,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 && rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip &&
cd http-parser-2.1 && cd http-parser-2.1 &&
patch -p0 < ../../3rdparty/patches/2.http.parser.patch && 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 && make CC=${SrsArmCC} AR=${SrsArmAR} package &&
cd .. && rm -rf hp && ln -sf http-parser-2.1 hp && cd .. && rm -rf hp && ln -sf http-parser-2.1 hp &&
cd .. && touch ${SRS_OBJS}/_flag.st.hp.tmp cd .. && touch ${SRS_OBJS}/_flag.st.hp.tmp
@ -517,7 +513,11 @@ if [ $__SRS_BUILD_NGINX = YES ]; then
# srs will write ts/m3u8 file use current user, # srs will write ts/m3u8 file use current user,
# nginx default use nobody, so cannot read the ts/m3u8 created by srs. # 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 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 fi
# the demo dir. # the demo dir.