Skip to content

Commit

Permalink
ST: Simplify it, only Linux/Darwin, epoll/kqueue, single process
Browse files Browse the repository at this point in the history
commit f4872e5
Author: winlin <[email protected]>
Date:   Fri Feb 26 09:13:21 2021 +0800

    ST: For #2188: Remove sendmmsg from ST.

commit aaeb891
Author: winlin <[email protected]>
Date:   Thu Mar 11 08:09:54 2021 +0800

    ST: Refine utest script.

commit d1ac9da
Author: winlin <[email protected]>
Date:   Wed Mar 3 11:02:25 2021 +0800

    ST: Support fast utest and coverage

commit 8400115
Author: winlin <[email protected]>
Date:   Fri Feb 26 07:02:19 2021 +0800

    ST: Always use unserialized accept for linux or darwin

commit c3686f2
Author: winlin <[email protected]>
Date:   Fri Feb 26 06:54:05 2021 +0800

    ST: Refine ARFLAGS by disable the verbose log

commit aaa5c4f
Author: winlin <[email protected]>
Date:   Thu Feb 25 08:58:46 2021 +0800

    ST: Stack always grows from top to down.

commit dddd466
Author: winlin <[email protected]>
Date:   Thu Feb 25 08:51:31 2021 +0800

    ST: Ignore process fork, for single process only

commit 7906cb5
Author: winlin <[email protected]>
Date:   Thu Feb 25 08:50:59 2021 +0800

    ST: Fix build warnings

commit d94921b
Author: winlin <[email protected]>
Date:   Thu Feb 25 07:27:45 2021 +0800

    ST: Remove select and poll support, only epoll and kqueue

commit 76d2025
Author: winlin <[email protected]>
Date:   Thu Feb 25 07:10:47 2021 +0800

    ST: Remove multiple OS support, except Linux and Darwin.

commit 13c4ba3
Author: winlin <[email protected]>
Date:   Thu Feb 25 06:59:35 2021 +0800

    ST: Remove __ia64__ CPU support

commit 46c06e4
Author: winlin <[email protected]>
Date:   Wed Feb 24 11:37:27 2021 +0800

    ST: Remove unused files for ST
  • Loading branch information
winlinvip committed May 1, 2021
1 parent 74bb47c commit 241c00f
Show file tree
Hide file tree
Showing 35 changed files with 114 additions and 6,175 deletions.
234 changes: 9 additions & 225 deletions trunk/3rdparty/st-srs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,8 @@ VERSION = 1.9
##########################
# Supported OSes:
#
#OS = AIX
#OS = CYGWIN
#OS = DARWIN
#OS = FREEBSD
#OS = HPUX
#OS = HPUX_64
#OS = IRIX
#OS = IRIX_64
#OS = LINUX
#OS = NETBSD
#OS = OPENBSD
#OS = OSF1
#OS = SOLARIS
#OS = SOLARIS_64

# Please see the "Other possible defines" section below for
# possible compilation options.
Expand All @@ -62,6 +50,7 @@ AR = ar
LD = ld
RANLIB = ranlib
LN = ln
STATIC_ONLY = yes

SHELL = /bin/sh
ECHO = /bin/echo
Expand All @@ -72,7 +61,7 @@ TARGETDIR = $(OS)_$(shell uname -r)_$(BUILD)
DEFINES = -D$(OS)
CFLAGS =
SFLAGS =
ARFLAGS = -rv
ARFLAGS = -r
LNFLAGS = -s
DSO_SUFFIX = so

Expand All @@ -83,20 +72,8 @@ DESC = st.pc
# Platform section.
# Possible targets:

TARGETS = aix-debug aix-optimized \
cygwin-debug cygwin-optimized \
darwin-debug darwin-optimized \
freebsd-debug freebsd-optimized \
hpux-debug hpux-optimized \
hpux-64-debug hpux-64-optimized \
irix-n32-debug irix-n32-optimized \
irix-64-debug irix-64-optimized \
linux-debug linux-optimized \
netbsd-debug netbsd-optimized \
openbsd-debug openbsd-optimized \
osf1-debug osf1-optimized \
solaris-debug solaris-optimized \
solaris-64-debug solaris-64-optimized
TARGETS = darwin-debug darwin-optimized \
linux-debug linux-optimized

UTEST_TARGETS = darwin-debug-utest linux-debug-utest \
darwin-debug-gcov linux-debug-gcov
Expand All @@ -105,138 +82,35 @@ UTEST_TARGETS = darwin-debug-utest linux-debug-utest \
# Platform specifics
#

