Skip to content

Commit 024433f

Browse files
committed
For #1547, refine configure, remove some macros
1 parent 84d69a5 commit 024433f

File tree

6 files changed

+65
-217
lines changed

6 files changed

+65
-217
lines changed

trunk/auto/auto_headers.sh

-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ function srs_undefine_macro()
4040
}
4141

4242
# export the preset.
43-
if [ $SRS_OSX = YES ]; then
44-
srs_define_macro "SRS_OSX" $SRS_AUTO_HEADERS_H
45-
fi
4643
if [ $SRS_X86_X64 = YES ]; then
4744
srs_define_macro "SRS_X86_X64" $SRS_AUTO_HEADERS_H
4845
fi

trunk/auto/depends.sh

+4-102
Original file line numberDiff line numberDiff line change
@@ -185,101 +185,11 @@ fi
185185
#####################################################################################
186186
# for Centos, auto install tools by yum
187187
#####################################################################################
188-
OS_IS_OSX=NO
189-
function OSX_prepare()
190-
{
191-
uname -s|grep Darwin >/dev/null 2>&1
192-
ret=$?; if [[ 0 -ne $ret ]]; then
193-
if [ $SRS_OSX = YES ]; then
194-
echo "Current OS `uname -s` is not OSX, please check your configure options."
195-
exit 1;
196-
fi
197-
return 0;
198-
fi
199-
200-
OS_IS_OSX=YES
201-
echo "Installing tools for OSX."
202-
# requires the osx when os
203-
if [ $OS_IS_OSX = YES ]; then
204-
if [ $SRS_OSX = NO ]; then
205-
echo "Invalid configure options for OSX, please specify --osx."
206-
exit 1
207-
fi
208-
fi
209-
210-
brew --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
211-
echo "Installing brew."
212-
echo "ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\""
213-
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
214-
echo "The brew is installed."
215-
fi
216-
217-
gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
218-
echo "Installing gcc."
219-
echo "brew install gcc"
220-
brew install gcc; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
221-
echo "The gcc is installed."
222-
fi
223-
224-
g++ --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
225-
echo "Installing gcc-c++."
226-
echo "brew install gcc-c++"
227-
brew install gcc-c++; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
228-
echo "The gcc-c++ is installed."
229-
fi
230-
231-
make --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
232-
echo "Installing make."
233-
echo "brew install make"
234-
brew install make; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
235-
echo "The make is installed."
236-
fi
237-
238-
patch --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
239-
echo "Installing patch."
240-
echo "brew install patch"
241-
brew install patch; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
242-
echo "The patch is installed."
243-
fi
244-
245-
unzip --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
246-
echo "Installing unzip."
247-
echo "brew install unzip"
248-
brew install unzip; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
249-
echo "The unzip is installed."
250-
fi
251-
252-
if [[ $SRS_VALGRIND == YES ]]; then
253-
valgrind --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
254-
echo "Installing valgrind."
255-
echo "brew install valgrind"
256-
brew install valgrind; ret=$?; if [[ 0 -ne $ret ]]; then return $ret; fi
257-
echo "The valgrind is installed."
258-
fi
259-
fi
260-
261-
echo "Tools for OSX are installed."
262-
return 0
263-
}
264-
# donot prepare tools, for srs-librtmp depends only gcc and g++.
265-
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
266-
OSX_prepare; ret=$?; if [[ 0 -ne $ret ]]; then echo "Install tools for OSX failed, ret=$ret"; exit $ret; fi
267-
fi
268-
269188
# We must use a bash function instead of variable.
270189
function sed_utility() {
271-
if [ $OS_IS_OSX = YES ]; then
272-
sed -i '' "$@"
273-
else
274-
sed -i "$@"
275-
fi
276-
190+
sed -i "$@"
277191
ret=$?; if [[ $ret -ne 0 ]]; then
278-
if [ $OS_IS_OSX = YES ]; then
279-
echo "sed -i '' \"$@\""
280-
else
281-
echo "sed -i \"$@\""
282-
fi
192+
echo "sed -i \"$@\""
283193
return $ret
284194
fi
285195
}
@@ -294,7 +204,7 @@ SED="sed_utility" && echo "SED is $SED"
294204
# directly build on arm/mips, for example, pi or cubie,
295205
# export srs-librtmp
296206
# others is invalid.
297-
if [[ $OS_IS_UBUNTU = NO && $OS_IS_CENTOS = NO && $OS_IS_OSX = NO && $SRS_EXPORT_LIBRTMP_PROJECT = NO ]]; then
207+
if [[ $OS_IS_UBUNTU = NO && $OS_IS_CENTOS = NO && $SRS_EXPORT_LIBRTMP_PROJECT = NO ]]; then
298208
if [[ $SRS_PI = NO && $SRS_CUBIE = NO && $SRS_CROSS_BUILD = NO ]]; then
299209
echo "Your OS `uname -s` is not supported."
300210
exit 1
@@ -307,10 +217,6 @@ fi
307217
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
308218
# check the cross build flag file, if flag changed, need to rebuild the st.
309219
_ST_MAKE=linux-debug && _ST_EXTRA_CFLAGS="-DMD_HAVE_EPOLL"
310-
# for osx, use darwin for st, donot use epoll.
311-
if [ $OS_IS_OSX = YES ]; then
312-
_ST_MAKE=darwin-debug && _ST_EXTRA_CFLAGS="-DMD_HAVE_KQUEUE -I/usr/local/include"
313-
fi
314220
if [[ $SRS_VALGRIND == YES ]]; then
315221
_ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_VALGRIND"
316222
fi
@@ -416,10 +322,6 @@ fi
416322
# openssl, for rtmp complex handshake
417323
#####################################################################################
418324
# extra configure options
419-
CONFIGURE_TOOL="./config"
420-
if [ $SRS_OSX = YES ]; then
421-
CONFIGURE_TOOL="./Configure darwin64-`uname -m`-cc"
422-
fi
423325
OPENSSL_HOTFIX="-DOPENSSL_NO_HEARTBEATS"
424326
# @see http://www.openssl.org/news/secadv/20140407.txt
425327
# Affected users should upgrade to OpenSSL 1.1.0e. Users unable to immediately
@@ -442,7 +344,7 @@ if [ $SRS_SSL = YES ]; then
442344
(
443345
rm -rf ${SRS_OBJS}/openssl-1.1.0e && cd ${SRS_OBJS} &&
444346
unzip -q ../3rdparty/openssl-1.1.0e.zip && cd openssl-1.1.0e &&
445-
$CONFIGURE_TOOL --prefix=`pwd`/_release -no-shared no-threads $OPENSSL_HOTFIX &&
347+
./config --prefix=`pwd`/_release -no-shared no-threads $OPENSSL_HOTFIX &&
446348
make && make install_sw &&
447349
cd .. && rm -rf openssl && ln -sf openssl-1.1.0e/_release openssl
448350
)

