Skip to content

Commit

Permalink
For ossrs#2532: Windows: Replace ln by cp for windows. v5.0.87
Browse files Browse the repository at this point in the history
1. Replase ln by cp for windows.
2. Refine OS and CPU arch detecting.
3. Support configure from any directory by `SRS_WORKDIR`.
4. Support output to any directory by `SRS_OUTPUT`.
5. Disable sanitizer for gperf.
6. Use parallels build for make.
7. Refine bash variable check.
  • Loading branch information
winlinvip committed Nov 18, 2022
1 parent 368356c commit faafc1d
Show file tree
Hide file tree
Showing 13 changed files with 536 additions and 556 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

.idea
.DS_Store
*.heap

cmake-build-debug
/trunk/ide/srs_clion/CMakeCache.txt
Expand Down
17 changes: 9 additions & 8 deletions trunk/auto/apps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
#
# params:
# $SRS_OBJS the objs directory to store the Makefile. ie. ./objs
# $SRS_OBJS_DIR the objs directory for Makefile. ie. objs
# $SRS_MAKEFILE the makefile name. ie. Makefile
# $SRS_OBJS the objs directory for Makefile. ie. objs
#
# $MAIN_ENTRANCES array, disable all except the $APP_MAIN itself. ie. ["srs_main_server"]
# $APP_MAIN the object file that contains main function. ie. srs_main_server
Expand All @@ -13,9 +12,9 @@
# $ModuleLibFiles array, the 3rdpart library file to link with. ie. [objs/st-1.9/obj/libst.a objs/libx264/obj/libx264.a]
# $LINK_OPTIONS the linker options. ie. -ldl

FILE=${SRS_OBJS}/${SRS_MAKEFILE}
FILE=${SRS_OBJS}/Makefile

APP_TARGET="${SRS_OBJS_DIR}/${APP_NAME}"
APP_TARGET="${SRS_OBJS}/${APP_NAME}"

echo "Generating app ${APP_NAME} depends.";

Expand All @@ -40,15 +39,16 @@ for item in ${MODULE_OBJS[*]}; do
fi
done

if [ ! -f ${item} ]; then
if [ ! -f ${SRS_WORKDIR}/${item} ]; then
ignored=1
fi

if [ ${ignored} == 1 ]; then
echo "Ignore file ${FILE_NAME}"
continue;
fi

OBJ_FILE=${SRS_OBJS_DIR}/$item
OBJ_FILE=${SRS_OBJS}/$item
OBJ_FILE="${OBJ_FILE%.*}.o"
echo -n "${OBJ_FILE} " >> ${FILE}
done
Expand All @@ -71,15 +71,16 @@ for item in ${MODULE_OBJS[*]}; do
fi
done

if [ ! -f ${item} ]; then
if [ ! -f ${SRS_WORKDIR}/${item} ]; then
ignored=1
fi

if [ ${ignored} == 1 ]; then
echo "Ignore file ${FILE_NAME}"
continue;
fi

OBJ_FILE=${SRS_OBJS_DIR}/$item
OBJ_FILE=${SRS_OBJS}/$item
OBJ_FILE="${OBJ_FILE%.*}.o"
echo -n "${OBJ_FILE} " >> ${FILE}
done
Expand Down
50 changes: 25 additions & 25 deletions trunk/auto/auto_headers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,101 +44,101 @@ function srs_undefine_macro()
# generate auto headers file, depends on the finished of options.sh
#####################################################################################
# auto headers in depends.
if [ $SRS_HDS = YES ]; then
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
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
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
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_BACKTRACE = YES ]; then
if [[ $SRS_BACKTRACE == YES ]]; then
srs_define_macro "SRS_BACKTRACE" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_BACKTRACE" $SRS_AUTO_HEADERS_H
fi

if [ $SRS_RTC = YES ]; then
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
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
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
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_GB28181 = YES ]; then
if [[ $SRS_GB28181 == YES ]]; then
srs_define_macro "SRS_GB28181" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_GB28181" $SRS_AUTO_HEADERS_H
fi

if [ $SRS_UTEST = YES ]; then
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
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
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
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
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
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
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
Expand All @@ -148,44 +148,44 @@ fi
# for embeded.
#####################################################################################
# for log level compile settings
if [ $SRS_LOG_VERBOSE = YES ]; then
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
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
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_LOG_LEVEL_V2 = YES ]; then
if [[ $SRS_LOG_LEVEL_V2 == YES ]]; then
srs_define_macro "SRS_LOG_LEVEL_V2" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_LOG_LEVEL_V2" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_CROSS_BUILD = YES ]; then
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
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
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
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
Expand Down
4 changes: 2 additions & 2 deletions trunk/auto/codecov.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

# In .circleci/config.yml, generate *.gcno with
# ./configure --gcov --without-research --without-librtmp && make utest
# ./configure --gcov && make utest
# and generate *.gcda by
# ./objs/srs_utest

# Workdir is objs/cover.
workdir=`pwd`/objs/cover
workdir=$(cd `dirname $0`/.. && pwd)/objs/cover

# Create trunk under workdir.
mkdir -p $workdir && cd $workdir
Expand Down
Loading

0 comments on commit faafc1d

Please sign in to comment.