1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Upgrade libsrt to v1.5.3. v5.0.183 v6.0.81 (#3808)

fix https://github.com/ossrs/srs/issues/3155
Build srt-1-fit fails with `standard attributes in middle of
decl-specifiers` on GCC 12,Arch Linux.

See https://github.com/Haivision/srt/releases/tag/v1.5.3
This commit is contained in:
Haibo Chen 2023-09-21 22:23:56 +08:00 committed by GitHub
parent f9bba0a9b0
commit c5e067fb0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
94 changed files with 5974 additions and 6273 deletions

View file

@ -0,0 +1,57 @@
#
# SRT - Secure, Reliable, Transport Copyright (c) 2022 Haivision Systems Inc.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
#
# Check for C++11 std::put_time().
#
# Sets:
# HAVE_CXX_STD_PUT_TIME
include(CheckCSourceCompiles)
function(CheckCXXStdPutTime)
unset(HAVE_CXX_STD_PUT_TIME CACHE)
set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE) # CMake 3.6
unset(CMAKE_REQUIRED_FLAGS)
unset(CMAKE_REQUIRED_LIBRARIES)
unset(CMAKE_REQUIRED_LINK_OPTIONS)
set(CheckCXXStdPutTime_CODE
"
#include <iostream>
#include <iomanip>
#include <ctime>
int main(void)
{
const int result = 0;
std::time_t t = std::time(nullptr);
std::tm tm = *std::localtime(&t);
std::cout
<< std::put_time(&tm, \"%FT%T\")
<< std::setfill('0')
<< std::setw(6)
<< std::endl;
return result;
}
"
)
# NOTE: Should we set -std or use the current compiler configuration.
# It seems that the top level build does not track the compiler
# in a consistent manner. So Maybe we need this?
set(CMAKE_REQUIRED_FLAGS "-std=c++11")
# Check that the compiler can build the std::put_time() example:
message(STATUS "Checking for C++ 'std::put_time()':")
check_cxx_source_compiles(
"${CheckCXXStdPutTime_CODE}"
HAVE_CXX_STD_PUT_TIME)
endfunction(CheckCXXStdPutTime)

View file

@ -36,7 +36,7 @@ function(CheckGCCAtomicIntrinsics)
unset(CMAKE_REQUIRED_LIBRARIES)
unset(CMAKE_REQUIRED_LINK_OPTIONS)
# Check for existance of libatomic and whether this symbol is present.
# Check for existence of libatomic and whether this symbol is present.
check_library_exists(atomic __atomic_fetch_add_8 "" HAVE_LIBATOMIC)
set(CheckLibAtomicCompiles_CODE

View file

@ -141,6 +141,7 @@ function(ShowProjectConfig)
" HAVE_GCCATOMIC_INTRINSICS_REQUIRES_LIBATOMIC: ${HAVE_GCCATOMIC_INTRINSICS_REQUIRES_LIBATOMIC}\n"
" HAVE_CXX_ATOMIC: ${HAVE_CXX_ATOMIC}\n"
" HAVE_CXX_ATOMIC_STATIC: ${HAVE_CXX_ATOMIC_STATIC}\n"
" HAVE_CXX_STD_PUT_TIME: ${HAVE_CXX_STD_PUT_TIME}\n"
" Project Configuration:\n"
" ENABLE_DEBUG: ${ENABLE_DEBUG}\n"
" ENABLE_CXX11: ${ENABLE_CXX11}\n"

View file

@ -0,0 +1,3 @@
## Scripts for building SRT for Android
See [Building SRT for Android](../../docs/build/build-android.md) for the instructions.

View file

@ -0,0 +1,111 @@
#!/bin/sh
echo_help()
{
echo "Usage: $0 [options...]"
echo " -n NDK root path for the build"
echo " -a Target API level"
echo " -t Space-separated list of target architectures"
echo " Android supports the following architectures: armeabi-v7a arm64-v8a x86 x86_64"
echo " -e Encryption library to be used. Possible options: openssl (default) mbedtls"
echo " -o OpenSSL version. E.g. 1.1.1l"
echo " -m Mbed TLS version. E.g. v2.26.0"
echo
echo "Example: ./build-android -n /home/username/Android/Sdk/ndk/23.0.7599858 -a 28 -t \"arm64-v8a x86_64\""
echo
}
# Init optional command line vars
NDK_ROOT=""
API_LEVEL=28
BUILD_TARGETS="armeabi-v7a arm64-v8a x86 x86_64"
OPENSSL_VERSION=1.1.1l
ENC_LIB=openssl
MBEDTLS_VERSION=v2.26.0
while getopts n:a:t:o:s:e:m: option
do
case "${option}"
in
n) NDK_ROOT=${OPTARG};;
a) API_LEVEL=${OPTARG};;
t) BUILD_TARGETS=${OPTARG};;
o) OPENSSL_VERSION=${OPTARG};;
s) SRT_VERSION=${OPTARG};;
e) ENC_LIB=${OPTARG};;
m) MBEDTLS_VERSION=${OPTARG};;
*) twentytwo=${OPTARG};;
esac
done
echo_help
if [ -z "$NDK_ROOT" ] ; then
echo "NDK directory not set."
exit 128
else
if [ ! -d "$NDK_ROOT" ]; then
echo "NDK directory does not exist: $NDK_ROOT"
exit 128
fi
fi
SCRIPT_DIR=$(pwd)
HOST_TAG='unknown'
unamestr=$(uname -s)
if [ "$unamestr" = 'Linux' ]; then
HOST_TAG='linux-x86_64'
elif [ "$unamestr" = 'Darwin' ]; then
if [ $(uname -p) = 'arm' ]; then
echo "NDK does not currently support ARM64"
exit 128
else
HOST_TAG='darwin-x86_64'
fi
fi
# Write files relative to current location
BASE_DIR=$(pwd)
case "${BASE_DIR}" in
*\ * )
echo "Your path contains whitespaces, which is not supported by 'make install'."
exit 128
;;
esac
cd "${BASE_DIR}"
if [ $ENC_LIB = 'openssl' ]; then
echo "Building OpenSSL $OPENSSL_VERSION"
$SCRIPT_DIR/mkssl -n $NDK_ROOT -a $API_LEVEL -t "$BUILD_TARGETS" -o $OPENSSL_VERSION -d $BASE_DIR -h $HOST_TAG
elif [ $ENC_LIB = 'mbedtls' ]; then
if [ ! -d $BASE_DIR/mbedtls ]; then
git clone https://github.com/ARMmbed/mbedtls mbedtls
if [ ! -z "$MBEDTLS_VERSION" ]; then
git -C $BASE_DIR/mbedtls checkout $MBEDTLS_VERSION
fi
fi
else
echo "Unknown encryption library. Possible options: openssl mbedtls"
exit 128
fi
# Build working copy of srt repository
REPO_DIR="../.."
for build_target in $BUILD_TARGETS; do
LIB_DIR=$BASE_DIR/$build_target/lib
JNI_DIR=$BASE_DIR/prebuilt/$build_target
mkdir -p $JNI_DIR
if [ $ENC_LIB = 'mbedtls' ]; then
$SCRIPT_DIR/mkmbedtls -n $NDK_ROOT -a $API_LEVEL -t $build_target -s $BASE_DIR/mbedtls -i $BASE_DIR/$build_target
cp $LIB_DIR/libmbedcrypto.so $JNI_DIR/libmbedcrypto.so
cp $LIB_DIR/libmbedtls.so $JNI_DIR/libmbedtls.so
cp $LIB_DIR/libmbedx509.so $JNI_DIR/libmbedx509.so
fi
git -C $REPO_DIR clean -fd -e scripts
$SCRIPT_DIR/mksrt -n $NDK_ROOT -a $API_LEVEL -t $build_target -e $ENC_LIB -s $REPO_DIR -i $BASE_DIR/$build_target
cp $LIB_DIR/libsrt.so $JNI_DIR/libsrt.so
done