trunk/auto/generate-srs-librtmp-single.sh

-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
#!/bin/bash
22

3-
OS_IS_OSX=NO
4-
uname -s|grep Darwin >/dev/null 2>&1
5-
ret=$?; if [[ 0 -eq $ret ]]; then
6-
OS_IS_OSX=YES
7-
fi
8-
echo "Is OSX: ${OS_IS_OSX}"
9-
103
# when export srs-librtmp single files
114
# package the whole project to srs_librtmp.h and srs_librtmp.cpp
125
#

trunk/auto/options.sh

+60-98
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ SRS_VALGRIND=NO
7777
SRS_X86_X64=NO
7878
# for osx system
7979
SRS_OSX=NO
80-
SRS_ALLOW_OSX=NO
8180
# dev, open all features for dev, no gperf/prof/arm.
8281
SRS_DEV=NO
8382
# dev, open main server feature for dev, no utest/research/librtmp
@@ -98,7 +97,7 @@ SRS_DISABLE_ALL=NO
9897
SRS_ENABLE_ALL=NO
9998
#
10099
#####################################################################################
101-
# We don't support crossbuild for ARM/MIPS, please directly build it on ARM/MIPS server.
100+
# Whether enable crossbuild for ARM or MIPS.
102101
SRS_CROSS_BUILD=NO
103102

