--- c-lib/Makefile.orig	2026-05-29 06:26:05
+++ c-lib/Makefile	2026-06-07 00:00:00
@@ -13,9 +13,10 @@
 OCAML_LIBDIR := $(shell ocamlc -where)
 INCLUDES = -I . -I $(OCAML_LIBDIR) $(shell pkg-config --cflags glib-2.0)
 CUDF_LDFLAGS = -L$(OCAML_LIBDIR) -L$(CURDIR)
-CUDF_CLIBS = -lcudf -lm -ldl -lunix -lncurses -lglib-2.0
+CUDF_CLIBS = -lcudf -lm -ldl -lncurses -lglib-2.0 -lzstd -lunixbyt
 OCAMLC = ocamlfind ocamlc -package unix,extlib
 OCAMLOPT = ocamlfind ocamlopt -package unix,extlib
+CUDF_DIR := $(shell ocamlfind query cudf)

 INSTALL_STUFF = libcudf.a cudf.h cudf.pc

@@ -27,14 +28,14 @@
 	ar r $@ $^

 cudf_c.cmo: cudf_c.ml
-	$(OCAMLC) -linkpkg -I ../_build/install/default/lib/cudf/ ../_build/install/default/lib/cudf/cudf.cma $^
+	$(OCAMLC) -linkpkg -I $(CUDF_DIR) $(CUDF_DIR)/cudf.cma $^
 cudf_c.cmx: cudf_c.ml
-	$(OCAMLOPT) -linkpkg -I ../_build/install/default/lib/cudf/ ../_build/install/default/lib/cudf/cudf.cmxa $^
+	$(OCAMLOPT) -linkpkg -I $(CUDF_DIR) $(CUDF_DIR)/cudf.cmxa $^

 cudf-caml.o: cudf_c.cmo
-	$(OCAMLC) -linkpkg -output-obj -o $@ ../_build/install/default/lib/cudf/cudf.cma $^
+	$(OCAMLC) -linkpkg -output-obj -o $@ $(CUDF_DIR)/cudf.cma $^
 cudf-caml-opt.o: cudf_c.cmx
-	$(OCAMLOPT) -linkpkg -output-obj -o $@ ../_build/install/default/lib/cudf/cudf.cmxa $^
+	$(OCAMLOPT) -linkpkg -output-obj -o $@ $(CUDF_DIR)/cudf.cmxa $^

 cudf.o: cudf.c cudf.h cudf-variants.h

@@ -45,7 +46,7 @@
 	$(CC) $(PROG_CFLAGS) -o $@ $(INCLUDES) $(CUDF_LDFLAGS) $< $(CUDF_CLIBS)
 c-test-opt: c-test.o libcudf-opt.a
 	$(CC) $(PROG_CFLAGS) -o $@ $(INCLUDES) $(CUDF_LDFLAGS) $< \
-		$(subst -lcudf,-lcudf-opt,$(CUDF_CLIBS))
+		$(subst -lunixbyt,-lunixnat,$(subst -lcudf,-lcudf-opt,$(CUDF_CLIBS)))

 test: ../tests/data/legacy.cudf ../tests/data/legacy-sol.cudf c-test
 	./c-test ../tests/data/legacy.cudf ../tests/data/legacy-sol.cudf > /dev/null