ifeq ($(OS), AIX)
AIX_VERSION = $(shell uname -v).$(shell uname -r)
TARGETDIR = $(OS)_$(AIX_VERSION)_$(BUILD)
CC = xlC
STATIC_ONLY = yes
ifeq ($(BUILD), OPT)
OTHER_FLAGS = -w
endif
ifneq ($(filter-out 4.1 4.2, $(AIX_VERSION)),)
DEFINES += -DMD_HAVE_SOCKLEN_T
endif
endif

ifeq ($(OS), CYGWIN)
TARGETDIR = $(OS)_$(BUILD)
CC = gcc
LD = gcc
DSO_SUFFIX = dll
SLIBRARY = $(TARGETDIR)/libst.dll.a
DLIBRARY = $(TARGETDIR)/libst.dll
DEF_FILE = $(TARGETDIR)/libst.def
LDFLAGS = libst.def -shared --enable-auto-image-base -Wl,--output-def,$(DEF_FILE),--out-implib,$(SLIBRARY)
OTHER_FLAGS = -Wall
endif

ifeq ($(OS), DARWIN)
EXTRA_OBJS = $(TARGETDIR)/md_darwin.o
LD = cc
SFLAGS = -fPIC -fno-common
DSO_SUFFIX = dylib
RELEASE = $(shell uname -r | cut -d. -f1)
PPC = $(shell test $(RELEASE) -le 9 && echo yes)
INTEL = $(shell test $(RELEASE) -ge 9 && echo yes)
ifeq ($(PPC), yes)
CFLAGS += -arch ppc
LDFLAGS += -arch ppc
endif
ifeq ($(INTEL), yes)
CFLAGS += -arch x86_64
LDFLAGS += -arch x86_64
endif
LDFLAGS += -dynamiclib -install_name /sw/lib/libst.$(MAJOR).$(DSO_SUFFIX) -compatibility_version $(MAJOR) -current_version $(VERSION)
OTHER_FLAGS = -Wall
endif

ifeq ($(OS), FREEBSD)
SFLAGS = -fPIC
LDFLAGS = -shared -soname=$(SONAME) -lc
OTHER_FLAGS = -Wall
ifeq ($(shell test -f /usr/include/sys/event.h && echo yes), yes)
DEFINES += -DMD_HAVE_KQUEUE
endif
endif

ifeq (HPUX, $(findstring HPUX, $(OS)))
ifeq ($(OS), HPUX_64)
DEFINES = -DHPUX
CFLAGS = -Ae +DD64 +Z
else
CFLAGS = -Ae +DAportable +Z
endif
RANLIB = true
LDFLAGS = -b
DSO_SUFFIX = sl
endif

ifeq (IRIX, $(findstring IRIX, $(OS)))
ifeq ($(OS), IRIX_64)
DEFINES = -DIRIX
ABIFLAG = -64
else
ABIFLAG = -n32
endif
RANLIB = true
CFLAGS = $(ABIFLAG) -mips3
LDFLAGS = $(ABIFLAG) -shared
OTHER_FLAGS = -fullwarn
endif

ifeq ($(OS), LINUX)
EXTRA_OBJS = $(TARGETDIR)/md.o
EXTRA_OBJS = $(TARGETDIR)/md_linux.o
SFLAGS = -fPIC
LDFLAGS = -shared -soname=$(SONAME) -lc
OTHER_FLAGS = -Wall
ifeq ($(shell test -f /usr/include/sys/epoll.h && echo yes), yes)
DEFINES += -DMD_HAVE_EPOLL
endif
endif

ifeq ($(OS), NETBSD)
SFLAGS = -fPIC
LDFLAGS = -shared -soname=$(SONAME) -lc
OTHER_FLAGS = -Wall
endif

ifeq ($(OS), OPENBSD)
SFLAGS = -fPIC
LDFLAGS = -shared -soname=$(SONAME) -lc
OTHER_FLAGS = -Wall
ifeq ($(shell test -f /usr/include/sys/event.h && echo yes), yes)
DEFINES += -DMD_HAVE_KQUEUE
endif
endif

ifeq ($(OS), OSF1)
RANLIB = true
LDFLAGS = -shared -all -expect_unresolved "*"
endif

ifeq (SOLARIS, $(findstring SOLARIS, $(OS)))
TARGETDIR = $(OS)_$(shell uname -r | sed 's/^5/2/')_$(BUILD)
CC = gcc
LD = gcc
RANLIB = true
LDFLAGS = -G
OTHER_FLAGS = -Wall
ifeq ($(OS), SOLARIS_64)
DEFINES = -DSOLARIS
CFLAGS += -m64
LDFLAGS += -m64
endif
endif

