mirror of
https://github.com/odin-lang/Odin.git
synced 2026-07-15 04:10:29 +00:00
replace makefiles in vendor with shell scripts; update ci. (#7034)
Replace makefiles in vendor with shell scripts; update ci.
This commit is contained in:
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
@@ -27,9 +27,9 @@ jobs:
|
||||
gmake release
|
||||
./odin version
|
||||
./odin report
|
||||
gmake -C vendor/stb/src
|
||||
gmake -C vendor/cgltf/src
|
||||
gmake -C vendor/miniaudio/src
|
||||
(cd ./vendor/stb/src/; ./build_stb.sh)
|
||||
(cd ./vendor/cgltf/src/; ./build_cgltf.sh)
|
||||
(cd ./vendor/miniaudio/src/; ./build_miniaudio.sh)
|
||||
./odin check examples/all -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:netbsd_amd64
|
||||
./odin check examples/all -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:netbsd_arm64
|
||||
./odin check examples/all/sdl3 -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:netbsd_amd64 -no-entry-point
|
||||
@@ -60,9 +60,9 @@ jobs:
|
||||
gmake release
|
||||
./odin version
|
||||
./odin report
|
||||
gmake -C vendor/stb/src
|
||||
gmake -C vendor/cgltf/src
|
||||
gmake -C vendor/miniaudio/src
|
||||
(cd ./vendor/stb/src/; ./build_stb.sh)
|
||||
(cd ./vendor/cgltf/src/; ./build_cgltf.sh)
|
||||
(cd ./vendor/miniaudio/src/; ./build_miniaudio.sh)
|
||||
./odin check examples/all -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:freebsd_amd64
|
||||
./odin check examples/all/sdl3 -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -target:freebsd_amd64 -no-entry-point
|
||||
./odin test tests/core/normal.odin -file -all-packages -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do -define:ODIN_TEST_FANCY=false -define:ODIN_TEST_FAIL_ON_BAD_MEMORY=true
|
||||
@@ -122,9 +122,9 @@ jobs:
|
||||
brew install curl mbedtls
|
||||
- name: Compile needed Vendor
|
||||
run: |
|
||||
make -C vendor/stb/src
|
||||
make -C vendor/cgltf/src
|
||||
make -C vendor/miniaudio/src
|
||||
(cd ./vendor/stb/src/; ./build_stb.sh)
|
||||
(cd ./vendor/cgltf/src/; ./build_cgltf.sh)
|
||||
(cd ./vendor/miniaudio/src/; ./build_miniaudio.sh)
|
||||
- name: Odin check
|
||||
run: ./odin check examples/demo -vet
|
||||
- name: Odin run
|
||||
@@ -320,9 +320,9 @@ jobs:
|
||||
|
||||
- name: Compile needed Vendor
|
||||
run: |
|
||||
make -C vendor/stb/src
|
||||
make -C vendor/cgltf/src
|
||||
make -C vendor/miniaudio/src
|
||||
(cd ./vendor/stb/src/; ./build_stb.sh)
|
||||
(cd ./vendor/cgltf/src/; ./build_cgltf.sh)
|
||||
(cd ./vendor/miniaudio/src/; ./build_miniaudio.sh)
|
||||
|
||||
- name: Odin check examples/all
|
||||
run: ./odin check examples/all -target:linux_riscv64 -vet -vet-tabs -strict-style -vet-style -warnings-as-errors -disallow-do
|
||||
|
||||
24
vendor/cgltf/src/Makefile
vendored
24
vendor/cgltf/src/Makefile
vendored
@@ -1,24 +0,0 @@
|
||||
OS=$(shell uname)
|
||||
|
||||
ifeq ($(OS), Darwin)
|
||||
all: darwin
|
||||
else
|
||||
all: unix
|
||||
endif
|
||||
|
||||
wasm:
|
||||
mkdir -p ../lib
|
||||
$(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc-shim cgltf.c -o ../lib/cgltf_wasm.o
|
||||
|
||||
unix:
|
||||
mkdir -p ../lib
|
||||
$(CC) -c -O2 -Os -fPIC cgltf.c
|
||||
$(AR) rcs ../lib/cgltf.a cgltf.o
|
||||
rm *.o
|
||||
|
||||
darwin:
|
||||
mkdir -p ../lib/darwin
|
||||
$(CC) -arch x86_64 -c -O2 -Os -fPIC cgltf.c -o cgltf-x86_64.o -mmacosx-version-min=10.12
|
||||
$(CC) -arch arm64 -c -O2 -Os -fPIC cgltf.c -o cgltf-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create cgltf-x86_64.o cgltf-arm64.o -output ../lib/darwin/cgltf.a
|
||||
rm *.o
|
||||
39
vendor/cgltf/src/build_cgltf.sh
vendored
Executable file
39
vendor/cgltf/src/build_cgltf.sh
vendored
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
cc=${CC:-cc}
|
||||
ar=${AR:-ar}
|
||||
|
||||
build_wasm() {
|
||||
mkdir -p ../lib
|
||||
$cc -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc-shim cgltf.c -o ../lib/cgltf_wasm.o
|
||||
}
|
||||
|
||||
build_unix() {
|
||||
mkdir -p ../lib
|
||||
$cc -c -O2 -Os -fPIC cgltf.c
|
||||
$ar rcs ../lib/cgltf.a cgltf.o
|
||||
rm *.o
|
||||
}
|
||||
|
||||
build_darwin() {
|
||||
mkdir -p ../lib/darwin
|
||||
$cc -arch x86_64 -c -O2 -Os -fPIC cgltf.c -o cgltf-x86_64.o -mmacosx-version-min=10.12
|
||||
$cc -arch arm64 -c -O2 -Os -fPIC cgltf.c -o cgltf-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create cgltf-x86_64.o cgltf-arm64.o -output ../lib/darwin/cgltf.a
|
||||
rm *.o
|
||||
}
|
||||
|
||||
case $1 in
|
||||
wasm)
|
||||
build_wasm ;;
|
||||
unix)
|
||||
build_unix ;;
|
||||
darwin)
|
||||
build_darwin ;;
|
||||
*)
|
||||
if [ `uname -s` == 'Darwin' ]; then
|
||||
build_darwin
|
||||
else
|
||||
build_unix
|
||||
fi ;;
|
||||
esac
|
||||
6
vendor/miniaudio/src/Makefile
vendored
6
vendor/miniaudio/src/Makefile
vendored
@@ -1,6 +0,0 @@
|
||||
all:
|
||||
mkdir -p ../lib
|
||||
$(CC) -c -O2 -Os -fPIC miniaudio.c
|
||||
$(AR) rcs ../lib/miniaudio.a miniaudio.o
|
||||
#$(CC) -fPIC -shared -Wl,-soname=miniaudio.so -o ../lib/miniaudio.so miniaudio.o
|
||||
rm *.o
|
||||
10
vendor/miniaudio/src/build_miniaudio.sh
vendored
Executable file
10
vendor/miniaudio/src/build_miniaudio.sh
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
cc=${CC:-cc}
|
||||
ar=${AR:-ar}
|
||||
|
||||
mkdir -p ../lib
|
||||
$cc -c -O2 -Os -fPIC miniaudio.c
|
||||
$ar rcs ../lib/miniaudio.a miniaudio.o
|
||||
#$cc -fPIC -shared -Wl,-soname=miniaudio.so -o ../lib/miniaudio.so miniaudio.o
|
||||
rm *.o
|
||||
61
vendor/stb/src/Makefile
vendored
61
vendor/stb/src/Makefile
vendored
@@ -1,61 +0,0 @@
|
||||
OS=$(shell uname)
|
||||
|
||||
ifeq ($(OS), Darwin)
|
||||
all: darwin
|
||||
else
|
||||
all: unix
|
||||
endif
|
||||
|
||||
wasm:
|
||||
mkdir -p ../lib
|
||||
$(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc-shim stb_image.c -o ../lib/stb_image_wasm.o -DSTBI_NO_STDIO
|
||||
$(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc-shim stb_image_write.c -o ../lib/stb_image_write_wasm.o -DSTBI_WRITE_NO_STDIO
|
||||
$(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc-shim stb_image_resize.c -o ../lib/stb_image_resize_wasm.o
|
||||
$(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc-shim stb_truetype.c -o ../lib/stb_truetype_wasm.o
|
||||
# Pretends to be emscripten so stb vorbis takes the right code path for including alloca.h
|
||||
$(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc-shim stb_vorbis.c -o ../lib/stb_vorbis_wasm.o -DSTB_VORBIS_NO_STDIO -D__EMSCRIPTEN__
|
||||
$(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc-shim stb_rect_pack.c -o ../lib/stb_rect_pack_wasm.o
|
||||
$(CC) -c -Os --target=wasm32 stb_sprintf.c -o ../lib/stb_sprintf_wasm.o
|
||||
|
||||
unix:
|
||||
mkdir -p ../lib
|
||||
$(CC) -c -O2 -Os -fPIC stb_image.c stb_image_write.c stb_image_resize.c stb_truetype.c stb_rect_pack.c stb_vorbis.c stb_sprintf.c
|
||||
$(AR) rcs ../lib/stb_image.a stb_image.o
|
||||
$(AR) rcs ../lib/stb_image_write.a stb_image_write.o
|
||||
$(AR) rcs ../lib/stb_image_resize.a stb_image_resize.o
|
||||
$(AR) rcs ../lib/stb_truetype.a stb_truetype.o
|
||||
$(AR) rcs ../lib/stb_rect_pack.a stb_rect_pack.o
|
||||
$(AR) rcs ../lib/stb_vorbis.a stb_vorbis.o
|
||||
$(AR) rcs ../lib/stb_sprintf.a stb_sprintf.o
|
||||
#$(CC) -fPIC -shared -Wl,-soname=stb_image.so -o ../lib/stb_image.so stb_image.o
|
||||
#$(CC) -fPIC -shared -Wl,-soname=stb_image_write.so -o ../lib/stb_image_write.so stb_image_write.o
|
||||
#$(CC) -fPIC -shared -Wl,-soname=stb_image_resize.so -o ../lib/stb_image_resize.so stb_image_resize.o
|
||||
#$(CC) -fPIC -shared -Wl,-soname=stb_truetype.so -o ../lib/stb_truetype.so stb_image_truetype.o
|
||||
#$(CC) -fPIC -shared -Wl,-soname=stb_rect_pack.so -o ../lib/stb_rect_pack.so stb_rect_packl.o
|
||||
#$(CC) -fPIC -shared -Wl,-soname=stb_vorbis.so -o ../lib/stb_vorbis.so stb_vorbisl.o
|
||||
rm *.o
|
||||
|
||||
darwin:
|
||||
mkdir -p ../lib
|
||||
$(CC) -arch x86_64 -c -O2 -Os -fPIC stb_image.c -o stb_image-x86_64.o -mmacosx-version-min=10.12
|
||||
$(CC) -arch arm64 -c -O2 -Os -fPIC stb_image.c -o stb_image-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create stb_image-x86_64.o stb_image-arm64.o -output ../lib/darwin/stb_image.a
|
||||
$(CC) -arch x86_64 -c -O2 -Os -fPIC stb_image_write.c -o stb_image_write-x86_64.o -mmacosx-version-min=10.12
|
||||
$(CC) -arch arm64 -c -O2 -Os -fPIC stb_image_write.c -o stb_image_write-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create stb_image_write-x86_64.o stb_image_write-arm64.o -output ../lib/darwin/stb_image_write.a
|
||||
$(CC) -arch x86_64 -c -O2 -Os -fPIC stb_image_resize.c -o stb_image_resize-x86_64.o -mmacosx-version-min=10.12
|
||||
$(CC) -arch arm64 -c -O2 -Os -fPIC stb_image_resize.c -o stb_image_resize-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create stb_image_resize-x86_64.o stb_image_resize-arm64.o -output ../lib/darwin/stb_image_resize.a
|
||||
$(CC) -arch x86_64 -c -O2 -Os -fPIC stb_truetype.c -o stb_truetype-x86_64.o -mmacosx-version-min=10.12
|
||||
$(CC) -arch arm64 -c -O2 -Os -fPIC stb_truetype.c -o stb_truetype-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create stb_truetype-x86_64.o stb_truetype-arm64.o -output ../lib/darwin/stb_truetype.a
|
||||
$(CC) -arch x86_64 -c -O2 -Os -fPIC stb_rect_pack.c -o stb_rect_pack-x86_64.o -mmacosx-version-min=10.12
|
||||
$(CC) -arch arm64 -c -O2 -Os -fPIC stb_rect_pack.c -o stb_rect_pack-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create stb_rect_pack-x86_64.o stb_rect_pack-arm64.o -output ../lib/darwin/stb_rect_pack.a
|
||||
$(CC) -arch x86_64 -c -O2 -Os -fPIC stb_vorbis.c -o stb_vorbis-x86_64.o -mmacosx-version-min=10.12
|
||||
$(CC) -arch arm64 -c -O2 -Os -fPIC stb_vorbis.c -o stb_vorbis-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create stb_vorbis-x86_64.o stb_vorbis-arm64.o -output ../lib/darwin/stb_vorbis.a
|
||||
$(CC) -arch x86_64 -c -O2 -Os -fPIC stb_sprintf.c -o stb_sprintf-x86_64.o -mmacosx-version-min=10.12
|
||||
$(CC) -arch arm64 -c -O2 -Os -fPIC stb_sprintf.c -o stb_sprintf-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create stb_sprintf-x86_64.o stb_sprintf-arm64.o -output ../lib/darwin/stb_sprintf.a
|
||||
rm *.o
|
||||
76
vendor/stb/src/build_stb.sh
vendored
Executable file
76
vendor/stb/src/build_stb.sh
vendored
Executable file
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
cc=${CC:-cc}
|
||||
ar=${AR:-ar}
|
||||
|
||||
build_wasm() {
|
||||
mkdir -p ../lib
|
||||
$cc -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc-shim stb_image.c -o ../lib/stb_image_wasm.o -DSTBI_NO_STDIO
|
||||
$cc -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc-shim stb_image_write.c -o ../lib/stb_image_write_wasm.o -DSTBI_WRITE_NO_STDIO
|
||||
$cc -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc-shim stb_image_resize.c -o ../lib/stb_image_resize_wasm.o
|
||||
$cc -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc-shim stb_truetype.c -o ../lib/stb_truetype_wasm.o
|
||||
# Pretends to be emscripten so stb vorbis takes the right code path for including alloca.h
|
||||
$cc -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc-shim stb_vorbis.c -o ../lib/stb_vorbis_wasm.o -DSTB_VORBIS_NO_STDIO -D__EMSCRIPTEN__
|
||||
$cc -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc-shim stb_rect_pack.c -o ../lib/stb_rect_pack_wasm.o
|
||||
$cc -c -Os --target=wasm32 stb_sprintf.c -o ../lib/stb_sprintf_wasm.o
|
||||
}
|
||||
|
||||
build_unix() {
|
||||
mkdir -p ../lib
|
||||
$cc -c -O2 -Os -fPIC stb_image.c stb_image_write.c stb_image_resize.c stb_truetype.c stb_rect_pack.c stb_vorbis.c stb_sprintf.c
|
||||
$ar rcs ../lib/stb_image.a stb_image.o
|
||||
$ar rcs ../lib/stb_image_write.a stb_image_write.o
|
||||
$ar rcs ../lib/stb_image_resize.a stb_image_resize.o
|
||||
$ar rcs ../lib/stb_truetype.a stb_truetype.o
|
||||
$ar rcs ../lib/stb_rect_pack.a stb_rect_pack.o
|
||||
$ar rcs ../lib/stb_vorbis.a stb_vorbis.o
|
||||
$ar rcs ../lib/stb_sprintf.a stb_sprintf.o
|
||||
#$cc -fPIC -shared -Wl,-soname=stb_image.so -o ../lib/stb_image.so stb_image.o
|
||||
#$cc -fPIC -shared -Wl,-soname=stb_image_write.so -o ../lib/stb_image_write.so stb_image_write.o
|
||||
#$cc -fPIC -shared -Wl,-soname=stb_image_resize.so -o ../lib/stb_image_resize.so stb_image_resize.o
|
||||
#$cc -fPIC -shared -Wl,-soname=stb_truetype.so -o ../lib/stb_truetype.so stb_image_truetype.o
|
||||
#$cc -fPIC -shared -Wl,-soname=stb_rect_pack.so -o ../lib/stb_rect_pack.so stb_rect_packl.o
|
||||
#$cc -fPIC -shared -Wl,-soname=stb_vorbis.so -o ../lib/stb_vorbis.so stb_vorbisl.o
|
||||
rm *.o
|
||||
}
|
||||
|
||||
build_darwin() {
|
||||
mkdir -p ../lib
|
||||
$cc -arch x86_64 -c -O2 -Os -fPIC stb_image.c -o stb_image-x86_64.o -mmacosx-version-min=10.12
|
||||
$cc -arch arm64 -c -O2 -Os -fPIC stb_image.c -o stb_image-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create stb_image-x86_64.o stb_image-arm64.o -output ../lib/darwin/stb_image.a
|
||||
$cc -arch x86_64 -c -O2 -Os -fPIC stb_image_write.c -o stb_image_write-x86_64.o -mmacosx-version-min=10.12
|
||||
$cc -arch arm64 -c -O2 -Os -fPIC stb_image_write.c -o stb_image_write-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create stb_image_write-x86_64.o stb_image_write-arm64.o -output ../lib/darwin/stb_image_write.a
|
||||
$cc -arch x86_64 -c -O2 -Os -fPIC stb_image_resize.c -o stb_image_resize-x86_64.o -mmacosx-version-min=10.12
|
||||
$cc -arch arm64 -c -O2 -Os -fPIC stb_image_resize.c -o stb_image_resize-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create stb_image_resize-x86_64.o stb_image_resize-arm64.o -output ../lib/darwin/stb_image_resize.a
|
||||
$cc -arch x86_64 -c -O2 -Os -fPIC stb_truetype.c -o stb_truetype-x86_64.o -mmacosx-version-min=10.12
|
||||
$cc -arch arm64 -c -O2 -Os -fPIC stb_truetype.c -o stb_truetype-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create stb_truetype-x86_64.o stb_truetype-arm64.o -output ../lib/darwin/stb_truetype.a
|
||||
$cc -arch x86_64 -c -O2 -Os -fPIC stb_rect_pack.c -o stb_rect_pack-x86_64.o -mmacosx-version-min=10.12
|
||||
$cc -arch arm64 -c -O2 -Os -fPIC stb_rect_pack.c -o stb_rect_pack-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create stb_rect_pack-x86_64.o stb_rect_pack-arm64.o -output ../lib/darwin/stb_rect_pack.a
|
||||
$cc -arch x86_64 -c -O2 -Os -fPIC stb_vorbis.c -o stb_vorbis-x86_64.o -mmacosx-version-min=10.12
|
||||
$cc -arch arm64 -c -O2 -Os -fPIC stb_vorbis.c -o stb_vorbis-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create stb_vorbis-x86_64.o stb_vorbis-arm64.o -output ../lib/darwin/stb_vorbis.a
|
||||
$cc -arch x86_64 -c -O2 -Os -fPIC stb_sprintf.c -o stb_sprintf-x86_64.o -mmacosx-version-min=10.12
|
||||
$cc -arch arm64 -c -O2 -Os -fPIC stb_sprintf.c -o stb_sprintf-arm64.o -mmacosx-version-min=10.12
|
||||
lipo -create stb_sprintf-x86_64.o stb_sprintf-arm64.o -output ../lib/darwin/stb_sprintf.a
|
||||
rm *.o
|
||||
}
|
||||
|
||||
case $1 in
|
||||
wasm)
|
||||
build_wasm ;;
|
||||
unix)
|
||||
build_unix ;;
|
||||
darwin)
|
||||
build_darwin ;;
|
||||
*)
|
||||
if [ `uname -s` == 'Darwin' ]; then
|
||||
build_darwin
|
||||
else
|
||||
build_unix
|
||||
fi ;;
|
||||
esac
|
||||
Reference in New Issue
Block a user