104103
#####################################################################################
@@ -107,106 +106,79 @@ SRS_CROSS_BUILD=NO
107106
function show_help() {
108107
cat << END
109108
110-
Options:
111-
-h, --help print this message
112-
113-
--with-ssl enable rtmp complex handshake, requires openssl-devel installed.
114-
--with-hds enable hds streaming, mux RTMP to F4M/F4V files.
115-
--with-nginx enable delivery HTTP stream with nginx.
116-
--with-stream-caster enable stream caster to serve other stream over other protocol.
117-
--with-ffmpeg enable transcoding tool ffmpeg.
118-
--with-transcode enable transcoding features.
119-
--with-ingest enable ingest features.
120-
--with-stat enable the data statistic, for http api.
121-
--with-librtmp enable srs-librtmp, library for client.
122-
--with-research build the research tools.
123-
--with-utest build the utest for SRS.
124-
--with-gperf build SRS with gperf tools(no gmd/gmc/gmp/gcp, with tcmalloc only).
125-
https://blog.csdn.net/win_lin/article/details/53503869
126-
--with-gmc build memory check for SRS with gperf tools.
127-
--with-gmd build memory defense(corrupt memory) for SRS with gperf tools.
128-
--with-gmp build memory profile for SRS with gperf tools.
129-
--with-gcp build cpu profile for SRS with gperf tools.
130-
--with-gprof build SRS with gprof(GNU profile tool).
131-
--with-arm-ubuntu12 cross build SRS on ubuntu12 for armhf(v7cpu).
132-
--with-mips-ubuntu12 cross build SRS on ubuntu12 for mips.
133-
134-
--without-ssl disable rtmp complex handshake.
135-
--without-hds disable hds, the adobe http dynamic streaming.
136-
--without-nginx disable delivery HTTP stream with nginx.
137-
--without-stream-caster disable stream caster, only listen and serve RTMP/HTTP.
138-
--without-ffmpeg disable the ffmpeg transcode tool feature.
139-
--without-transcode disable the transcoding feature.
140-
--without-ingest disable the ingest feature.
141-
--without-stat disable the data statistic feature.
142-
--without-librtmp disable srs-librtmp, library for client.
143-
--without-research do not build the research tools.
144-
--without-utest do not build the utest for SRS.
145-
--without-gperf do not build SRS with gperf tools(without tcmalloc and gmd/gmc/gmp/gcp).
146-
--without-gmc do not build memory check for SRS with gperf tools.
147-
--without-gmd do not build memory defense for SRS with gperf tools.
148-
--without-gmp do not build memory profile for SRS with gperf tools.
149-
--without-gcp do not build cpu profile for SRS with gperf tools.
150-
--without-gprof do not build srs with gprof(GNU profile tool).
151-
--without-arm-ubuntu12 do not cross build srs on ubuntu12 for armhf(v7cpu).
152-
--without-mips-ubuntu12 do not cross build srs on ubuntu12 for mips.
153-
109+
Presets:
110+
--x86-64, --x86-x64 [default] For x86/x64 cpu, common pc and servers.
111+
--arm Enable crossbuild for ARM, should also set bellow toolchain options.
112+
--mips Enable crossbuild for MIPS
113+
114+
Features:
115+
-h, --help Print this message and exit 0.
116+
117+
--with-ssl Enable rtmp complex handshake, requires openssl-devel installed.
118+
--with-hds Enable hds streaming, mux RTMP to F4M/F4V files.
119+
--with-stream-caster Enable stream caster to serve other stream over other protocol.
120+
--with-stat Enable the data statistic, for http api.
121+
--with-librtmp Enable srs-librtmp, library for client.
122+
--with-research Build the research tools.
123+
--with-utest Build the utest for SRS.
124+
125+
--without-ssl Disable rtmp complex handshake.
126+
--without-hds Disable hds, the adobe http dynamic streaming.
127+
--without-stream-caster Disable stream caster, only listen and serve RTMP/HTTP.
128+
--without-stat Disable the data statistic feature.
129+
--without-librtmp Disable srs-librtmp, library for client.
130+
--without-research Do not build the research tools.
131+
--without-utest Do not build the utest for SRS.
132+
154133
--prefix=<path> The absolute installation path for srs. Default: $SRS_PREFIX
155134
--static Whether add '-static' to link options.
156135
--gcov Whether enable the GCOV compiler options.
157136
--jobs[=N] Allow N jobs at once; infinite jobs with no arg.
158-
used for make in the configure, for example, to make ffmpeg.
159-
--log-verbose whether enable the log verbose level. default: no.
160-
--log-info whether enable the log info level. default: no.
161-
--log-trace whether enable the log trace level. default: yes.
162-
163-
Presets:
164-
--x86-x64 [default] for x86/x64 cpu, common pc and servers.
165-
--osx for osx(darwin) system to build SRS.
166-
--pi for raspberry-pi(directly build), open features hls/ssl/static.
167-
--cubie for cubieboard(directly build), open features except ffmpeg/nginx.
168-
--arm alias for --with-arm-ubuntu12, for ubuntu12, arm crossbuild
169-
--mips alias for --with-mips-ubuntu12, for ubuntu12, mips crossbuild
170-
--fast the most fast compile, nothing, only support vp6 RTMP.
171-
--pure-rtmp only support RTMP with ssl.
172-
--disable-all disable all features, only support vp6 RTMP.
173-
--dev for dev, open all features, no nginx/gperf/gprof/arm.
174-
--fast-dev for dev fast compile, the RTMP server, without librtmp/utest/research.
175-
--demo for srs demo, @see: https://github.com/ossrs/srs/wiki/v1_CN_SampleDemo
176-
--full enable all features, no gperf/gprof/arm.
177-
--x86-64 alias for --x86-x64.
137+
Used for make in the configure, for example, to make ffmpeg.
138+
--log-verbose Whether enable the log verbose level. default: no.
139+
--log-info Whether enable the log info level. default: no.
140+
--log-trace Whether enable the log trace level. default: yes.
141+
142+
Performance:
143+
https://blog.csdn.net/win_lin/article/details/53503869
144+
--with-valgrind Support valgrind for memory check.
145+
--with-gperf Build SRS with gperf tools(no gmd/gmc/gmp/gcp, with tcmalloc only).
146+
--with-gmc Build memory check for SRS with gperf tools.
147+
--with-gmd Build memory defense(corrupt memory) for SRS with gperf tools.
148+
--with-gmp Build memory profile for SRS with gperf tools.
149+
--with-gcp Build cpu profile for SRS with gperf tools.
150+
--with-gprof Build SRS with gprof(GNU profile tool).
151+
152+
--without-valgrind Do not support valgrind for memory check.
153+
--without-gperf Do not build SRS with gperf tools(without tcmalloc and gmd/gmc/gmp/gcp).
154+
--without-gmc Do not build memory check for SRS with gperf tools.
155+
--without-gmd Do not build memory defense for SRS with gperf tools.
156+
--without-gmp Do not build memory profile for SRS with gperf tools.
157+
--without-gcp Do not build cpu profile for SRS with gperf tools.
158+
--without-gprof Do not build srs with gprof(GNU profile tool).
178159
179160
Toolchain options:
180-
--extra-flags=<EFLAGS> Set EFLAGS as CFLAGS and CXXFLAGS. Pass to ST as EXTRA_CFLAGS.
181-
182-
Recomment to enable:
183-
--with-http-api enable HTTP API, to communicate with SRS.
184-
--with-http-callback enable HTTP hooks, build cherrypy as demo api server.
185-
--with-http-server enable HTTP server to delivery http stream.
186-
--with-hls enable HLS streaming, mux RTMP to M3U8/TS files.
187-
--with-dvr enable DVR, record RTMP to FLV/MP4 files.
188-
161+
https://github.com/ossrs/srs/issues/1547#issuecomment-576078411
162+
--extra-flags=<EFLAGS> Set EFLAGS as CFLAGS and CXXFLAGS. Also passed to ST as EXTRA_CFLAGS.
163+
189164
Conflicts:
190165
1. --with-gmc vs --with-gmp:
191166
@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html
192167
2. --with-gperf/gmc/gmp vs --with-gprof:
193-
gperftools not compatible with gprof.
168+
The gperftools not compatible with gprof.
194169
3. --arm vs --with-ffmpeg/gperf/gmc/gmp/gprof:
195-
the complex tools not available for arm.
170+
The complex tools not available for arm.
196171
197172
Experts:
198-
--use-sys-ssl donot compile ssl, use system ssl(-lssl) if required.
199-
--memory-watch enable memory watch to detect memory leaking(hurts performance).
200-
--export-librtmp-project=<path> export srs-librtmp to specified project in path.
201-
--export-librtmp-single=<path> export srs-librtmp to a single file(.h+.cpp) in path.
202-
--with-valgrind support valgrind for memory check.
203-
--without-valgrind donot support valgrind for memory check.
173+
--use-sys-ssl Do not compile ssl, use system ssl(-lssl) if required.
174+
--export-librtmp-project=<path> Export srs-librtmp to specified project in path.
175+
--export-librtmp-single=<path> Export srs-librtmp to a single file(.h+.cpp) in path.
204176
205177
Workflow:
206-
1. apply "Presets". if not specified, use default preset.
207-
2. apply "Options". user specified option will override the preset.
208-
3. check conflicts. @see Conflicts section.
209-
4. generate detail features.
178+
1. Apply "Presets". if not specified, use default preset.
179+
2. Apply "Features", "Performance" and others. user specified option will override the preset.
180+
3. Check conflicts, fail if exists conflicts.
181+
4. Generate Makefile.
210182
211183
Remark:
212184
1. For performance improving, read https://blog.csdn.net/win_lin/article/details/53503869
@@ -271,7 +243,7 @@ function parse_user_option() {
271243
--x86-x64) SRS_X86_X64=YES ;;
272244
--x86-64) SRS_X86_X64=YES ;;
273245
--osx) SRS_OSX=YES ;;
274-
--allow-osx) SRS_ALLOW_OSX=YES ;;
246+
--allow-osx) SRS_OSX=YES ;;
275247
--arm) SRS_CROSS_BUILD=YES ;;
276248
--mips) SRS_CROSS_BUILD=YES ;;
277249
--pi) SRS_PI=YES ;;
@@ -608,15 +580,5 @@ function check_option_conflicts() {
608580
if [ $__check_ok = NO ]; then
609581
exit 1;
610582
fi
611-
612-
if [[ $SRS_OSX == YES && $SRS_ALLOW_OSX == NO ]]; then
613-
macOSVersion=`sw_vers -productVersion`
614-
macOSVersionMajor=`echo $macOSVersion|awk -F '.' '{print $1}'`
615-
macOSVersionMinor=`echo $macOSVersion|awk -F '.' '{print $2}'`
616-
if [[ $macOSVersionMajor -ge 10 && $macOSVersionMinor -ge 14 ]]; then
617-
echo "macOS $macOSVersion is not supported, read https://github.com/ossrs/srs/issues/1250"
618-
exit -1
619-
fi
620-
fi
621583
}
622584
check_option_conflicts

trunk/auto/utest.sh

-6
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ GTEST_DIR=${SRS_TRUNK_PREFIX}/${SRS_OBJS_DIR}/gtest
2323
# the extra defines to compile utest.
2424
EXTRA_DEFINES=""
2525

26-
# for osx to disable the error.
27-
# gtest/include/gtest/internal/gtest-port.h:499:13: fatal error: 'tr1/tuple' file not found
28-
if [ $SRS_OSX = YES ]; then
29-
EXTRA_DEFINES="$EXTRA_DEFINES -DGTEST_HAS_TR1_TUPLE=0"
30-
fi
31-
3226
cat << END > ${FILE}
3327
# user must run make the ${SRS_OBJS_DIR}/utest dir
3428
# at the same dir of Makefile.

trunk/configure

+1-1
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
568568
echo ""
569569
echo "Configure summary:"
570570
echo " ${SRS_AUTO_USER_CONFIGURE}"
571-
echo " ${SRS_AUTO_CONFIGURE}"
571+
echo " ${SRS_AUTO_CONFIGURE}"
572572
if [ $SRS_HLS = YES ]; then
573573
echo -e "${GREEN}HLS is enabled.${BLACK}"
574574
else

0 commit comments

Comments
 (0)