#
# End of platform section.
##########################


ifeq ($(BUILD), OPT)
OTHER_FLAGS += -O
OTHER_FLAGS += -O2
else
OTHER_FLAGS += -g
OTHER_FLAGS += -g -O0
DEFINES += -DDEBUG
endif

Expand Down Expand Up @@ -285,10 +159,6 @@ endif
#
# make EXTRA_CFLAGS=-UMD_HAVE_EPOLL <target>
#
# or to enable sendmmsg(2) support:
#
# make EXTRA_CFLAGS="-DMD_HAVE_SENDMMSG -D_GNU_SOURCE"
#
# or to enable stats for ST:
#
# make EXTRA_CFLAGS=-DDEBUG_STATS
Expand All @@ -311,28 +181,11 @@ OBJS += $(EXTRA_OBJS)
HEADER = $(TARGETDIR)/st.h
SLIBRARY = $(TARGETDIR)/libst.a
DLIBRARY = $(TARGETDIR)/libst.$(DSO_SUFFIX).$(VERSION)
EXAMPLES = examples

LINKNAME = libst.$(DSO_SUFFIX)
SONAME = libst.$(DSO_SUFFIX).$(MAJOR)
FULLNAME = libst.$(DSO_SUFFIX).$(VERSION)

ifeq ($(OS), CYGWIN)
SONAME = cygst.$(DSO_SUFFIX)
SLIBRARY = $(TARGETDIR)/libst.dll.a
DLIBRARY = $(TARGETDIR)/$(SONAME)
LINKNAME =
# examples directory does not compile under cygwin
EXAMPLES =
endif

# for SRS
# disable examples for ubuntu crossbuild failed.
# @see https://github.com/winlinvip/simple-rtmp-server/issues/308
ifeq ($(OS), LINUX)
EXAMPLES =
endif

ifeq ($(OS), DARWIN)
LINKNAME = libst.$(DSO_SUFFIX)
SONAME = libst.$(MAJOR).$(DSO_SUFFIX)
Expand All @@ -348,7 +201,7 @@ endif
ifeq ($(OS),)
ST_ALL = unknown
else
ST_ALL = $(TARGETDIR) $(LIBRARIES) $(HEADER) $(EXAMPLES) $(DESC)
ST_ALL = $(TARGETDIR) $(LIBRARIES) $(HEADER) $(DESC)
endif

all: $(ST_ALL)
Expand Down Expand Up @@ -386,7 +239,7 @@ $(HEADER): public.h
rm -f $@
cp public.h $@

$(TARGETDIR)/md.o: md.S
$(TARGETDIR)/md_linux.o: md_linux.S
$(CC) $(CFLAGS) -c $< -o $@

$(TARGETDIR)/md_darwin.o: md_darwin.S
Expand All @@ -395,10 +248,6 @@ $(TARGETDIR)/md_darwin.o: md_darwin.S
$(TARGETDIR)/%.o: %.c common.h md.h
$(CC) $(CFLAGS) -c $< -o $@

examples: $(SLIBRARY)
@echo Making $@
@cd $@; $(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)" OS="$(OS)" TARGETDIR="$(TARGETDIR)"

clean:
rm -rf *_OPT *_DBG obj st.pc

Expand All @@ -418,80 +267,15 @@ endif
##########################
# Target rules:

default-debug:
. ./osguess.sh; $(MAKE) OS="$$OS" BUILD="DBG"
default default-optimized:
. ./osguess.sh; $(MAKE) OS="$$OS" BUILD="OPT"

aix-debug:
$(MAKE) OS="AIX" BUILD="DBG"
aix-optimized:
$(MAKE) OS="AIX" BUILD="OPT"

cygwin-debug:
$(MAKE) OS="CYGWIN" BUILD="DBG"
cygwin-optimized:
$(MAKE) OS="CYGWIN" BUILD="OPT"

darwin-debug:
$(MAKE) OS="DARWIN" BUILD="DBG"
darwin-optimized:
$(MAKE) OS="DARWIN" BUILD="OPT"

freebsd-debug:
$(MAKE) OS="FREEBSD" BUILD="DBG"
freebsd-optimized:
$(MAKE) OS="FREEBSD" BUILD="OPT"

