Repository: ossrs/srs
File: trunk/auto/options.sh (Shell)

Code before:
            SRS_CROSS_BUILD_PREFIX="${SRS_CROSS_BUILD_HOST}-"
        fi
        SRS_TOOL_CC=${SRS_CROSS_BUILD_PREFIX}gcc
        SRS_TOOL_CXX=${SRS_CROSS_BUILD_PREFIX}g++
        SRS_TOOL_AR=${SRS_CROSS_BUILD_PREFIX}ar
        SRS_TOOL_LD=${SRS_CROSS_BUILD_PREFIX}ld
        SRS_TOOL_RANDLIB=${SRS_CROSS_BUILD_PREFIX}randlib
        if [[ $SRS_CROSS_BUILD_ARCH == "" ]]; then
            echo $SRS_TOOL_CC| grep arm >/dev/null 2>&1 && SRS_CROSS_BUILD_ARCH="arm"
            echo $SRS_TOOL_CC| grep aarch64 >/dev/null 2>&1 && SRS_CROSS_BUILD_ARCH="aarch64"
            echo $SRS_TOOL_CC| grep mipsel >/dev/null 2>&1 && SRS_CROSS_BUILD_ARCH="mipsel"
        fi
        echo "For cross build, host: $SRS_CROSS_BUILD_HOST, prefix: $SRS_CROSS_BUILD_PREFIX, arch: $SRS_CROSS_BUILD_ARCH, cpu: $SRS_CROSS_BUILD_CPU gcc: $SRS_TOOL_CC"
    fi

    if [[ $SRS_OSX == YES ]]; then
      SRS_TOOL_LD=$SRS_TOOL_CC
    fi

    # Enable FFmpeg fit for RTC to transcode audio from AAC to OPUS, if user enabled it.
    if [[ $SRS_RTC == YES && $SRS_FFMPEG_FIT == RESERVED ]]; then
        SRS_FFMPEG_FIT=YES
    fi

    # Enable asan, but disable for Centos
    # @see https://github.com/ossrs/srs/issues/3347
    if [[ $SRS_SANITIZER == RESERVED && $OS_IS_CENTOS != YES ]]; then
        echo "Enable asan by auto options."
        SRS_SANITIZER=YES
    fi

    # If enable gperf, disable sanitizer.
    if [[ $SRS_GPERF == YES && $SRS_SANITIZER == YES ]]; then
        echo "Disable sanitizer for gperf"
        SRS_SANITIZER=NO
    fi

    # if transcode/ingest specified, requires the ffmpeg stub classes.
    SRS_FFMPEG_STUB=NO
    if [[ $SRS_TRANSCODE == YES ]]; then SRS_FFMPEG_STUB=YES; fi
    if [[ $SRS_INGEST == YES ]]; then SRS_FFMPEG_STUB=YES; fi

    if [[ $SRS_SRTP_ASM == YES && $SRS_RTC == NO ]]; then
        echo "Disable SRTP-ASM, because RTC is disabled."
        SRS_SRTP_ASM=NO
    fi

    if [[ $SRS_SRTP_ASM == YES && $SRS_NASM == NO ]]; then
        echo "Disable SRTP-ASM, because NASM is disabled."
        SRS_SRTP_ASM=NO
    fi

Review comment (security):
If it is CentOS, then `SRS_SANITIZER=RESERVED` is actually not very good.

It should be explicitly set to NO.

`TRANS_BY_GPT3`

Code after:
        SRS_TOOL_CXX=${SRS_CROSS_BUILD_PREFIX}g++
        SRS_TOOL_AR=${SRS_CROSS_BUILD_PREFIX}ar
        SRS_TOOL_LD=${SRS_CROSS_BUILD_PREFIX}ld
        SRS_TOOL_RANDLIB=${SRS_CROSS_BUILD_PREFIX}randlib
        if [[ $SRS_CROSS_BUILD_ARCH == "" ]]; then
            echo $SRS_TOOL_CC| grep arm >/dev/null 2>&1 && SRS_CROSS_BUILD_ARCH="arm"
            echo $SRS_TOOL_CC| grep aarch64 >/dev/null 2>&1 && SRS_CROSS_BUILD_ARCH="aarch64"
            echo $SRS_TOOL_CC| grep mipsel >/dev/null 2>&1 && SRS_CROSS_BUILD_ARCH="mipsel"
        fi
        echo "For cross build, host: $SRS_CROSS_BUILD_HOST, prefix: $SRS_CROSS_BUILD_PREFIX, arch: $SRS_CROSS_BUILD_ARCH, cpu: $SRS_CROSS_BUILD_CPU gcc: $SRS_TOOL_CC"
    fi

    if [[ $SRS_OSX == YES ]]; then
      SRS_TOOL_LD=$SRS_TOOL_CC
    fi

    # Enable FFmpeg fit for RTC to transcode audio from AAC to OPUS, if user enabled it.
    if [[ $SRS_RTC == YES && $SRS_FFMPEG_FIT == RESERVED ]]; then
        SRS_FFMPEG_FIT=YES
    fi

    # Enable asan, but disable for Centos
    # @see https://github.com/ossrs/srs/issues/3347
    if [[ $SRS_SANITIZER == NO && $OS_IS_CENTOS != YES ]]; then
        echo "Enable asan by auto options."
        SRS_SANITIZER=YES
    fi

    # If enable gperf, disable sanitizer.
    if [[ $SRS_GPERF == YES && $SRS_SANITIZER == YES ]]; then
        echo "Disable sanitizer for gperf"
        SRS_SANITIZER=NO
    fi

    # if transcode/ingest specified, requires the ffmpeg stub classes.
    SRS_FFMPEG_STUB=NO
    if [[ $SRS_TRANSCODE == YES ]]; then SRS_FFMPEG_STUB=YES; fi
    if [[ $SRS_INGEST == YES ]]; then SRS_FFMPEG_STUB=YES; fi

    if [[ $SRS_SRTP_ASM == YES && $SRS_RTC == NO ]]; then
        echo "Disable SRTP-ASM, because RTC is disabled."
        SRS_SRTP_ASM=NO
    fi

    if [[ $SRS_SRTP_ASM == YES && $SRS_NASM == NO ]]; then
        echo "Disable SRTP-ASM, because NASM is disabled."
        SRS_SRTP_ASM=NO
    fi

    # TODO: FIXME: Should build address sanitizer for cygwin64.
    # See https://github.com/ossrs/srs/issues/3252