123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- #!/bin/bash
- # output variables:
- # SRS_AUTO_HEADERS_H: the auto generated header file.
- SRS_AUTO_HEADERS_H="${SRS_OBJS}/srs_auto_headers.hpp"
- # write user options to headers
- echo "// auto generated by configure" > $SRS_AUTO_HEADERS_H
- echo "#ifndef SRS_AUTO_HEADER_HPP" >> $SRS_AUTO_HEADERS_H
- echo "#define SRS_AUTO_HEADER_HPP" >> $SRS_AUTO_HEADERS_H
- echo "" >> $SRS_AUTO_HEADERS_H
- echo "#define SRS_PACKAGER \"${SRS_AUTO_PACKAGER}\"" >> $SRS_AUTO_HEADERS_H
- echo "#define SRS_BUILD_TS \"`date +%s`\"" >> $SRS_AUTO_HEADERS_H
- echo "#define SRS_BUILD_DATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $SRS_AUTO_HEADERS_H
- echo "#define SRS_UNAME \"`uname -a`\"" >> $SRS_AUTO_HEADERS_H
- echo "#define SRS_USER_CONFIGURE \"${SRS_AUTO_USER_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H
- echo "#define SRS_CONFIGURE \"${SRS_AUTO_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H
- echo "" >> $SRS_AUTO_HEADERS_H
- function srs_define_macro()
- {
- macro=$1 && file=$2
- echo "#define $macro" >> $file
- echo "#define ${macro}_BOOL true" >> $file
- }
- function srs_define_macro_value()
- {
- macro=$1 && value=$2 && file=$3
- echo "#define $macro $value" >> $file
- echo "#define ${macro}_BOOL true" >> $file
- }
- function srs_undefine_macro()
- {
- macro=$1 && file=$2
- echo "#undef $macro" >> $file
- echo "#define ${macro}_BOOL false" >> $file
- }
- #####################################################################################
- # generate auto headers file, depends on the finished of options.sh
- #####################################################################################
- # auto headers in depends.
- if [ $SRS_HDS = YES ]; then
- srs_define_macro "SRS_HDS" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_HDS" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_SRT = YES ]; then
- srs_define_macro "SRS_SRT" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_SRT" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_CXX11 = YES ]; then
- srs_define_macro "SRS_CXX11" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_CXX11" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_CXX14 = YES ]; then
- srs_define_macro "SRS_CXX14" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_CXX14" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_RTC = YES ]; then
- srs_define_macro "SRS_RTC" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_RTC" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_FFMPEG_FIT = YES ]; then
- srs_define_macro "SRS_FFMPEG_FIT" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_FFMPEG_FIT" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_SIMULATOR = YES ]; then
- srs_define_macro "SRS_SIMULATOR" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_SIMULATOR" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_HTTPS = YES ]; then
- srs_define_macro "SRS_HTTPS" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_HTTPS" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_UTEST = YES ]; then
- srs_define_macro "SRS_UTEST" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_UTEST" $SRS_AUTO_HEADERS_H
- fi
- # whatever the FFMPEG tools, if transcode and ingest specified,
- # srs always compile the FFMPEG tool stub which used to start the FFMPEG process.
- if [ $SRS_FFMPEG_STUB = YES ]; then
- srs_define_macro "SRS_FFMPEG_STUB" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_FFMPEG_STUB" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_GPERF = YES ]; then
- srs_define_macro "SRS_GPERF" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_GPERF" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_GPERF_MC = YES ]; then
- srs_define_macro "SRS_GPERF_MC" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_GPERF_MC" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_GPERF_MD = YES ]; then
- srs_define_macro "SRS_GPERF_MD" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_GPERF_MD" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_GPERF_MP = YES ]; then
- srs_define_macro "SRS_GPERF_MP" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_GPERF_MP" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_GPERF_CP = YES ]; then
- srs_define_macro "SRS_GPERF_CP" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_GPERF_CP" $SRS_AUTO_HEADERS_H
- fi
- #####################################################################################
- # for embeded.
- #####################################################################################
- # for log level compile settings
- if [ $SRS_LOG_VERBOSE = YES ]; then
- srs_define_macro "SRS_VERBOSE" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_VERBOSE" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_LOG_INFO = YES ]; then
- srs_define_macro "SRS_INFO" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_INFO" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_LOG_TRACE = YES ]; then
- srs_define_macro "SRS_TRACE" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_TRACE" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_CROSS_BUILD = YES ]; then
- srs_define_macro "SRS_CROSSBUILD" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_CROSSBUILD" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_OSX = YES ]; then
- srs_define_macro "SRS_OSX" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_OSX" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_DEBUG = YES ]; then
- srs_define_macro "SRS_DEBUG" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_DEBUG" $SRS_AUTO_HEADERS_H
- fi
- if [ $SRS_DEBUG_STATS = YES ]; then
- srs_define_macro "SRS_DEBUG_STATS" $SRS_AUTO_HEADERS_H
- else
- srs_undefine_macro "SRS_DEBUG_STATS" $SRS_AUTO_HEADERS_H
- fi
- # prefix
- echo "" >> $SRS_AUTO_HEADERS_H
- echo "#define SRS_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H
- echo "#define SRS_DEFAULT_CONFIG \"${SRS_DEFAULT_CONFIG}\"" >> $SRS_AUTO_HEADERS_H
- echo "" >> $SRS_AUTO_HEADERS_H
- #####################################################################################
- # generated the contributors from AUTHORS.txt
- #####################################################################################
- if [[ -f AUTHORS.md ]]; then
- RTMP_SIG_SRS_AUTHORS=$(cat AUTHORS.md|grep "^-"|awk -F '`' '{print $2}')
- echo "#define RTMP_SIG_SRS_AUTHORS \"\\" >> $SRS_AUTO_HEADERS_H
- for CONTRIBUTOR in $RTMP_SIG_SRS_AUTHORS; do
- echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H
- done
- echo "\"" >> $SRS_AUTO_HEADERS_H
- else
- echo "#define RTMP_SIG_SRS_AUTHORS \"ossrs\"" >> $SRS_AUTO_HEADERS_H
- fi
- # new empty line to auto headers file.
- echo "" >> $SRS_AUTO_HEADERS_H
- #####################################################################################
- # auto header EOF.
- #####################################################################################
- echo "#endif" >> $SRS_AUTO_HEADERS_H
- echo "" >> $SRS_AUTO_HEADERS_H
|