hpux-debug:
$(MAKE) OS="HPUX" BUILD="DBG"
hpux-optimized:
$(MAKE) OS="HPUX" BUILD="OPT"
hpux-64-debug:
$(MAKE) OS="HPUX_64" BUILD="DBG"
hpux-64-optimized:
$(MAKE) OS="HPUX_64" BUILD="OPT"

irix-n32-debug:
$(MAKE) OS="IRIX" BUILD="DBG"
irix-n32-optimized:
$(MAKE) OS="IRIX" BUILD="OPT"
irix-64-debug:
$(MAKE) OS="IRIX_64" BUILD="DBG"
irix-64-optimized:
$(MAKE) OS="IRIX_64" BUILD="OPT"

linux-debug:
$(MAKE) OS="LINUX" BUILD="DBG"
linux-optimized:
$(MAKE) OS="LINUX" BUILD="OPT"
# compatibility
linux-ia64-debug: linux-debug
linux-ia64-optimized: linux-optimized

netbsd-debug:
$(MAKE) OS="NETBSD" BUILD="DBG"
netbsd-optimized:
$(MAKE) OS="NETBSD" BUILD="OPT"

openbsd-debug:
$(MAKE) OS="OPENBSD" BUILD="DBG"
openbsd-optimized:
$(MAKE) OS="OPENBSD" BUILD="OPT"

osf1-debug:
$(MAKE) OS="OSF1" BUILD="DBG"
osf1-optimized:
$(MAKE) OS="OSF1" BUILD="OPT"

solaris-debug:
$(MAKE) OS="SOLARIS" BUILD="DBG"
solaris-optimized:
$(MAKE) OS="SOLARIS" BUILD="OPT"
solaris-64-debug:
$(MAKE) OS="SOLARIS_64" BUILD="DBG"
solaris-64-optimized:
$(MAKE) OS="SOLARIS_64" BUILD="OPT"

darwin-debug-utest:
@echo "Build utest for state-threads"
Expand Down
3 changes: 2 additions & 1 deletion trunk/3rdparty/st-srs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ The branch [srs](https://github.com/ossrs/state-threads/tree/srs) will be patche
- [x] Support macro `MD_ST_NO_ASM` to disable ASM, [#8](https://github.com/ossrs/state-threads/issues/8).
- [x] Merge patch [srs#1282](https://github.com/ossrs/srs/issues/1282#issuecomment-445539513) to support aarch64, [#9](https://github.com/ossrs/state-threads/issues/9).
- [x] Support OSX for Apple Darwin, macOS, [#11](https://github.com/ossrs/state-threads/issues/11).
- [x] Support sendmmsg for UDP, [#12](https://github.com/ossrs/state-threads/issues/12).
- [ ] Support sendmmsg for UDP, [#12](https://github.com/ossrs/state-threads/issues/12).
- [x] Refine performance for sleep or epoll_wait(0), [#17](https://github.com/ossrs/state-threads/issues/17).
- [ ] Improve the performance of timer. [9fe8cfe5b](https://github.com/ossrs/state-threads/commit/9fe8cfe5b1c9741a2e671a46215184f267fba400), [7879c2b](https://github.com/ossrs/state-threads/commit/7879c2b), [387cddb](https://github.com/ossrs/state-threads/commit/387cddb)
- [x] Support utest by gtest and coverage by gcov/gocvr.
- [ ] 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).

## GDB Tools

Expand Down
30 changes: 30 additions & 0 deletions trunk/3rdparty/st-srs/auto/fast.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

PWD=$(cd `dirname $0`/.. && pwd)

pushd $PWD
echo "Run UTest in $(pwd)"

IS_LINUX=yes
uname -s|grep Darwin >/dev/null && IS_DARWIN=yes && IS_LINUX=no
echo "IS_LINUX: $IS_LINUX, IS_DARWIN: $IS_DARWIN"

echo "Clean gcda files"
rm -f ./obj/*.gcda

echo "Build and run utest"
if [[ $IS_DARWIN == yes ]]; then
make darwin-debug-gcov && ./obj/st_utest
else
make linux-debug-gcov && ./obj/st_utest
fi
ret=$?; if [[ 0 -ne $ret ]]; then echo "Make ST utest fail, ret=$ret"; exit $ret; fi

echo "Generating coverage"
mkdir -p coverage &&
gcovr -r . -e LINUX -e DARWIN -e examples --html --html-details -o coverage/st.html &&
echo "Coverage report at coverage/st.html" &&
open coverage/st.html

popd
echo "UTest done, restore $(pwd)"
Loading

0 comments on commit 241c00f

Please sign in to comment.