mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
parent
d5bf0ba2da
commit
351f7590db
6 changed files with 42 additions and 5 deletions
|
@ -320,7 +320,7 @@ echo ""
|
||||||
# Use srs-cache from base image. See https://github.com/ossrs/dev-docker/blob/ubuntu20-cache/Dockerfile
|
# Use srs-cache from base image. See https://github.com/ossrs/dev-docker/blob/ubuntu20-cache/Dockerfile
|
||||||
# Note that the cache for cygwin is not under /usr/local, but copy to objs instead.
|
# Note that the cache for cygwin is not under /usr/local, but copy to objs instead.
|
||||||
if [[ -d /usr/local/srs-cache/srs/trunk/objs && $(pwd) != "/usr/local/srs-cache/srs/trunk" ]]; then
|
if [[ -d /usr/local/srs-cache/srs/trunk/objs && $(pwd) != "/usr/local/srs-cache/srs/trunk" ]]; then
|
||||||
SOURCE_DIR=$(ls -d /usr/local/srs-cache/srs/trunk/objs/Platform-* 2>/dev/null|head -n 1)
|
SOURCE_DIR=$(ls -d /usr/local/srs-cache/srs/trunk/objs/Platform-SRS${SRS_MAJOR}-* 2>/dev/null|head -n 1)
|
||||||
if [[ -d $SOURCE_DIR ]]; then
|
if [[ -d $SOURCE_DIR ]]; then
|
||||||
TARGET_DIR=${SRS_OBJS}/${SRS_PLATFORM} &&
|
TARGET_DIR=${SRS_OBJS}/${SRS_PLATFORM} &&
|
||||||
echo "Build from cache, source=$SOURCE_DIR, target=$TARGET_DIR" &&
|
echo "Build from cache, source=$SOURCE_DIR, target=$TARGET_DIR" &&
|
||||||
|
|
|
@ -5,12 +5,29 @@ OS_KERNEL_NAME=$(uname -s)
|
||||||
OS_KERNRL_RELEASE=$(uname -r|awk -F '-' '{print $1}')
|
OS_KERNRL_RELEASE=$(uname -r|awk -F '-' '{print $1}')
|
||||||
OS_PREFIX="Platform"
|
OS_PREFIX="Platform"
|
||||||
|
|
||||||
|
# Detect gcc, which is required.
|
||||||
|
gcc --version >/dev/null 2>/dev/null || (ret=$?; echo "Please install gcc"; exit $ret)
|
||||||
|
|
||||||
|
# Discover SRS version from header file.
|
||||||
|
mkdir -p ${SRS_OBJS} &&
|
||||||
|
echo '#include <stdio.h>' > ${SRS_OBJS}/test_version.c &&
|
||||||
|
echo '#include <srs_core_version.hpp>' >> ${SRS_OBJS}/test_version.c &&
|
||||||
|
echo 'int main(int argc, char** argv) {' >> ${SRS_OBJS}/test_version.c &&
|
||||||
|
echo ' printf("%d.%d.%d\n", VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION);' >> ${SRS_OBJS}/test_version.c &&
|
||||||
|
echo ' return 0;' >> ${SRS_OBJS}/test_version.c &&
|
||||||
|
echo '}' >> ${SRS_OBJS}/test_version.c &&
|
||||||
|
gcc -g -O0 ${SRS_OBJS}/test_version.c -I${SRS_WORKDIR}/src/core -o ${SRS_OBJS}/test_version 1>/dev/null 2>&1 &&
|
||||||
|
SRS_VERSION=$(./${SRS_OBJS}/test_version 2>/dev/null) &&
|
||||||
|
SRS_MAJOR=$(echo $SRS_VERSION |awk -F . '{print $1}');
|
||||||
|
ret=$?; rm -rf ${SRS_OBJS}/test_version*; if [[ $ret -ne 0 ]]; then echo "Detect SRS version failed"; exit $ret; fi
|
||||||
|
echo "Discover SRS version=${SRS_VERSION}, major=${SRS_MAJOR}"
|
||||||
|
|
||||||
if [[ $OSTYPE == cygwin ]]; then
|
if [[ $OSTYPE == cygwin ]]; then
|
||||||
OS_KERNRL_RELEASE=$(uname -r|awk -F '(' '{print $1}')
|
OS_KERNRL_RELEASE=$(uname -r|awk -F '(' '{print $1}')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build platform cache.
|
# Build platform cache.
|
||||||
SRS_PLATFORM="${SRS_BUILD_TAG}${OS_PREFIX}-${OS_KERNEL_NAME}-${OS_KERNRL_RELEASE}"
|
SRS_PLATFORM="${SRS_BUILD_TAG}${OS_PREFIX}-SRS${SRS_MAJOR}-${OS_KERNEL_NAME}-${OS_KERNRL_RELEASE}"
|
||||||
# Build platform cache with gcc version.
|
# Build platform cache with gcc version.
|
||||||
if [[ $OS_KERNEL_NAME == Darwin ]]; then
|
if [[ $OS_KERNEL_NAME == Darwin ]]; then
|
||||||
GCC_VERSION="Clang$(gcc --version 2>/dev/null|grep clang|awk '{print $4}')"
|
GCC_VERSION="Clang$(gcc --version 2>/dev/null|grep clang|awk '{print $4}')"
|
||||||
|
@ -21,7 +38,7 @@ else
|
||||||
SRS_PLATFORM="${SRS_PLATFORM}-${GCC_VERSION}"
|
SRS_PLATFORM="${SRS_PLATFORM}-${GCC_VERSION}"
|
||||||
fi
|
fi
|
||||||
# Use isolate cache for different SRS version.
|
# Use isolate cache for different SRS version.
|
||||||
SRS_PLATFORM="${SRS_PLATFORM}-SRS5-$(uname -m)"
|
SRS_PLATFORM="${SRS_PLATFORM}-$(uname -m)"
|
||||||
|
|
||||||
if [[ $SRS_CROSS_BUILD == YES ]]; then
|
if [[ $SRS_CROSS_BUILD == YES ]]; then
|
||||||
SRS_TOOL_CC_NAME=$(basename $SRS_TOOL_CC)
|
SRS_TOOL_CC_NAME=$(basename $SRS_TOOL_CC)
|
||||||
|
|
2
trunk/configure
vendored
2
trunk/configure
vendored
|
@ -236,7 +236,7 @@ fi
|
||||||
MODULE_ID="CORE"
|
MODULE_ID="CORE"
|
||||||
MODULE_DEPENDS=()
|
MODULE_DEPENDS=()
|
||||||
ModuleLibIncs=(${SRS_OBJS})
|
ModuleLibIncs=(${SRS_OBJS})
|
||||||
MODULE_FILES=("srs_core" "srs_core_version5" "srs_core_autofree" "srs_core_performance"
|
MODULE_FILES=("srs_core" "srs_core_version" "srs_core_version5" "srs_core_autofree" "srs_core_performance"
|
||||||
"srs_core_time" "srs_core_platform")
|
"srs_core_time" "srs_core_platform")
|
||||||
CORE_INCS="src/core"; MODULE_DIR=${CORE_INCS} . $SRS_WORKDIR/auto/modules.sh
|
CORE_INCS="src/core"; MODULE_DIR=${CORE_INCS} . $SRS_WORKDIR/auto/modules.sh
|
||||||
CORE_OBJS="${MODULE_OBJS[@]}"
|
CORE_OBJS="${MODULE_OBJS[@]}"
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#define SRS_CORE_HPP
|
#define SRS_CORE_HPP
|
||||||
|
|
||||||
// The version config.
|
// The version config.
|
||||||
#include <srs_core_version6.hpp>
|
#include <srs_core_version.hpp>
|
||||||
|
|
||||||
// The macros generated by configure script.
|
// The macros generated by configure script.
|
||||||
#include <srs_auto_headers.hpp>
|
#include <srs_auto_headers.hpp>
|
||||||
|
|
8
trunk/src/core/srs_core_version.cpp
Normal file
8
trunk/src/core/srs_core_version.cpp
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
//
|
||||||
|
// Copyright (c) 2013-2022 The SRS Authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT or MulanPSL-2.0
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <srs_core_version.hpp>
|
||||||
|
|
12
trunk/src/core/srs_core_version.hpp
Normal file
12
trunk/src/core/srs_core_version.hpp
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
//
|
||||||
|
// Copyright (c) 2013-2022 The SRS Authors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT or MulanPSL-2.0
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef SRS_CORE_VERSION_HPP
|
||||||
|
#define SRS_CORE_VERSION_HPP
|
||||||
|
|
||||||
|
#include <srs_core_version6.hpp>
|
||||||
|
|
||||||
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue