mirror of
				https://github.com/ossrs/srs.git
				synced 2025-03-09 15:49:59 +00:00 
			
		
		
		
	merge from srs2 to check cpus.
This commit is contained in:
		
						commit
						4e88262512
					
				
					 7 changed files with 63 additions and 48 deletions
				
			
		|  | @ -43,29 +43,6 @@ echo "" >> $SRS_AUTO_HEADERS_H | |||
| ##################################################################################### | ||||
| # generate auto headers file, depends on the finished of options.sh | ||||
| ##################################################################################### | ||||
| if [ $SRS_ARM_UBUNTU12 = YES ]; then | ||||
|     __SrsArmCC="arm-linux-gnueabi-gcc"; | ||||
|     __SrsArmGCC="arm-linux-gnueabi-gcc"; | ||||
|     __SrsArmCXX="arm-linux-gnueabi-g++"; | ||||
|     __SrsArmAR="arm-linux-gnueabi-ar"; | ||||
|     __SrsArmLD="arm-linux-gnueabi-ld"; | ||||
|     __SrsArmRANDLIB="arm-linux-gnueabi-ranlib"; | ||||
| fi | ||||
| if [ $SRS_MIPS_UBUNTU12 = YES ]; then | ||||
|     __SrsArmCC="mipsel-openwrt-linux-gcc"; | ||||
|     __SrsArmGCC="mipsel-openwrt-linux-gcc"; | ||||
|     __SrsArmCXX="mipsel-openwrt-linux-g++"; | ||||
|     __SrsArmAR="mipsel-openwrt-linux-ar"; | ||||
|     __SrsArmLD="mipsel-openwrt-linux-ld"; | ||||
|     __SrsArmRANDLIB="mipsel-openwrt-linux-ranlib"; | ||||
| fi | ||||
| # the arm-ubuntu12 options for make for depends | ||||
| if [[ -z $SrsArmCC ]]; then SrsArmCC=$__SrsArmCC; fi | ||||
| if [[ -z $SrsArmGCC ]]; then SrsArmGCC=$__SrsArmGCC; fi | ||||
| if [[ -z $SrsArmCXX ]]; then SrsArmCXX=$__SrsArmCXX; fi | ||||
| if [[ -z $SrsArmAR ]]; then SrsArmAR=$__SrsArmAR; fi | ||||
| if [[ -z $SrsArmLD ]]; then SrsArmLD=$__SrsArmLD; fi | ||||
| if [[ -z $SrsArmRANDLIB ]]; then SrsArmRANDLIB=$__SrsArmRANDLIB; fi | ||||
| # write to source file | ||||
| if [ $SRS_CROSS_BUILD = YES ]; then | ||||
|     echo "cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB" | ||||
|  |  | |||
|  | @ -38,7 +38,11 @@ function Ubuntu_prepare() | |||
|     else | ||||
|         uname -v|grep Ubuntu >/dev/null 2>&1 | ||||
|         ret=$?; if [[ 0 -ne $ret ]]; then | ||||
|             return 0; | ||||
|             # for debian, we think it's ubuntu also. | ||||
|             # for example, the wheezy/sid which is debian armv7 linux, can not identified by uname -v. | ||||
|             if [[ ! -f /etc/debian_version ]]; then | ||||
|                 return 0; | ||||
|             fi | ||||
|         fi | ||||
|     fi | ||||
|      | ||||
|  | @ -378,7 +382,7 @@ fi | |||
| ##################################################################################### | ||||
| if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | ||||
|     # check the cross build flag file, if flag changed, need to rebuild the st. | ||||
|     _ST_MAKE=linux-debug && _ST_EXTRA_CFLAGS="EXTRA_CFLAGS=-DMD_HAVE_EPOLL" | ||||
|     _ST_MAKE=linux-debug && _ST_EXTRA_CFLAGS="-DMD_HAVE_EPOLL" | ||||
|     # for osx, use darwin for st, donot use epoll. | ||||
|     if [ $OS_IS_OSX = YES ]; then | ||||
|         _ST_MAKE=darwin-debug && _ST_EXTRA_CFLAGS="EXTRA_CFLAGS=-DMD_HAVE_KQUEUE" | ||||
|  | @ -399,7 +403,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | |||
|                 patch -p0 < ../../3rdparty/patches/1.st.arm.patch && | ||||
|                 patch -p0 < ../../3rdparty/patches/3.st.osx.kqueue.patch && | ||||
|                 patch -p0 < ../../3rdparty/patches/4.st.disable.examples.patch && | ||||
|                 make ${_ST_MAKE} CC=${SrsArmCC} AR=${SrsArmAR} LD=${SrsArmLD} RANDLIB=${SrsArmRANDLIB} ${_ST_EXTRA_CFLAGS} && | ||||
|                 make ${_ST_MAKE} CC=${SrsArmCC} AR=${SrsArmAR} LD=${SrsArmLD} RANDLIB=${SrsArmRANDLIB} EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" && | ||||
|                 cd .. && rm -rf st && ln -sf st-1.9/obj st && | ||||
|                 cd .. && touch ${SRS_OBJS}/_flag.st.cross.build.tmp | ||||
|             ) | ||||
|  | @ -416,7 +420,7 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then | |||
|                 patch -p0 < ../../3rdparty/patches/1.st.arm.patch && | ||||
|                 patch -p0 < ../../3rdparty/patches/3.st.osx.kqueue.patch && | ||||
|                 patch -p0 < ../../3rdparty/patches/4.st.disable.examples.patch && | ||||
|                 make ${_ST_MAKE} ${_ST_EXTRA_CFLAGS} && | ||||
|                 make ${_ST_MAKE} EXTRA_CFLAGS="${_ST_EXTRA_CFLAGS}" && | ||||
|                 cd .. && rm -rf st && ln -sf st-1.9/obj st && | ||||
|                 cd .. && rm -f ${SRS_OBJS}/_flag.st.cross.build.tmp | ||||
|             ) | ||||
|  |  | |||
							
								
								
									
										30
									
								
								trunk/auto/setup_variables.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								trunk/auto/setup_variables.sh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,30 @@ | |||