View file

@ -0,0 +1,27 @@
#!/bin/sh
while getopts s:i:t:n:a: option
do
case "${option}"
in
s) SRC_DIR=${OPTARG};;
i) INSTALL_DIR=${OPTARG};;
t) ARCH_ABI=${OPTARG};;
n) NDK_ROOT=${OPTARG};;
a) API_LEVEL=${OPTARG};;
*) twentytwo=${OPTARG};;
esac
done
BUILD_DIR=/tmp/mbedtls_android_build
rm -rf $BUILD_DIR
mkdir $BUILD_DIR
cd $BUILD_DIR
cmake -DENABLE_TESTING=Off -DUSE_SHARED_MBEDTLS_LIBRARY=On \
-DCMAKE_PREFIX_PATH=$INSTALL_DIR -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DCMAKE_ANDROID_NDK=$NDK_ROOT \
-DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=$API_LEVEL -DCMAKE_ANDROID_ARCH_ABI=$ARCH_ABI \
-DCMAKE_C_FLAGS="-fPIC" -DCMAKE_SHARED_LINKER_FLAGS="-Wl,--build-id" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo $SRC_DIR
cmake --build .
cmake --install .

View file

@ -0,0 +1,32 @@
#!/bin/sh
while getopts s:i:t:n:a:e: option
do
case "${option}"
in
s) SRC_DIR=${OPTARG};;
i) INSTALL_DIR=${OPTARG};;
t) ARCH_ABI=${OPTARG};;
n) NDK_ROOT=${OPTARG};;
a) API_LEVEL=${OPTARG};;
e) ENC_LIB=${OPTARG};;
*) twentytwo=${OPTARG};;
esac
done
cd $SRC_DIR
./configure --use-enclib=$ENC_LIB \
--use-openssl-pc=OFF \
--OPENSSL_INCLUDE_DIR=$INSTALL_DIR/include \
--OPENSSL_CRYPTO_LIBRARY=$INSTALL_DIR/lib/libcrypto.a --OPENSSL_SSL_LIBRARY=$INSTALL_DIR/lib/libssl.a \
--STATIC_MBEDTLS=FALSE \
--MBEDTLS_INCLUDE_DIR=$INSTALL_DIR/include --MBEDTLS_INCLUDE_DIRS=$INSTALL_DIR/include \
--MBEDTLS_LIBRARIES=$INSTALL_DIR/lib/libmbedtls.so \
--CMAKE_PREFIX_PATH=$INSTALL_DIR --CMAKE_INSTALL_PREFIX=$INSTALL_DIR --CMAKE_ANDROID_NDK=$NDK_ROOT \
--CMAKE_SYSTEM_NAME=Android --CMAKE_SYSTEM_VERSION=$API_LEVEL --CMAKE_ANDROID_ARCH_ABI=$ARCH_ABI \
--CMAKE_C_FLAGS="-fPIC" --CMAKE_SHARED_LINKER_FLAGS="-Wl,--build-id" \
--enable-c++11 --enable-stdcxx-sync \
--enable-debug=2 --enable-logging=0 --enable-heavy-logging=0 --enable-apps=0
make
make install

