1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 11:51:57 +00:00
srs/trunk/auto/setup_variables.sh

46 lines
1.8 KiB
Bash
Raw Normal View History

2015-09-23 03:54:53 +00:00
#!/bin/bash
# when options parsed, setup some variables, then build the depends.
2020-03-29 07:23:40 +00:00
OS_KERNEL_NAME=$(uname -s)
OS_KERNRL_RELEASE=$(uname -r|awk -F '-' '{print $1}')
OS_PREFIX="Platform"
# Build platform cache.
2021-05-21 09:14:04 +00:00
SRS_PLATFORM="${SRS_BUILD_TAG}${OS_PREFIX}-${OS_KERNEL_NAME}-${OS_KERNRL_RELEASE}"
# Build platform cache with gcc version.
if [[ $OS_KERNEL_NAME == Darwin ]]; then
GCC_VERSION="Clang$(gcc --version 2>/dev/null|grep clang|awk '{print $4}')"
SRS_PLATFORM="${SRS_PLATFORM}-${GCC_VERSION}"
else
GCC_VERSION="GCC$(gcc --version 2>/dev/null|grep gcc|awk '{print $3}')"
echo $GCC_VERSION| grep '-' >/dev/null && GCC_VERSION=$(echo $GCC_VERSION| awk -F '-' '{print$1}')
SRS_PLATFORM="${SRS_PLATFORM}-${GCC_VERSION}"
2020-03-29 07:23:40 +00:00
fi
# Use isolate cache for different SRS version.
SRS_PLATFORM="${SRS_PLATFORM}-SRS5-$(uname -m)"
if [[ $SRS_CROSS_BUILD == YES ]]; then
SRS_PLATFORM="${SRS_PLATFORM}-CROSSBUILD-$(echo $SRS_TOOL_CC|awk -F - '{print $1}')"
fi
2020-03-29 07:23:40 +00:00
echo "SRS_WORKDIR: ${SRS_WORKDIR}, SRS_OBJS_DIR: ${SRS_OBJS_DIR}, SRS_OBJS: ${SRS_OBJS}, SRS_PLATFORM: ${SRS_PLATFORM}"
# For src object files on each platform.
(
2020-03-29 08:18:20 +00:00
mkdir -p ${SRS_OBJS_DIR} && cd ${SRS_OBJS_DIR} &&
2020-03-29 09:29:09 +00:00
rm -rf src utest srs srs_utest research include lib srs_hls_ingester srs_mp4_parser &&
2020-03-29 07:23:40 +00:00
mkdir -p ${SRS_PLATFORM}/src && ln -sf ${SRS_PLATFORM}/src &&
mkdir -p ${SRS_PLATFORM}/utest && ln -sf ${SRS_PLATFORM}/utest &&
mkdir -p ${SRS_PLATFORM}/research && ln -sf ${SRS_PLATFORM}/research &&
mkdir -p ${SRS_PLATFORM}/include && ln -sf ${SRS_PLATFORM}/include &&
mkdir -p ${SRS_PLATFORM}/lib && ln -sf ${SRS_PLATFORM}/lib
)
2020-04-02 03:41:36 +00:00
if [[ $SRS_CLEAN == NO ]]; then
echo "Fast cleanup, if need to do full cleanup, please use: make clean"
fi
2020-03-29 07:23:40 +00:00
2020-04-07 12:22:18 +00:00
# Python or python2, for CentOS8.
python2 --version >/dev/null 2>&1 && alias python=python2 &&
echo "Alias python2 as python"