mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +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
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
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Wall -o $@ $^ $(LDLIBS)
|
||||
|
||||
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
|
||||
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)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Wall -o verify verify.c $(LDLIBS)
|
||||
|
||||
clean:
|
||||
rm -f verify
|
||||
cd ../.. && make clean
|
||||
rm -rf verify verify.dSYM
|
||||
|
||||
$(LDLIBS):
|
||||
cd ../.. && make $(ST_TARGET)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue