aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaytan Laats <laytanlaats@hotmail.com>2026-01-22 21:34:46 +0100
committerLaytan Laats <laytanlaats@hotmail.com>2026-01-22 21:36:53 +0100
commit5f974059f46317328db64b9f0dcf9ead55f167fa (patch)
treee27044309e379249d316fbaf6a7972c58b5c8686
parentce71227b6bba4bbe74d53c681264a9cba974403a (diff)
move vendor:libc to vendor:libc-shim
-rw-r--r--vendor/box2d/box2d_wasm.odin2
-rw-r--r--vendor/box2d/wasm.Makefile2
-rw-r--r--vendor/cgltf/cgltf_wasm.odin2
-rw-r--r--vendor/cgltf/src/Makefile2
-rw-r--r--vendor/libc-shim/README.md (renamed from vendor/libc/README.md)6
-rw-r--r--vendor/libc-shim/assert.odin (renamed from vendor/libc/assert.odin)0
-rw-r--r--vendor/libc-shim/ctype.odin (renamed from vendor/libc/ctype.odin)0
-rw-r--r--vendor/libc-shim/include/alloca.h (renamed from vendor/libc/include/alloca.h)0
-rw-r--r--vendor/libc-shim/include/assert.h (renamed from vendor/libc/include/assert.h)0
-rw-r--r--vendor/libc-shim/include/ctype.h (renamed from vendor/libc/include/ctype.h)0
-rw-r--r--vendor/libc-shim/include/inttypes.h (renamed from vendor/libc/include/inttypes.h)0
-rw-r--r--vendor/libc-shim/include/math.h (renamed from vendor/libc/include/math.h)0
-rw-r--r--vendor/libc-shim/include/sched.h (renamed from vendor/libc/include/sched.h)0
-rw-r--r--vendor/libc-shim/include/stdio.h (renamed from vendor/libc/include/stdio.h)0
-rw-r--r--vendor/libc-shim/include/stdlib.h (renamed from vendor/libc/include/stdlib.h)0
-rw-r--r--vendor/libc-shim/include/string.h (renamed from vendor/libc/include/string.h)0
-rw-r--r--vendor/libc-shim/include/time.h (renamed from vendor/libc/include/time.h)0
-rw-r--r--vendor/libc-shim/libc.odin26
-rw-r--r--vendor/libc-shim/math.odin (renamed from vendor/libc/math.odin)0
-rw-r--r--vendor/libc-shim/sched.odin (renamed from vendor/libc/sched.odin)0
-rw-r--r--vendor/libc-shim/stdio.odin (renamed from vendor/libc/stdio.odin)4
-rw-r--r--vendor/libc-shim/stdlib.odin (renamed from vendor/libc/stdlib.odin)0
-rw-r--r--vendor/libc-shim/string.odin (renamed from vendor/libc/string.odin)0
-rw-r--r--vendor/libc-shim/time.odin (renamed from vendor/libc/time.odin)0
-rw-r--r--vendor/libc/libc.odin25
-rw-r--r--vendor/stb/image/stb_image_wasm.odin2
-rw-r--r--vendor/stb/rect_pack/stb_rect_pack_wasm.odin2
-rw-r--r--vendor/stb/src/Makefile12
-rw-r--r--vendor/stb/truetype/stb_truetype_wasm.odin2
29 files changed, 45 insertions, 42 deletions
diff --git a/vendor/box2d/box2d_wasm.odin b/vendor/box2d/box2d_wasm.odin
index 0fcaf753f..1bbe9b8bc 100644
--- a/vendor/box2d/box2d_wasm.odin
+++ b/vendor/box2d/box2d_wasm.odin
@@ -1,4 +1,4 @@
#+build wasm32, wasm64p32
package vendor_box2d
-@(require) import _ "vendor:libc"
+@(require) import _ "vendor:libc-shim"
diff --git a/vendor/box2d/wasm.Makefile b/vendor/box2d/wasm.Makefile
index 80dd2ba14..5cce30ad1 100644
--- a/vendor/box2d/wasm.Makefile
+++ b/vendor/box2d/wasm.Makefile
@@ -11,7 +11,7 @@ VERSION = 3.1.1
SRCS = $(wildcard box2d-$(VERSION)/src/*.c)
OBJS_SIMD = $(SRCS:.c=_simd.o)
OBJS = $(SRCS:.c=.o)
-SYSROOT = $(shell odin root)/vendor/libc
+SYSROOT = $(shell odin root)/vendor/libc-shim
CFLAGS = -Ibox2d-$(VERSION)/include --target=wasm32 -D__EMSCRIPTEN__ -DNDEBUG -O3 --sysroot=$(SYSROOT)
all: lib/box2d_wasm.o lib/box2d_wasm_simd.o
diff --git a/vendor/cgltf/cgltf_wasm.odin b/vendor/cgltf/cgltf_wasm.odin
index fb612b2ac..1404fc592 100644
--- a/vendor/cgltf/cgltf_wasm.odin
+++ b/vendor/cgltf/cgltf_wasm.odin
@@ -1,4 +1,4 @@
#+build wasm32, wasm64p32
package cgltf
-@(require) import _ "vendor:libc"
+@(require) import _ "vendor:libc-shim"
diff --git a/vendor/cgltf/src/Makefile b/vendor/cgltf/src/Makefile
index 0dd450ce0..f4dc8c12c 100644
--- a/vendor/cgltf/src/Makefile
+++ b/vendor/cgltf/src/Makefile
@@ -8,7 +8,7 @@ endif
wasm:
mkdir -p ../lib
- $(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc cgltf.c -o ../lib/cgltf_wasm.o
+ $(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc-shim cgltf.c -o ../lib/cgltf_wasm.o
unix:
mkdir -p ../lib
diff --git a/vendor/libc/README.md b/vendor/libc-shim/README.md
index 1dd50c5a9..9b44984f6 100644
--- a/vendor/libc/README.md
+++ b/vendor/libc-shim/README.md
@@ -1,11 +1,11 @@
-# vendor:libc
+# vendor:libc-shim
A (very small) subset of a libc implementation over Odin libraries.
This is mainly intended for use in Odin WASM builds to allow using libraries like box2d, cgltf etc. without emscripten hacks.
-You can use this with clang by doing `clang -c --target=wasm32 --sysroot=$(odin root)/vendor/libc` (+ all other flags and inputs).
+You can use this with clang by doing `clang -c --target=wasm32 --sysroot=$(odin root)/vendor/libc-shim` (+ all other flags and inputs).
This will (if all the libc usage of the library is implemented) spit out a `.o` file you can use with the foreign import system.
-If you then also make sure this package is included in the Odin side of the project (`@(require) import "vendor:libc"`) you will be able
+If you then also make sure this package is included in the Odin side of the project (`@(require) import "vendor:libc-shim"`) you will be able
compile to WASM like Odin expects.
This is currently used by `vendor:box2d`, `vendor:stb/image`, `vendor:stb/truetype`, `vendor:stb/rect_pack`, and `vendor:cgltf`.
diff --git a/vendor/libc/assert.odin b/vendor/libc-shim/assert.odin
index c34bd1f2d..c34bd1f2d 100644
--- a/vendor/libc/assert.odin
+++ b/vendor/libc-shim/assert.odin
diff --git a/vendor/libc/ctype.odin b/vendor/libc-shim/ctype.odin
index 8813055d7..8813055d7 100644
--- a/vendor/libc/ctype.odin
+++ b/vendor/libc-shim/ctype.odin
diff --git a/vendor/libc/include/alloca.h b/vendor/libc-shim/include/alloca.h
index 8b4d19018..8b4d19018 100644
--- a/vendor/libc/include/alloca.h
+++ b/vendor/libc-shim/include/alloca.h
diff --git a/vendor/libc/include/assert.h b/vendor/libc-shim/include/assert.h
index 4e8cd85a4..4e8cd85a4 100644
--- a/vendor/libc/include/assert.h
+++ b/vendor/libc-shim/include/assert.h
diff --git a/vendor/libc/include/ctype.h b/vendor/libc-shim/include/ctype.h
index a579b5674..a579b5674 100644
--- a/vendor/libc/include/ctype.h
+++ b/vendor/libc-shim/include/ctype.h
diff --git a/vendor/libc/include/inttypes.h b/vendor/libc-shim/include/inttypes.h
index e69de29bb..e69de29bb 100644
--- a/vendor/libc/include/inttypes.h
+++ b/vendor/libc-shim/include/inttypes.h
diff --git a/vendor/libc/include/math.h b/vendor/libc-shim/include/math.h
index dd9e8e9ba..dd9e8e9ba 100644
--- a/vendor/libc/include/math.h
+++ b/vendor/libc-shim/include/math.h
diff --git a/vendor/libc/include/sched.h b/vendor/libc-shim/include/sched.h
index 6e4397536..6e4397536 100644
--- a/vendor/libc/include/sched.h
+++ b/vendor/libc-shim/include/sched.h
diff --git a/vendor/libc/include/stdio.h b/vendor/libc-shim/include/stdio.h
index 06339c1a3..06339c1a3 100644
--- a/vendor/libc/include/stdio.h
+++ b/vendor/libc-shim/include/stdio.h
diff --git a/vendor/libc/include/stdlib.h b/vendor/libc-shim/include/stdlib.h
index 01c6ac6b2..01c6ac6b2 100644
--- a/vendor/libc/include/stdlib.h
+++ b/vendor/libc-shim/include/stdlib.h
diff --git a/vendor/libc/include/string.h b/vendor/libc-shim/include/string.h
index 6d947858f..6d947858f 100644
--- a/vendor/libc/include/string.h
+++ b/vendor/libc-shim/include/string.h
diff --git a/vendor/libc/include/time.h b/vendor/libc-shim/include/time.h
index 369e25256..369e25256 100644
--- a/vendor/libc/include/time.h
+++ b/vendor/libc-shim/include/time.h
diff --git a/vendor/libc-shim/libc.odin b/vendor/libc-shim/libc.odin
new file mode 100644
index 000000000..a5508e14f
--- /dev/null
+++ b/vendor/libc-shim/libc.odin
@@ -0,0 +1,26 @@
+package odin_libc
+
+import "base:runtime"
+
+import "core:mem"
+
+@(private)
+g_ctx: runtime.Context
+@(private)
+g_allocator: mem.Compat_Allocator
+
+@(init)
+init_context :: proc "contextless" () {
+ g_ctx = runtime.default_context()
+ context = g_ctx
+
+ // Wrapping the allocator with the mem.Compat_Allocator so we can
+ // mimic the realloc semantics.
+ mem.compat_allocator_init(&g_allocator, g_ctx.allocator)
+ g_ctx.allocator = mem.compat_allocator(&g_allocator)
+}
+
+// NOTE: the allocator must respect an `old_size` of `-1` on resizes!
+set_context :: proc(ctx := context) {
+ g_ctx = ctx
+}
diff --git a/vendor/libc/math.odin b/vendor/libc-shim/math.odin
index 26d8a917a..26d8a917a 100644
--- a/vendor/libc/math.odin
+++ b/vendor/libc-shim/math.odin
diff --git a/vendor/libc/sched.odin b/vendor/libc-shim/sched.odin
index 85fad3c05..85fad3c05 100644
--- a/vendor/libc/sched.odin
+++ b/vendor/libc-shim/sched.odin
diff --git a/vendor/libc/stdio.odin b/vendor/libc-shim/stdio.odin
index d41f790ee..e269b8986 100644
--- a/vendor/libc/stdio.odin
+++ b/vendor/libc-shim/stdio.odin
@@ -17,7 +17,7 @@ EOF :: -1
@(require, linkage="strong", link_name="fopen")
fopen :: proc "c" (path: cstring, mode: cstring) -> FILE {
context = g_ctx
- unimplemented("vendor/libc: fopen")
+ unimplemented("vendor/libc-shim: fopen")
}
@(require, linkage="strong", link_name="fseek")
@@ -366,7 +366,7 @@ _sscanf :: proc "c" (str, fmt: [^]byte, orig_ptrs: [^]rawptr) -> i32 {
i = 0
k = t == 'c' ? width + 1 : 31
if size == .l {
- unimplemented("vendor/libc: sscanf wide character support")
+ unimplemented("vendor/libc-shim: sscanf wide character support")
} else if alloc {
s = make([^]byte, k)
if s == nil {
diff --git a/vendor/libc/stdlib.odin b/vendor/libc-shim/stdlib.odin
index cffc66ed2..cffc66ed2 100644
--- a/vendor/libc/stdlib.odin
+++ b/vendor/libc-shim/stdlib.odin
diff --git a/vendor/libc/string.odin b/vendor/libc-shim/string.odin
index b8115ea88..b8115ea88 100644
--- a/vendor/libc/string.odin
+++ b/vendor/libc-shim/string.odin
diff --git a/vendor/libc/time.odin b/vendor/libc-shim/time.odin
index 6d8b8f611..6d8b8f611 100644
--- a/vendor/libc/time.odin
+++ b/vendor/libc-shim/time.odin
diff --git a/vendor/libc/libc.odin b/vendor/libc/libc.odin
index a5508e14f..7af35b090 100644
--- a/vendor/libc/libc.odin
+++ b/vendor/libc/libc.odin
@@ -1,26 +1,3 @@
package odin_libc
-import "base:runtime"
-
-import "core:mem"
-
-@(private)
-g_ctx: runtime.Context
-@(private)
-g_allocator: mem.Compat_Allocator
-
-@(init)
-init_context :: proc "contextless" () {
- g_ctx = runtime.default_context()
- context = g_ctx
-
- // Wrapping the allocator with the mem.Compat_Allocator so we can
- // mimic the realloc semantics.
- mem.compat_allocator_init(&g_allocator, g_ctx.allocator)
- g_ctx.allocator = mem.compat_allocator(&g_allocator)
-}
-
-// NOTE: the allocator must respect an `old_size` of `-1` on resizes!
-set_context :: proc(ctx := context) {
- g_ctx = ctx
-}
+#panic("`vendor:libc` has been moved, use `vendor:libc-shim` instead.")
diff --git a/vendor/stb/image/stb_image_wasm.odin b/vendor/stb/image/stb_image_wasm.odin
index f43012383..cfad4725a 100644
--- a/vendor/stb/image/stb_image_wasm.odin
+++ b/vendor/stb/image/stb_image_wasm.odin
@@ -1,4 +1,4 @@
#+build wasm32, wasm64p32
package stb_image
-@(require) import _ "vendor:libc"
+@(require) import _ "vendor:libc-shim"
diff --git a/vendor/stb/rect_pack/stb_rect_pack_wasm.odin b/vendor/stb/rect_pack/stb_rect_pack_wasm.odin
index c4e2e5160..c9b6f3de8 100644
--- a/vendor/stb/rect_pack/stb_rect_pack_wasm.odin
+++ b/vendor/stb/rect_pack/stb_rect_pack_wasm.odin
@@ -1,4 +1,4 @@
#+build wasm32, wasm64p32
package stb_rect_pack
-@(require) import _ "vendor:libc"
+@(require) import _ "vendor:libc-shim"
diff --git a/vendor/stb/src/Makefile b/vendor/stb/src/Makefile
index 194ea5e75..94ba4d5bf 100644
--- a/vendor/stb/src/Makefile
+++ b/vendor/stb/src/Makefile
@@ -8,12 +8,12 @@ endif
wasm:
mkdir -p ../lib
- $(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc stb_image.c -o ../lib/stb_image_wasm.o -DSTBI_NO_STDIO
- $(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc 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 stb_image_resize.c -o ../lib/stb_image_resize_wasm.o
- $(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc stb_truetype.c -o ../lib/stb_truetype_wasm.o
- # $(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc stb_vorbis.c -o ../lib/stb_vorbis_wasm.o -DSTB_VORBIS_NO_STDIO
- $(CC) -c -Os --target=wasm32 --sysroot=$(shell odin root)/vendor/libc stb_rect_pack.c -o ../lib/stb_rect_pack_wasm.o
+ $(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
+ # $(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
+ $(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:
diff --git a/vendor/stb/truetype/stb_truetype_wasm.odin b/vendor/stb/truetype/stb_truetype_wasm.odin
index f36239086..727ba3ef0 100644
--- a/vendor/stb/truetype/stb_truetype_wasm.odin
+++ b/vendor/stb/truetype/stb_truetype_wasm.odin
@@ -1,4 +1,4 @@
#+build wasm32, wasm64p32
package stb_truetype
-@(require) import _ "vendor:libc"
+@(require) import _ "vendor:libc-shim"