From f308d92f3268f32f053e4f442aa555bbe9f80894 Mon Sep 17 00:00:00 2001 From: quark <47686923+quarkstuff@users.noreply.github.com> Date: Tue, 14 Jul 2026 03:43:28 -0600 Subject: [PATCH] replace makefiles in vendor with shell scripts; update ci. (#7034) Replace makefiles in vendor with shell scripts; update ci. --- .github/workflows/ci.yml | 24 ++++---- vendor/cgltf/src/Makefile | 24 -------- vendor/cgltf/src/build_cgltf.sh | 39 +++++++++++++ vendor/miniaudio/src/Makefile | 6 -- vendor/miniaudio/src/build_miniaudio.sh | 10 ++++ vendor/stb/src/Makefile | 61 -------------------- vendor/stb/src/build_stb.sh | 76 +++++++++++++++++++++++++ 7 files changed, 137 insertions(+), 103 deletions(-) delete mode 100644 vendor/cgltf/src/Makefile create mode 100755 vendor/cgltf/src/build_cgltf.sh delete mode 100644 vendor/miniaudio/src/Makefile create mode 100755 vendor/miniaudio/src/build_miniaudio.sh delete mode 100644 vendor/stb/src/Makefile create mode 100755 vendor/stb/src/build_stb.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 261a3e00e..35bc14a6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/vendor/cgltf/src/Makefile b/vendor/cgltf/src/Makefile deleted file mode 100644 index f4dc8c12c..000000000 --- a/vendor/cgltf/src/Makefile +++ /dev/null @@ -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 diff --git a/vendor/cgltf/src/build_cgltf.sh b/vendor/cgltf/src/build_cgltf.sh new file mode 100755 index 000000000..8eb000be5 --- /dev/null +++ b/vendor/cgltf/src/build_cgltf.sh @@ -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 diff --git a/vendor/miniaudio/src/Makefile b/vendor/miniaudio/src/Makefile deleted file mode 100644 index 3c61b5e2f..000000000 --- a/vendor/miniaudio/src/Makefile +++ /dev/null @@ -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 diff --git a/vendor/miniaudio/src/build_miniaudio.sh b/vendor/miniaudio/src/build_miniaudio.sh new file mode 100755 index 000000000..a702fdfdf --- /dev/null +++ b/vendor/miniaudio/src/build_miniaudio.sh @@ -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 diff --git a/vendor/stb/src/Makefile b/vendor/stb/src/Makefile deleted file mode 100644 index 521eead93..000000000 --- a/vendor/stb/src/Makefile +++ /dev/null @@ -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 diff --git a/vendor/stb/src/build_stb.sh b/vendor/stb/src/build_stb.sh new file mode 100755 index 000000000..6d1e3f8d7 --- /dev/null +++ b/vendor/stb/src/build_stb.sh @@ -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