mirror of
https://github.com/ossrs/srs.git
synced 2025-02-13 03:41:55 +00:00
AppleM1: Support Apple Silicon M1(aarch64).
This commit is contained in:
parent
b787656eea
commit
f2fa289fe8
24 changed files with 594 additions and 8 deletions
12
trunk/3rdparty/st-srs/Dockerfile.cov
vendored
Normal file
12
trunk/3rdparty/st-srs/Dockerfile.cov
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
FROM ossrs/srs:dev-gcc7
|
||||||
|
|
||||||
|
# Install depends tools.
|
||||||
|
RUN yum install -y gcc make gcc-c++ patch unzip perl git
|
||||||
|
|
||||||
|
# Build and install SRS.
|
||||||
|
COPY . /st
|
||||||
|
WORKDIR /st
|
||||||
|
|
||||||
|
# Note that we must enable the gcc7 or link failed.
|
||||||
|
RUN scl enable devtoolset-7 -- make linux-debug-gcov
|
||||||
|
|
15
trunk/3rdparty/st-srs/Dockerfile.test
vendored
Normal file
15
trunk/3rdparty/st-srs/Dockerfile.test
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
FROM ossrs/srs:dev-gcc7
|
||||||
|
|
||||||
|
# Install depends tools.
|
||||||
|
RUN yum install -y gcc make gcc-c++ patch unzip perl git
|
||||||
|
|
||||||
|
# Build and install SRS.
|
||||||
|
COPY . /st
|
||||||
|
WORKDIR /st
|
||||||
|
|
||||||
|
# Note that we must enable the gcc7 or link failed.
|
||||||
|
RUN scl enable devtoolset-7 -- make linux-debug-utest
|
||||||
|
|
||||||
|
# Run utest
|
||||||
|
RUN ./obj/st_utest
|
||||||
|
|
6
trunk/3rdparty/st-srs/Makefile
vendored
6
trunk/3rdparty/st-srs/Makefile
vendored
|
@ -100,8 +100,10 @@ EXTRA_OBJS = $(TARGETDIR)/md_darwin.o
|
||||||
LD = cc
|
LD = cc
|
||||||
SFLAGS = -fPIC -fno-common
|
SFLAGS = -fPIC -fno-common
|
||||||
DSO_SUFFIX = dylib
|
DSO_SUFFIX = dylib
|
||||||
CFLAGS += -arch x86_64
|
CPU_ARCHS = $(shell g++ -dM -E - </dev/null |grep -q '__x86_64' && echo x86_64)
|
||||||
LDFLAGS += -arch x86_64
|
CPU_ARCHS += $(shell g++ -dM -E - </dev/null |grep -q '__aarch64' && echo arm64)
|
||||||
|
CFLAGS += -arch $(CPU_ARCHS)
|
||||||
|
LDFLAGS += -arch $(CPU_ARCHS)
|
||||||
LDFLAGS += -dynamiclib -install_name /sw/lib/libst.$(MAJOR).$(DSO_SUFFIX) -compatibility_version $(MAJOR) -current_version $(VERSION)
|
LDFLAGS += -dynamiclib -install_name /sw/lib/libst.$(MAJOR).$(DSO_SUFFIX) -compatibility_version $(MAJOR) -current_version $(VERSION)
|
||||||
OTHER_FLAGS = -Wall
|
OTHER_FLAGS = -Wall
|
||||||
DEFINES += -DMD_HAVE_KQUEUE -DMD_HAVE_SELECT
|
DEFINES += -DMD_HAVE_KQUEUE -DMD_HAVE_SELECT
|
||||||
|
|
1
trunk/3rdparty/st-srs/README.md
vendored
1
trunk/3rdparty/st-srs/README.md
vendored
|
@ -113,6 +113,7 @@ The branch [srs](https://github.com/ossrs/state-threads/tree/srs) will be patche
|
||||||
- [x] System: Support Multiple Threads for Linux and Darwin. [#19](https://github.com/ossrs/state-threads/issues/19), [srs#2188](https://github.com/ossrs/srs/issues/2188).
|
- [x] System: Support Multiple Threads for Linux and Darwin. [#19](https://github.com/ossrs/state-threads/issues/19), [srs#2188](https://github.com/ossrs/srs/issues/2188).
|
||||||
- [x] RISCV: Support RISCV for RISCV CPU, [#24](https://github.com/ossrs/state-threads/pull/28).
|
- [x] RISCV: Support RISCV for RISCV CPU, [#24](https://github.com/ossrs/state-threads/pull/28).
|
||||||
- [x] MIPS: Support Linux/MIPS64 for loongson 3A4000/3B3000, [#21](https://github.com/ossrs/state-threads/pull/21).
|
- [x] MIPS: Support Linux/MIPS64 for loongson 3A4000/3B3000, [#21](https://github.com/ossrs/state-threads/pull/21).
|
||||||
|
- [x] AppleM1: Support Apple Silicon M1(aarch64), [#30](https://github.com/ossrs/state-threads/issues/30).
|
||||||
- [ ] IDE: Support CLion for debugging and learning.
|
- [ ] IDE: Support CLion for debugging and learning.
|
||||||
- [ ] System: Support sendmmsg for UDP, [#12](https://github.com/ossrs/state-threads/issues/12).
|
- [ ] System: Support sendmmsg for UDP, [#12](https://github.com/ossrs/state-threads/issues/12).
|
||||||
|
|
||||||
|
|
72
trunk/3rdparty/st-srs/ide/st_clion/CMakeLists.txt
vendored
Normal file
72
trunk/3rdparty/st-srs/ide/st_clion/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
# Name of the project.
|
||||||
|
# Language "C" is required for find_package(Threads).
|
||||||
|
if (CMAKE_VERSION VERSION_LESS 3.0)
|
||||||
|
project(st CXX C ASM)
|
||||||
|
else()
|
||||||
|
cmake_policy(SET CMP0048 NEW)
|
||||||
|
project(st VERSION 4.0.0 LANGUAGES CXX C ASM)
|
||||||
|
endif()
|
||||||
|
cmake_minimum_required(VERSION 2.8.12)
|
||||||
|
|
||||||
|
# For utest required C++11.
|
||||||
|
set (CMAKE_CXX_STANDARD 11)
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
execute_process(
|
||||||
|
COMMAND bash -c "cd ${PROJECT_SOURCE_DIR}/../../ && pwd"
|
||||||
|
OUTPUT_VARIABLE ST_DIR
|
||||||
|
)
|
||||||
|
string(STRIP ${ST_DIR} ST_DIR)
|
||||||
|
message("ST home is ${ST_DIR}")
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
# Start to configure ST with jobs of number of CPUs.
|
||||||
|
include(ProcessorCount)
|
||||||
|
ProcessorCount(JOBS)
|
||||||
|
|
||||||
|
# We should always configure ST for switching between branches.
|
||||||
|
IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
|
ADD_DEFINITIONS("-arch x86_64 -DDARWIN -DMD_HAVE_KQUEUE -DMD_HAVE_SELECT -DDEBUG")
|
||||||
|
ELSE ()
|
||||||
|
ADD_DEFINITIONS("-DLINUX -DMD_HAVE_EPOLL -DMD_HAVE_SELECT -DDEBUG")
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
|
EXEC_PROGRAM("cd ${ST_DIR} && mkdir -p obj && cp public.h obj/st.h")
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
# For whole project.
|
||||||
|
INCLUDE_DIRECTORIES(${ST_DIR}/obj ${ST_DIR}/utest ${ST_DIR}/utest/gtest/include)
|
||||||
|
|
||||||
|
# Common used sources for SRS and utest.
|
||||||
|
list(APPEND SOURCE_FILES ${ST_DIR}/event.c)
|
||||||
|
list(APPEND SOURCE_FILES ${ST_DIR}/io.c)
|
||||||
|
list(APPEND SOURCE_FILES ${ST_DIR}/key.c)
|
||||||
|
list(APPEND SOURCE_FILES ${ST_DIR}/sched.c)
|
||||||
|
list(APPEND SOURCE_FILES ${ST_DIR}/stk.c)
|
||||||
|
list(APPEND SOURCE_FILES ${ST_DIR}/sync.c)
|
||||||
|
IF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
|
list(APPEND SOURCE_FILES ${ST_DIR}/md_darwin.S)
|
||||||
|
ELSE ()
|
||||||
|
list(APPEND SOURCE_FILES ${ST_DIR}/md_linux.S)
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
|
ADD_DEFINITIONS("-g -O0")
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
# Setup ST utest project
|
||||||
|
ADD_SUBDIRECTORY(${ST_DIR}/utest/gtest-fit gtest-fit)
|
||||||
|
INCLUDE_DIRECTORIES(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
|
||||||
|
|
||||||
|
set(ST_UTEST_SOURCE_FILES ${SOURCE_FILES})
|
||||||
|
AUX_SOURCE_DIRECTORY(${ST_DIR}/utest ST_UTEST_SOURCE_FILES)
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(st_utest ${ST_UTEST_SOURCE_FILES})
|
||||||
|
TARGET_LINK_LIBRARIES(st_utest gtest gtest_main)
|
||||||
|
TARGET_LINK_LIBRARIES(st_utest dl)
|
||||||
|
TARGET_LINK_LIBRARIES(st_utest ${DEPS_LIBS})
|
||||||
|
TARGET_LINK_LIBRARIES(st_utest -ldl -pthread)
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
# Done
|
||||||
|
MESSAGE(STATUS "@see https://github.com/ossrs/state-threads#usage")
|
||||||
|
|
51
trunk/3rdparty/st-srs/libst.def
vendored
Normal file
51
trunk/3rdparty/st-srs/libst.def
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
EXPORTS
|
||||||
|
st_accept @62
|
||||||
|
st_cond_broadcast @63
|
||||||
|
st_cond_destroy @64
|
||||||
|
st_cond_new @65
|
||||||
|
st_cond_signal @66
|
||||||
|
st_cond_timedwait @67
|
||||||
|
st_cond_wait @68
|
||||||
|
st_connect @69
|
||||||
|
st_getfdlimit @70
|
||||||
|
st_init @71
|
||||||
|
st_key_create @72
|
||||||
|
st_key_getlimit @73
|
||||||
|
st_mutex_destroy @74
|
||||||
|
st_mutex_lock @75
|
||||||
|
st_mutex_new @76
|
||||||
|
st_mutex_trylock @77
|
||||||
|
st_mutex_unlock @78
|
||||||
|
st_netfd_close @79
|
||||||
|
st_netfd_fileno @80
|
||||||
|
st_netfd_free @81
|
||||||
|
st_netfd_getspecific @82
|
||||||
|
st_netfd_open @83
|
||||||
|
st_netfd_open_socket @84
|
||||||
|
st_netfd_poll @85
|
||||||
|
st_netfd_serialize_accept @86
|
||||||
|
st_netfd_setspecific @87
|
||||||
|
st_open @88
|
||||||
|
st_poll @89
|
||||||
|
st_randomize_stacks @90
|
||||||
|
st_read @91
|
||||||
|
st_read_fully @92
|
||||||
|
st_read_resid @93
|
||||||
|
st_recvfrom @94
|
||||||
|
st_sendto @95
|
||||||
|
st_sleep @96
|
||||||
|
st_thread_create @97
|
||||||
|
st_thread_exit @98
|
||||||
|
st_thread_getspecific @99
|
||||||
|
st_thread_interrupt @100
|
||||||
|
st_thread_join @101
|
||||||
|
st_thread_self @102
|
||||||
|
st_thread_setspecific @103
|
||||||
|
st_time @104
|
||||||
|
st_timecache_set @105
|
||||||
|
st_usleep @106
|
||||||
|
st_utime @107
|
||||||
|
st_utime_last_clock @108
|
||||||
|
st_write @109
|
||||||
|
st_write_resid @110
|
||||||
|
st_writev @111
|
3
trunk/3rdparty/st-srs/md.h
vendored
3
trunk/3rdparty/st-srs/md.h
vendored
|
@ -71,6 +71,9 @@
|
||||||
#if defined(__amd64__) || defined(__x86_64__)
|
#if defined(__amd64__) || defined(__x86_64__)
|
||||||
#define JB_SP 12 /* The jmpbuf is int(4B) array, while MD_GET_SP covert to long(8B) pointer, so the JB_SP should be 12 which is 6*sizeof(long)/sizeof(int) */
|
#define JB_SP 12 /* The jmpbuf is int(4B) array, while MD_GET_SP covert to long(8B) pointer, so the JB_SP should be 12 which is 6*sizeof(long)/sizeof(int) */
|
||||||
#define MD_GET_SP(_t) *((long *)&((_t)->context[JB_SP]))
|
#define MD_GET_SP(_t) *((long *)&((_t)->context[JB_SP]))
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
/* MUST be SP*2 because context is int array */
|
||||||
|
#define MD_GET_SP(_t) *((long *)&((_t)->context[13 * 2]))
|
||||||
#else
|
#else
|
||||||
#error Unknown CPU architecture
|
#error Unknown CPU architecture
|
||||||
#endif
|
#endif
|
||||||
|
|
124
trunk/3rdparty/st-srs/md_darwin.S
vendored
124
trunk/3rdparty/st-srs/md_darwin.S
vendored
|
@ -74,6 +74,128 @@
|
||||||
|
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#elif defined(__aarch64__)
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
/* See https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms */
|
||||||
|
/* See https://developer.arm.com/documentation/102374/0100/Function-calls */
|
||||||
|
/* See https://developer.arm.com/documentation/102374/0100/Procedure-Call-Standard */
|
||||||
|
/* See https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#machine-registers */
|
||||||
|
/* See https://wiki.cdot.senecacollege.ca/wiki/AArch64_Register_and_Instruction_Quick_Start */
|
||||||
|
/*
|
||||||
|
* See setjmp.h of Darwin.
|
||||||
|
*
|
||||||
|
* _JBLEN is the number of ints required to save the following:
|
||||||
|
* r21-r29, sp, fp, lr == 12 registers, 8 bytes each. d8-d15
|
||||||
|
* are another 8 registers, each 8 bytes long. (aapcs64 specifies
|
||||||
|
* that only 64-bit versions of FP registers need to be saved).
|
||||||
|
* Finally, two 8-byte fields for signal handling purposes.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* The called routine is expected to preserve r19-r28 *** These registers are generally
|
||||||
|
safe to use in your program. */
|
||||||
|
#define JB_X19 0
|
||||||
|
#define JB_X20 1
|
||||||
|
#define JB_X21 2
|
||||||
|
#define JB_X22 3
|
||||||
|
#define JB_X23 4
|
||||||
|
#define JB_X24 5
|
||||||
|
#define JB_X25 6
|
||||||
|
#define JB_X26 7
|
||||||
|
#define JB_X27 8
|
||||||
|
#define JB_X28 9
|
||||||
|
/* r29 and r30 are used as the frame register and link register (avoid) */
|
||||||
|
#define JB_X29 10
|
||||||
|
#define JB_LR 11
|
||||||
|
/* Register '31' is one of two registers depending on the instruction context:
|
||||||
|
For instructions dealing with the stack, it is the stack pointer, named rsp */
|
||||||
|
#define JB_SP 13
|
||||||
|
|
||||||
|
/* FP registers */
|
||||||
|
#define JB_D8 14
|
||||||
|
#define JB_D9 15
|
||||||
|
#define JB_D10 16
|
||||||
|
#define JB_D11 17
|
||||||
|
#define JB_D12 18
|
||||||
|
#define JB_D13 19
|
||||||
|
#define JB_D14 20
|
||||||
|
#define JB_D15 21
|
||||||
|
|
||||||
|
.file "md.S"
|
||||||
|
.text
|
||||||
|
|
||||||
|
/* _st_md_cxt_save(__jmp_buf env) */
|
||||||
|
.globl __st_md_cxt_save
|
||||||
|
.align 4
|
||||||
|
__st_md_cxt_save:
|
||||||
|
stp x19, x20, [x0, #JB_X19<<3]
|
||||||
|
stp x21, x22, [x0, #JB_X21<<3]
|
||||||
|
stp x23, x24, [x0, #JB_X23<<3]
|
||||||
|
stp x25, x26, [x0, #JB_X25<<3]
|
||||||
|
stp x27, x28, [x0, #JB_X27<<3]
|
||||||
|
stp x29, x30, [x0, #JB_X29<<3]
|
||||||
|
|
||||||
|
stp d8, d9, [x0, #JB_D8<<3]
|
||||||
|
stp d10, d11, [x0, #JB_D10<<3]
|
||||||
|
stp d12, d13, [x0, #JB_D12<<3]
|
||||||
|
stp d14, d15, [x0, #JB_D14<<3]
|
||||||
|
mov x2, sp
|
||||||
|
str x2, [x0, #JB_SP<<3]
|
||||||
|
|
||||||
|
mov x0, #0
|
||||||
|
ret
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
|
||||||
|
/* _st_md_cxt_restore(__jmp_buf env, int val) */
|
||||||
|
.globl __st_md_cxt_restore
|
||||||
|
.align 4
|
||||||
|
__st_md_cxt_restore:
|
||||||
|
ldp x19, x20, [x0, #JB_X19<<3]
|
||||||
|
ldp x21, x22, [x0, #JB_X21<<3]
|
||||||
|
ldp x23, x24, [x0, #JB_X23<<3]
|
||||||
|
ldp x25, x26, [x0, #JB_X25<<3]
|
||||||
|
ldp x27, x28, [x0, #JB_X27<<3]
|
||||||
|
|
||||||
|
ldp x29, x30, [x0, #JB_X29<<3]
|
||||||
|
|
||||||
|
ldp d8, d9, [x0, #JB_D8<<3]
|
||||||
|
ldp d10, d11, [x0, #JB_D10<<3]
|
||||||
|
ldp d12, d13, [x0, #JB_D12<<3]
|
||||||
|
ldp d14, d15, [x0, #JB_D14<<3]
|
||||||
|
|
||||||
|
ldr x5, [x0, #JB_SP<<3]
|
||||||
|
mov sp, x5
|
||||||
|
|
||||||
|
/* x0 = (x1 || 1); */
|
||||||
|
cmp x1, #0
|
||||||
|
mov x0, #1
|
||||||
|
csel x0, x1, x0, ne
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
13
trunk/3rdparty/st-srs/md_linux.S
vendored
13
trunk/3rdparty/st-srs/md_linux.S
vendored
|
@ -175,8 +175,15 @@
|
||||||
#elif defined(__aarch64__)
|
#elif defined(__aarch64__)
|
||||||
|
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
/* https://github.com/ossrs/srs/issues/1282#issuecomment-445539513 */
|
/* See https://developer.arm.com/documentation/102374/0100/Function-calls */
|
||||||
|
/* See https://developer.arm.com/documentation/102374/0100/Procedure-Call-Standard */
|
||||||
|
/* See https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#machine-registers */
|
||||||
|
/* See https://wiki.cdot.senecacollege.ca/wiki/AArch64_Register_and_Instruction_Quick_Start */
|
||||||
|
/* See https://chromium.googlesource.com/native_client/nacl-glibc/+/glibc-2.21/sysdeps/aarch64/__longjmp.S */
|
||||||
|
/* See https://chromium.googlesource.com/native_client/nacl-glibc/+/glibc-2.21/sysdeps/aarch64/setjmp.S */
|
||||||
|
|
||||||
|
/* The called routine is expected to preserve r19-r28 *** These registers are generally
|
||||||
|
safe to use in your program. */
|
||||||
#define JB_X19 0
|
#define JB_X19 0
|
||||||
#define JB_X20 1
|
#define JB_X20 1
|
||||||
#define JB_X21 2
|
#define JB_X21 2
|
||||||
|
@ -187,10 +194,14 @@
|
||||||
#define JB_X26 7
|
#define JB_X26 7
|
||||||
#define JB_X27 8
|
#define JB_X27 8
|
||||||
#define JB_X28 9
|
#define JB_X28 9
|
||||||
|
/* r29 and r30 are used as the frame register and link register (avoid) */
|
||||||
#define JB_X29 10
|
#define JB_X29 10
|
||||||
#define JB_LR 11
|
#define JB_LR 11
|
||||||
|
/* Register '31' is one of two registers depending on the instruction context:
|
||||||
|
For instructions dealing with the stack, it is the stack pointer, named rsp */
|
||||||
#define JB_SP 13
|
#define JB_SP 13
|
||||||
|
|
||||||
|
/* FP registers */
|
||||||
#define JB_D8 14
|
#define JB_D8 14
|
||||||
#define JB_D9 15
|
#define JB_D9 15
|
||||||
#define JB_D10 16
|
#define JB_D10 16
|
||||||
|
|
45
trunk/3rdparty/st-srs/osguess.sh
vendored
Normal file
45
trunk/3rdparty/st-srs/osguess.sh
vendored
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#
|
||||||
|
# This script can be used to automatically guess target OS.
|
||||||
|
# It requires the config.guess utility which is a part of GNU Autoconf.
|
||||||
|
# GNU Autoconf can be downloaded from ftp://ftp.gnu.org/gnu/autoconf/
|
||||||
|
#
|
||||||
|
# Use "default" as a make target for automatic builds.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
# Specify path to the config.guess utility (unless set via environment)
|
||||||
|
#CONFIG_GUESS_PATH=
|
||||||
|
|
||||||
|
|
||||||
|
if [ x"$CONFIG_GUESS_PATH" = x ]; then
|
||||||
|
echo "Error: CONFIG_GUESS_PATH variable is not set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$CONFIG_GUESS_PATH/config.guess" ]; then
|
||||||
|
echo "Can't find $CONFIG_GUESS_PATH/config.guess utility. Wrong path?"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sys_info=`/bin/sh $CONFIG_GUESS_PATH/config.guess`
|
||||||
|
|
||||||
|
echo "Building for $sys_info"
|
||||||
|
|
||||||
|
case "$sys_info" in
|
||||||
|
*-ibm-aix4* ) OS=AIX ;;
|
||||||
|
*-freebsd* ) OS=FREEBSD ;;
|
||||||
|
hppa*-hp-hpux11*) OS=HPUX ;;
|
||||||
|
*-sgi-irix6* ) OS=IRIX ;;
|
||||||
|
*-linux* ) OS=LINUX ;;
|
||||||
|
*-netbsd* ) OS=NETBSD ;;
|
||||||
|
*-openbsd* ) OS=OPENBSD ;;
|
||||||
|
*-dec-osf* ) OS=OSF1 ;;
|
||||||
|
*-solaris2* ) OS=SOLARIS ;;
|
||||||
|
*-darwin* ) OS=DARWIN ;;
|
||||||
|
* ) OS=
|
||||||
|
echo "Sorry, unsupported OS"
|
||||||
|
exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "Making with OS=$OS"
|
||||||
|
|
1
trunk/3rdparty/st-srs/srs
vendored
Symbolic link
1
trunk/3rdparty/st-srs/srs
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
/Users/video/git/srs
|
79
trunk/3rdparty/st-srs/st.spec
vendored
Normal file
79
trunk/3rdparty/st-srs/st.spec
vendored
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
Summary: State Threads Library
|
||||||
|
Name: st
|
||||||
|
Version: 1.9
|
||||||
|
Release: 1
|
||||||
|
Copyright: MPL 1.2 or GPL 2+
|
||||||
|
Packager: Wesley W. Terpstra <wesley@terpstra.ca>
|
||||||
|
Source: http://prdownloads.sourceforge.net/state-threads/st-%{version}.tar.gz
|
||||||
|
Prefix: /usr
|
||||||
|
BuildRoot: /tmp/%{name}-%{version}-build
|
||||||
|
Group: Development/Libraries
|
||||||
|
|
||||||
|
%description
|
||||||
|
The State Threads library has an interface similar to POSIX threads.
|
||||||
|
|
||||||
|
However, the threads are actually all run in-process. This type of
|
||||||
|
threading allows for controlled schedualing points. It is highly useful
|
||||||
|
for designing robust and extremely scalable internet applications since
|
||||||
|
there is no resource contention and locking is generally unnecessary.
|
||||||
|
|
||||||
|
It can be combined with traditional threading or multiple process
|
||||||
|
parallelism to take advantage of multiple processors.
|
||||||
|
|
||||||
|
See: <http://state-threads.sourceforge.net/docs/st.html> for further
|
||||||
|
information about how state threads improve performance.
|
||||||
|
|
||||||
|
%package -n libst-devel
|
||||||
|
Summary: State Threads Library - Development Files
|
||||||
|
Group: Development/Libraries
|
||||||
|
Requires: libst1
|
||||||
|
|
||||||
|
%description -n libst-devel
|
||||||
|
Development headers and documentation for libst
|
||||||
|
|
||||||
|
%package -n libst1
|
||||||
|
Summary: State Threads Library - Shared Libs Major 1
|
||||||
|
Group: System/Libraries
|
||||||
|
|
||||||
|
%description -n libst1
|
||||||
|
Shared libraries for running applications linked against api version 1.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -q
|
||||||
|
|
||||||
|
%build
|
||||||
|
make CONFIG_GUESS_PATH=/usr/share/automake default-optimized
|
||||||
|
|
||||||
|
%install
|
||||||
|
if [ -d ${RPM_BUILD_ROOT} ]; then rm -rf ${RPM_BUILD_ROOT}; fi
|
||||||
|
|
||||||
|
mkdir -m 0755 -p ${RPM_BUILD_ROOT}/%{prefix}/lib/pkgconfig
|
||||||
|
mkdir -m 0755 -p ${RPM_BUILD_ROOT}/%{prefix}/include
|
||||||
|
mkdir -m 0755 -p ${RPM_BUILD_ROOT}/%{prefix}/share/doc/libst-devel
|
||||||
|
cp -a obj/libst.* ${RPM_BUILD_ROOT}/%{prefix}/lib
|
||||||
|
cp -a obj/st.h ${RPM_BUILD_ROOT}/%{prefix}/include
|
||||||
|
sed "s*@prefix@*%{prefix}*g" <st.pc >${RPM_BUILD_ROOT}/%{prefix}/lib/pkgconfig/st.pc
|
||||||
|
cp -a docs/* ${RPM_BUILD_ROOT}/%{prefix}/share/doc/libst-devel/
|
||||||
|
cp -a examples ${RPM_BUILD_ROOT}/%{prefix}/share/doc/libst-devel/
|
||||||
|
|
||||||
|
%post -n libst1
|
||||||
|
/sbin/ldconfig %{prefix}/lib
|
||||||
|
|
||||||
|
%files -n libst1
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{prefix}/lib/lib*.so.*
|
||||||
|
|
||||||
|
%files -n libst-devel
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{prefix}/include/*
|
||||||
|
%{prefix}/lib/lib*.a
|
||||||
|
%{prefix}/lib/lib*.so
|
||||||
|
%{prefix}/lib/pkgconfig/st.pc
|
||||||
|
%{prefix}/share/doc/libst-devel/*
|
||||||
|
|
||||||
|
%clean
|
||||||
|
if [ -d ${RPM_BUILD_ROOT} ]; then rm -rf ${RPM_BUILD_ROOT}; fi
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Wed Dec 26 2001 Wesley W. Terpstra <wesley@terpstra.ca>
|
||||||
|
- first rpms for libst-1.3.tar.gz
|
17
trunk/3rdparty/st-srs/tools/helloworld/Makefile
vendored
17
trunk/3rdparty/st-srs/tools/helloworld/Makefile
vendored
|
@ -3,9 +3,22 @@
|
||||||
LDLIBS=../../obj/libst.a
|
LDLIBS=../../obj/libst.a
|
||||||
CFLAGS=-g -O0 -I../../obj
|
CFLAGS=-g -O0 -I../../obj
|
||||||
|
|
||||||
./helloworld: helloworld.c $(LDLIBS)
|
OS_NAME = $(shell uname -s)
|
||||||
|
ST_TARGET = linux-debug
|
||||||
|
ifeq ($(OS_NAME), Darwin)
|
||||||
|
ST_TARGET = darwin-debug
|
||||||
|
CPU_ARCHS = $(shell g++ -dM -E - </dev/null |grep -q '__x86_64' && echo x86_64)
|
||||||
|
CPU_ARCHS += $(shell g++ -dM -E - </dev/null |grep -q '__aarch64' && echo arm64)
|
||||||
|
CFLAGS += -arch $(CPU_ARCHS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
./helloworld: helloworld.c $(LDLIBS)
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Wall -o helloworld helloworld.c $(LDLIBS)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Wall -o helloworld helloworld.c $(LDLIBS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f helloworld
|
cd ../.. && make clean
|
||||||
|
rm -rf helloworld helloworld.dSYM
|
||||||
|
|
||||||
|
$(LDLIBS):
|
||||||
|
cd ../.. && make $(ST_TARGET)
|
||||||
|
|
||||||
|
|
3
trunk/3rdparty/st-srs/tools/jmpbuf/.gitignore
vendored
Normal file
3
trunk/3rdparty/st-srs/tools/jmpbuf/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
jmpbuf
|
||||||
|
jmpbuf.E.c
|
||||||
|
|
24
trunk/3rdparty/st-srs/tools/jmpbuf/Makefile
vendored
Normal file
24
trunk/3rdparty/st-srs/tools/jmpbuf/Makefile
vendored
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
.PHONY: default clean
|
||||||
|
|
||||||
|
CFLAGS=-g -O0
|
||||||
|
|
||||||
|
OS_NAME = $(shell uname -s)
|
||||||
|
ST_TARGET = linux-debug
|
||||||
|
ifeq ($(OS_NAME), Darwin)
|
||||||
|
ST_TARGET = darwin-debug
|
||||||
|
CPU_ARCHS = $(shell g++ -dM -E - </dev/null |grep -q '__x86_64' && echo x86_64)
|
||||||
|
CPU_ARCHS += $(shell g++ -dM -E - </dev/null |grep -q '__aarch64' && echo arm64)
|
||||||
|
CFLAGS += -arch $(CPU_ARCHS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
default: ./jmpbuf ./jmpbuf.E.c
|
||||||
|
|
||||||
|
./jmpbuf: jmpbuf.c
|
||||||
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Wall -o $@ $^ $(LDLIBS)
|
||||||
|
|
||||||
|
./jmpbuf.E.c: jmpbuf.c
|
||||||
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Wall -E -o jmpbuf.E.c $^ $(LDLIBS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf jmpbuf jmpbuf.E.c jmpbuf.dSYM
|
||||||
|
|
16
trunk/3rdparty/st-srs/tools/jmpbuf/jmpbuf.c
vendored
Normal file
16
trunk/3rdparty/st-srs/tools/jmpbuf/jmpbuf.c
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
/* Copyright (c) 2022 Winlin */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
jmp_buf ctx = {0};
|
||||||
|
int r0 = setjmp(ctx);
|
||||||
|
|
||||||
|
int nn_jb = sizeof(ctx);
|
||||||
|
printf("r0=%d, sizeof(jmp_buf)=%d (unsigned long long [%d])\n", r0, nn_jb, nn_jb/8);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
2
trunk/3rdparty/st-srs/tools/pcs/.gitignore
vendored
Normal file
2
trunk/3rdparty/st-srs/tools/pcs/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
pcs
|
||||||
|
|
19
trunk/3rdparty/st-srs/tools/pcs/Makefile
vendored
Normal file
19
trunk/3rdparty/st-srs/tools/pcs/Makefile
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
.PHONY: clean
|
||||||
|
|
||||||
|
CFLAGS=-g -O0
|
||||||
|
|
||||||
|
OS_NAME = $(shell uname -s)
|
||||||
|
ST_TARGET = linux-debug
|
||||||
|
ifeq ($(OS_NAME), Darwin)
|
||||||
|
ST_TARGET = darwin-debug
|
||||||
|
CPU_ARCHS = $(shell g++ -dM -E - </dev/null |grep -q '__x86_64' && echo x86_64)
|
||||||
|
CPU_ARCHS += $(shell g++ -dM -E - </dev/null |grep -q '__aarch64' && echo arm64)
|
||||||
|
CFLAGS += -arch $(CPU_ARCHS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
./pcs: pcs.c
|
||||||
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Wall -o $@ $^ $(LDLIBS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf pcs pcs.dSYM
|
||||||
|
|
35
trunk/3rdparty/st-srs/tools/pcs/pcs.c
vendored
Normal file
35
trunk/3rdparty/st-srs/tools/pcs/pcs.c
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
/* Copyright (c) 2022 Winlin */
|
||||||
|
|
||||||
|
void foo() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void foo2(char a) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void foo3(int a) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void foo4(long a) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void foo5(long long a) {
|
||||||
|
}
|
||||||
|
|
||||||
|
long foo6(long a) {
|
||||||
|
return a + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note: Use b *main to set to the first instruction of main,
|
||||||
|
// see https://stackoverflow.com/questions/40960758/break-main-vs-break-main-in-gdb
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
foo();
|
||||||
|
foo2('s');
|
||||||
|
foo3(0x7);
|
||||||
|
foo4(0x7);
|
||||||
|
foo5(0x7);
|
||||||
|
foo6(0x7);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
11
trunk/3rdparty/st-srs/tools/porting/Makefile
vendored
11
trunk/3rdparty/st-srs/tools/porting/Makefile
vendored
|
@ -2,9 +2,18 @@
|
||||||
|
|
||||||
CFLAGS=-g -O0
|
CFLAGS=-g -O0
|
||||||
|
|
||||||
|
OS_NAME = $(shell uname -s)
|
||||||
|
ST_TARGET = linux-debug
|
||||||
|
ifeq ($(OS_NAME), Darwin)
|
||||||
|
ST_TARGET = darwin-debug
|
||||||
|
CPU_ARCHS = $(shell g++ -dM -E - </dev/null |grep -q '__x86_64' && echo x86_64)
|
||||||
|
CPU_ARCHS += $(shell g++ -dM -E - </dev/null |grep -q '__aarch64' && echo arm64)
|
||||||
|
CFLAGS += -arch $(CPU_ARCHS)
|
||||||
|
endif
|
||||||
|
|
||||||
./porting: porting.c
|
./porting: porting.c
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Wall -o $@ $^ $(LDLIBS)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Wall -o $@ $^ $(LDLIBS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f porting
|
rm -rf porting porting.dSYM
|
||||||
|
|
||||||
|
|
2
trunk/3rdparty/st-srs/tools/stack/.gitignore
vendored
Normal file
2
trunk/3rdparty/st-srs/tools/stack/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
stack
|
||||||
|
|
19
trunk/3rdparty/st-srs/tools/stack/Makefile
vendored
Normal file
19
trunk/3rdparty/st-srs/tools/stack/Makefile
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
.PHONY: clean
|
||||||
|
|
||||||
|
CFLAGS=-g -O0
|
||||||
|
|
||||||
|
OS_NAME = $(shell uname -s)
|
||||||
|
ST_TARGET = linux-debug
|
||||||
|
ifeq ($(OS_NAME), Darwin)
|
||||||
|
ST_TARGET = darwin-debug
|
||||||
|
CPU_ARCHS = $(shell g++ -dM -E - </dev/null |grep -q '__x86_64' && echo x86_64)
|
||||||
|
CPU_ARCHS += $(shell g++ -dM -E - </dev/null |grep -q '__aarch64' && echo arm64)
|
||||||
|
CFLAGS += -arch $(CPU_ARCHS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
./stack: stack.c
|
||||||
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Wall -o $@ $^ $(LDLIBS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf stack stack.dSYM
|
||||||
|
|
17
trunk/3rdparty/st-srs/tools/stack/stack.c
vendored
Normal file
17
trunk/3rdparty/st-srs/tools/stack/stack.c
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/* SPDX-License-Identifier: MIT */
|
||||||
|
/* Copyright (c) 2022 Winlin */
|
||||||
|
|
||||||
|
long foo() {
|
||||||
|
char c;
|
||||||
|
int i;
|
||||||
|
long l;
|
||||||
|
long long ll;
|
||||||
|
return c + i + l + ll;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
foo();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
15
trunk/3rdparty/st-srs/tools/verify/Makefile
vendored
15
trunk/3rdparty/st-srs/tools/verify/Makefile
vendored
|
@ -3,9 +3,22 @@
|
||||||
LDLIBS=../../obj/libst.a
|
LDLIBS=../../obj/libst.a
|
||||||
CFLAGS=-g -O0
|
CFLAGS=-g -O0
|
||||||
|
|
||||||
|
OS_NAME = $(shell uname -s)
|
||||||
|
ST_TARGET = linux-debug
|
||||||
|
ifeq ($(OS_NAME), Darwin)
|
||||||
|
ST_TARGET = darwin-debug
|
||||||
|
CPU_ARCHS = $(shell g++ -dM -E - </dev/null |grep -q '__x86_64' && echo x86_64)
|
||||||
|
CPU_ARCHS += $(shell g++ -dM -E - </dev/null |grep -q '__aarch64' && echo arm64)
|
||||||
|
CFLAGS += -arch $(CPU_ARCHS)
|
||||||
|
endif
|
||||||
|
|
||||||
./verify: verify.c $(LDLIBS)
|
./verify: verify.c $(LDLIBS)
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Wall -o verify verify.c $(LDLIBS)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Wall -o verify verify.c $(LDLIBS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f verify
|
cd ../.. && make clean
|
||||||
|
rm -rf verify verify.dSYM
|
||||||
|
|
||||||
|
$(LDLIBS):
|
||||||
|
cd ../.. && make $(ST_TARGET)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue