File Add-missing-dependency-to-Num-for-OCaml-4.06.patch of Package cppmem

From c79881fc0972a83b4c8748e612a9c67a8e9006a7 Mon Sep 17 00:00:00 2001
From: Aaron Puchert <aaron.puchert@sap.com>
Date: Tue, 10 Jun 2025 22:24:36 +0200
Subject: [PATCH 1/3] Add missing dependency to Num for OCaml >4.06

Otherwise the build fails:

    + /usr/bin/ocamlc.opt -c -g -I cil-parser -o nat_big_num.cmo nat_big_num.ml
    File "nat_big_num.ml", line 1, characters 12-19:
    1 | module BI = Big_int
                    ^^^^^^^
    Error: Unbound module Big_int

The recommendation is to switch to Zarith, but for now we can just use
the separate library.

I've tried `-package num` for extract.cmxa as well, but that failed
with:

    + /usr/bin/ocamlopt.opt -a -I /usr/lib64/ocaml/num [...] -o extract.cmxa
    Option -a cannot be used with .cmxa input files.

I didn't figure out where that comes from and what to do about it, so we
add the -I flags manually for now.
---
 Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 9bcf467..7e102b7 100644
--- a/Makefile
+++ b/Makefile
@@ -76,6 +76,7 @@ cppmem bin/main bin/main.opt: cmm.ml ocamlbuild
 OBCFLAGS=-cflags -g,-I,../$(LEMOCAMLLIBDIR)/_build/
 OBLFLAGS=-lflags -g,-I,../$(LEMOCAMLLIBDIR)/_build/
 OBXFLAGS=-X bin -X doc -X $(JSOFOCAMLDIR) -X web
+OBPACKAGEFLAGS=-package num
 OBMISCFLAGS=-no-links -classic-display
 
 ocamlbuild: extract.cma extract.cmxa cmm.ml
@@ -202,6 +203,6 @@ clean::
 
 
 extract.cma :
-	ocamlbuild $(OBXFLAGS) extract.cma
+	ocamlbuild $(OBXFLAGS) $(OBPACKAGEFLAGS) extract.cma
 extract.cmxa :
-	ocamlbuild $(OBXFLAGS) extract.cmxa
+	ocamlbuild $(OBXFLAGS) -cflags $$(ocamlfind query -i-format -r num | tr ' \n' ',' | head -c -1) extract.cmxa
-- 
2.43.0

openSUSE Build Service is sponsored by