| #!/bin/bash | ||||
| 
 | ||||
| # when options parsed, setup some variables, then build the depends. | ||||
| 
 | ||||
| # when arm specified, setup the cross build variables. | ||||
| if [ $SRS_ARM_UBUNTU12 = YES ]; then | ||||
|     __SrsArmCC="arm-linux-gnueabi-gcc"; | ||||
|     __SrsArmGCC="arm-linux-gnueabi-gcc"; | ||||
|     __SrsArmCXX="arm-linux-gnueabi-g++"; | ||||
|     __SrsArmAR="arm-linux-gnueabi-ar"; | ||||
|     __SrsArmLD="arm-linux-gnueabi-ld"; | ||||
|     __SrsArmRANDLIB="arm-linux-gnueabi-ranlib"; | ||||
| fi | ||||
| 
 | ||||
| if [ $SRS_MIPS_UBUNTU12 = YES ]; then | ||||
|     __SrsArmCC="mipsel-openwrt-linux-gcc"; | ||||
|     __SrsArmGCC="mipsel-openwrt-linux-gcc"; | ||||
|     __SrsArmCXX="mipsel-openwrt-linux-g++"; | ||||
|     __SrsArmAR="mipsel-openwrt-linux-ar"; | ||||
|     __SrsArmLD="mipsel-openwrt-linux-ld"; | ||||
|     __SrsArmRANDLIB="mipsel-openwrt-linux-ranlib"; | ||||
| fi | ||||
| 
 | ||||
| # the arm-ubuntu12 options for make for depends | ||||
| if [[ -z $SrsArmCC ]]; then SrsArmCC=$__SrsArmCC; fi | ||||
| if [[ -z $SrsArmGCC ]]; then SrsArmGCC=$__SrsArmGCC; fi | ||||
| if [[ -z $SrsArmCXX ]]; then SrsArmCXX=$__SrsArmCXX; fi | ||||
| if [[ -z $SrsArmAR ]]; then SrsArmAR=$__SrsArmAR; fi | ||||
| if [[ -z $SrsArmLD ]]; then SrsArmLD=$__SrsArmLD; fi | ||||
| if [[ -z $SrsArmRANDLIB ]]; then SrsArmRANDLIB=$__SrsArmRANDLIB; fi | ||||
							
								
								
									
										3
									
								
								trunk/configure
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								trunk/configure
									
										
									
									
										vendored
									
									
								
							|  | @ -23,6 +23,9 @@ BLACK="\\033[0m" | |||