View file

@ -0,0 +1,85 @@
#!/bin/sh
while getopts n:o:a:t:d:h: option
do
case "${option}"
in
n) ANDROID_NDK=${OPTARG};;
o) OPENSSL_VERSION=${OPTARG};;
a) API_LEVEL=${OPTARG};;
t) BUILD_TARGETS=${OPTARG};;
d) OUT_DIR=${OPTARG};;
h) HOST_TAG=${OPTARG};;
*) twentytwo=${OPTARG};;
esac
done
BUILD_DIR=/tmp/openssl_android_build
if [ ! -d openssl-${OPENSSL_VERSION} ]
then
if [ ! -f openssl-${OPENSSL_VERSION}.tar.gz ]
then
wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz || exit 128
fi
tar xzf openssl-${OPENSSL_VERSION}.tar.gz || exit 128
fi
cd openssl-${OPENSSL_VERSION} || exit 128
##### export ndk directory. Required by openssl-build-scripts #####
case ${OPENSSL_VERSION} in
1.1.1*)
export ANDROID_NDK_HOME=$ANDROID_NDK
;;
*)
export ANDROID_NDK_ROOT=$ANDROID_NDK
;;
esac
export PATH=$ANDROID_NDK/toolchains/llvm/prebuilt/$HOST_TAG/bin:$PATH
##### build-function #####
build_the_thing() {
make clean
./Configure $SSL_TARGET -D__ANDROID_API__=$API_LEVEL && \
make SHLIB_EXT=.so && \
make install SHLIB_EXT=.so DESTDIR=$DESTDIR || exit 128
}
##### set variables according to build-tagret #####
for build_target in $BUILD_TARGETS
do
case $build_target in
armeabi-v7a)
DESTDIR="$BUILD_DIR/armeabi-v7a"
SSL_TARGET="android-arm"
;;
x86)
DESTDIR="$BUILD_DIR/x86"
SSL_TARGET="android-x86"
;;
x86_64)
DESTDIR="$BUILD_DIR/x86_64"
SSL_TARGET="android-x86_64"
;;
arm64-v8a)
DESTDIR="$BUILD_DIR/arm64-v8a"
SSL_TARGET="android-arm64"
;;
esac
rm -rf $DESTDIR
build_the_thing
#### copy libraries and includes to output-directory #####
mkdir -p $OUT_DIR/$build_target/include
cp -R $DESTDIR/usr/local/include/* $OUT_DIR/$build_target/include
cp -R $DESTDIR/usr/local/ssl/* $OUT_DIR/$build_target/
mkdir -p $OUT_DIR/$build_target/lib
cp -R $DESTDIR/usr/local/lib/*.so $OUT_DIR/$build_target/lib
cp -R $DESTDIR/usr/local/lib/*.a $OUT_DIR/$build_target/lib
done
echo Success

View file

@ -101,7 +101,7 @@ if ( $null -eq (Get-Command "cmake.exe" -ErrorAction SilentlyContinue) ) {
# get pthreads from nuget if CXX11 is not enabled
if ( $CXX11 -eq "OFF" ) {
# get pthreads (this is legacy, and is only availble in nuget for VS2015 and VS2013)
# get pthreads (this is legacy, and is only available in nuget for VS2015 and VS2013)
if ( $VS_VERSION -gt 2015 ) {
Write-Output "Pthreads is not recommended for use beyond VS2015 and is not supported by this build script - aborting build"
throw

View file

@ -114,7 +114,7 @@ set errortypes {
SIDINVAL "Invalid socket ID"
ISUNBOUND "Cannot do this operation on an UNBOUND socket"
NOLISTEN "Socket is not in listening state"
ISRENDEZVOUS "Listen/accept is not supported in rendezous connection setup"
ISRENDEZVOUS "Listen/accept is not supported in rendezvous connection setup"
ISRENDUNBOUND "Cannot call connect on UNBOUND socket in rendezvous connection setup"
INVALMSGAPI "Incorrect use of Message API (sendmsg/recvmsg)."
INVALBUFFERAPI "Incorrect use of Buffer API (send/recv) or File API (sendfile/recvfile)."

View file

@ -11,7 +11,7 @@ ExternalProject_Add(
BINARY_DIR "@GOOGLETEST_DOWNLOAD_ROOT@/googletest-build"
GIT_REPOSITORY
https://github.com/google/googletest.git
GIT_TAG release-1.8.1
GIT_TAG release-1.10.0
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""

View file

@ -4,15 +4,24 @@ Script designed to generate release notes template with main sections, contribut
In order to obtain the git log file since the previous release (e.g., v1.4.0), use the following command:
```shell
git log --pretty=format:"%h|%s|%an|%ae" v1.4.0...HEAD > commits.csv
```
git log --pretty=format:"%h|%s|%an|%ae" v1.4.0...HEAD^ > commits.csv
Use the produced `commits.csv` file as an input to the script:
```shell
python scripts/release-notes/generate-release-notes.py commits.csv
```
The script produces `release-notes.md` as an output.
## Requirements
* Python 3.6+
To install Python libraries use:
```
```shell
pip install -r requirements.txt
```

View file

@ -115,7 +115,7 @@ fields.tsbpd_delay = ProtoField.uint16("srt_dev.tsbpd_delay", "TsbPd Delay", bas
fields.rcv_tsbpd_delay = ProtoField.uint16("srt_dev.rcv_tsbpd_delay", "Receiver TsbPd Delay", base.DEC)
fields.snd_tsbpd_delay = ProtoField.uint16("srt_dev.snd_tsbpd_delay", "Sender TsbPd Delay", base.DEC)
-- V adn PT status flag
-- V and PT status flag
local V_state_select = {
[1] = "Initial version"
}
@ -252,7 +252,7 @@ function srt_dev.dissector (tvb, pinfo, tree)
offset = offset + 4
if UDT_version == 4 then
-- UDT version is 4, packet is diffrent from UDT version 5
-- UDT version is 4, packet is different from UDT version 5
-- Handle sock type
local sock_type = tvb(offset, 4):uint()
if sock_type == 1 then

View file

@ -0,0 +1,10 @@
/* Copyright © 2023 Steve Lhomme */
/* SPDX-License-Identifier: ISC */
#include <windows.h>
#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600 /* _WIN32_WINNT_VISTA */
#error NOPE
#endif
int main(void)
{
return 0;
}

View file

@ -125,9 +125,11 @@ Section "Install"
; Header files.
CreateDirectory "$INSTDIR\include\srt"
SetOutPath "$INSTDIR\include\srt"
File "${RepoDir}\srtcore\access_control.h"
File "${RepoDir}\srtcore\logging_api.h"
File "${RepoDir}\srtcore\platform_sys.h"
File "${RepoDir}\srtcore\srt.h"
File "${RepoDir}\srtcore\udt.h"
File "${Build64Dir}\version.h"
CreateDirectory "$INSTDIR\include\win"