| # parse options, exit with error when parse options invalid. | ||||
| . auto/options.sh | ||||
| 
 | ||||
| # setup variables when options parsed. | ||||
| . auto/setup_variables.sh | ||||
| 
 | ||||
| # clean the exists, when not export srs-librtmp. | ||||
| # do this only when the options is ok. | ||||
| if [[ -f Makefile ]]; then | ||||
|  |  | |||
|  | @ -103,6 +103,7 @@ | |||
| 		3C689FA01AB6AAC800C9CEEE /* stk.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C689F9C1AB6AAC800C9CEEE /* stk.c */; }; | ||||
| 		3C689FA11AB6AAC800C9CEEE /* sync.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C689F9D1AB6AAC800C9CEEE /* sync.c */; }; | ||||
| 		3C82802C1BAFF8CC004A1794 /* srs_kafka_stack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C82802A1BAFF8CC004A1794 /* srs_kafka_stack.cpp */; }; | ||||
| 		3CB25C2A1BB269FD00C97A63 /* jmp_sp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CB25C291BB269FD00C97A63 /* jmp_sp.cpp */; }; | ||||
| 		3CC52DD81ACE4023006FEB01 /* srs_utest_amf0.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DCA1ACE4023006FEB01 /* srs_utest_amf0.cpp */; }; | ||||
| 		3CC52DD91ACE4023006FEB01 /* srs_utest_config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DCC1ACE4023006FEB01 /* srs_utest_config.cpp */; }; | ||||
| 		3CC52DDA1ACE4023006FEB01 /* srs_utest_core.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3CC52DCE1ACE4023006FEB01 /* srs_utest_core.cpp */; }; | ||||
|  | @ -372,6 +373,8 @@ | |||
| 		3C8280291BAFF896004A1794 /* transform.edge.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = transform.edge.conf; path = ../../../conf/transform.edge.conf; sourceTree = "<group>"; }; | ||||
| 		3C82802A1BAFF8CC004A1794 /* srs_kafka_stack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_kafka_stack.cpp; path = ../../../src/protocol/srs_kafka_stack.cpp; sourceTree = "<group>"; }; | ||||
| 		3C82802B1BAFF8CC004A1794 /* srs_kafka_stack.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_kafka_stack.hpp; path = ../../../src/protocol/srs_kafka_stack.hpp; sourceTree = "<group>"; }; | ||||
| 		3CB25C281BB2596300C97A63 /* setup_variables.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = setup_variables.sh; path = ../../../auto/setup_variables.sh; sourceTree = "<group>"; }; | ||||
| 		3CB25C291BB269FD00C97A63 /* jmp_sp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jmp_sp.cpp; path = ../../../research/arm/jmp_sp.cpp; sourceTree = "<group>"; }; | ||||
| 		3CC52DCA1ACE4023006FEB01 /* srs_utest_amf0.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_utest_amf0.cpp; path = ../../src/utest/srs_utest_amf0.cpp; sourceTree = "<group>"; }; | ||||
| 		3CC52DCB1ACE4023006FEB01 /* srs_utest_amf0.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_utest_amf0.hpp; path = ../../src/utest/srs_utest_amf0.hpp; sourceTree = "<group>"; }; | ||||
| 		3CC52DCC1ACE4023006FEB01 /* srs_utest_config.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_utest_config.cpp; path = ../../src/utest/srs_utest_config.cpp; sourceTree = "<group>"; }; | ||||
|  | @ -661,6 +664,7 @@ | |||
| 				3C1232C31AAE827E00CE8F6C /* local_ip.sh */, | ||||
| 				3C1232C41AAE827E00CE8F6C /* modules.sh */, | ||||
| 				3C1232C51AAE827E00CE8F6C /* options.sh */, | ||||
| 				3CB25C281BB2596300C97A63 /* setup_variables.sh */, | ||||
| 				3C1232C61AAE827E00CE8F6C /* summary.sh */, | ||||
| 				3C1232C71AAE827E00CE8F6C /* utest.sh */, | ||||
| 			); | ||||
|  | @ -772,6 +776,7 @@ | |||
| 		3C663F001AB014B500286D8B /* research */ = { | ||||
| 			isa = PBXGroup; | ||||
| 			children = ( | ||||
| 				3CB25C291BB269FD00C97A63 /* jmp_sp.cpp */, | ||||
| 				3C663F021AB0155100286D8B /* srs_aac_raw_publish.c */, | ||||
| 				3C663F031AB0155100286D8B /* srs_audio_raw_publish.c */, | ||||
| 				3C663F041AB0155100286D8B /* srs_bandwidth_check.c */, | ||||
|  | @ -964,6 +969,8 @@ | |||
| 				3C1232241AAE814D00CE8F6C /* srs_kernel_error.cpp in Sources */, | ||||
| 				3C036B561B2D0AC10078E2E0 /* srs_app_http_stream.cpp in Sources */, | ||||
| 				3C068D6D1B10175500AA722C /* srs_protocol_stream.cpp in Sources */, | ||||
| 				3CB25C2A1BB269FD00C97A63 /* jmp_sp.cpp in Sources */, | ||||
| 				3C068D6D1B10175500AA722C /* srs_protocol_buffer.cpp in Sources */, | ||||
| 				3C1232441AAE81A400CE8F6C /* srs_rtmp_handshake.cpp in Sources */, | ||||
| 				3C1232291AAE814D00CE8F6C /* srs_kernel_buffer.cpp in Sources */, | ||||
| 				3C663F181AB0155100286D8B /* srs_play.c in Sources */, | ||||
|  |  | |||
|  | @ -11,22 +11,7 @@ | |||
| 
 | ||||
| jmp_buf context; | ||||
| 
 | ||||
| void func1() | ||||
| { | ||||
| #if defined(__amd64__) || defined(__x86_64__) | ||||
|     register long int rsp0 asm("rsp"); | ||||
|      | ||||
|     int ret = setjmp(context); | ||||
|     printf("setjmp func1 ret=%d, rsp=%#lx\n", ret, rsp0); | ||||
|     // enter by longjmp
 | ||||
|     if (ret != 0) { | ||||
|         printf("call by longjmp.\n"); | ||||
|         exit(0); | ||||
|     } | ||||
| #endif | ||||
| } | ||||
| 
 | ||||
| void func0() | ||||
| void do_longjmp() | ||||
| { | ||||
|     /**
 | ||||
|     the definition of jmp_buf: | ||||
|  | @ -78,8 +63,6 @@ void func0() | |||
|         printf("env[%d]=%#x, ", i, (int)context[0].__jmpbuf[i]); | ||||
|     } | ||||
|     printf("\n"); | ||||
|      | ||||
|     func1(); | ||||
| #endif | ||||
| 
 | ||||
| #if defined(__arm__) | ||||
|  | @ -105,7 +88,7 @@ void func0() | |||
|     */ | ||||
|     /**
 | ||||
|     For example, on raspberry-pi, armv6 cpu: | ||||
|         (gdb) x /64 context[0].__jmpbuf | ||||
|         (gdb) x /64xb (char*)context[0].__jmpbuf | ||||
|             v1, 0:  0x00	0x00	0x00	0x00	 | ||||
|             v2, 1:  0x00	0x00	0x00	0x00 | ||||
|             v3, 2:  0x2c	0x84	0x00	0x00	 | ||||
|  | @ -147,8 +130,7 @@ int main(int argc, char** argv) | |||
|         (int)__GLIBC__, (int)__GLIBC_MINOR__); | ||||
| #endif | ||||
| 
 | ||||
|     func0(); | ||||
|     longjmp(context, 1); | ||||
|     do_longjmp(); | ||||
|      | ||||
|     printf("terminated\n"); | ||||
| 
 | ||||
|  |  | |||
|  | @ -119,5 +119,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
|         className(const className&); \ | ||||
|         className& operator= (const className&) | ||||
| 
 | ||||
| /**
 | ||||
|  * important check for st(state-threads), | ||||
|  * only support the following cpus: | ||||
|  *      1. i386/amd64/x86_64 | ||||
|  *      2. arm, glibc <= 2.15 | ||||
|  */ | ||||
| #if !defined(__amd64__) && !defined(__x86_64__) && !defined(__i386__) && !defined(__arm__) | ||||
|     #error "only support i386/amd64/x86_64/arm cpu" | ||||
| #endif | ||||
| #if defined(__arm__) && __GLIBC__ != 2 || __GLIBC_MINOR__ > 15 | ||||
|     #error "for arm, only support glibc <= 2.15" | ||||
| #endif | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue