[med-svn] [Git][med-team/mcl][master] 7 commits: Re-enable OCaml bindings against current MCL 22-282

Andreas Tille (@tille) gitlab at salsa.debian.org
Wed Sep 23 09:02:48 BST 2026



Andreas Tille pushed to branch master at Debian Med / mcl


Commits:
1c2d75fd by Andreas Tille at 2026-09-22T19:11:37+02:00
Re-enable OCaml bindings against current MCL 22-282

The OCaml bindings (OCamlSupport.patch) were previously only built
against MCL 14 in the separate mcl14 package because they were assumed
unportable to newer MCL.  The C stub caml_mcl.c is in fact source
compatible with MCL 22-282 (the mclv/mclx type names are kept as
#define aliases), so the bindings can be built against the current MCL.

Ship them again in the new binary package libmcl-ocaml-dev and restore
the OCaml build tooling (dh-ocaml, ocaml, ocamlbuild, ocaml-findlib,
oasis).  These bindings are used by pplacer (guppy mcl / guppy
compress --mcl); the mcl14 fork can now be dropped.

- - - - -
62cc72ae by Andreas Tille at 2026-09-22T19:13:13+02:00
Remove stray usr/local files produced by the OCaml build

The OASIS/ocamlbuild build can drop files under usr/local; mcl14 used the
same override for its libmcl14-ocaml-dev package.

- - - - -
db078ace by Andreas Tille at 2026-09-22T21:22:53+02:00
Build the OCaml bindings directly with ocamlmklib instead of OASIS

The OASIS-generated ocamlbuild plugin cannot link the bindings against
current MCL 22-282: its caml/libmcl_stubs.clib lists object files that no
longer exist (src/mcl/shadow.o, util/*.o; the util/ code moved into the
external tINGea library), and the archives it would produce do not link
tINGea, so native clients such as pplacer (guppy) would not link.

The bindings are now built directly in debian/caml.mk with ocamlmklib
against the MCL static libraries built by make(1) (libmcl.a, libclew.a,
libgryphon.a, libimpala.a).  ocamlmklib links tINGea into the C stubs
(dllmcl_stubs.so) and records -cclib -lmcl_stubs -ltingea -lm in
mcl.cma/mcl.cmxa, so native clients link against libtingea automatically.
caml/META no longer references the mcl.cmxs plugin archive.

- - - - -
b2e17e05 by Andreas Tille at 2026-09-22T21:45:05+02:00
Build the mcl C objects with -fPIC

The OCaml bindings (debian/caml.mk) link the mcl objects into the shared
library dllmcl_stubs.so.  The Debian default CFLAGS do not include -fPIC,
so the shared link failed with:

  src/impala/tab.o: relocation R_X86_64_PC32 against symbol 'stderr'
  can not be used when making a shared object; recompile with -fPIC

Append -fPIC to CFLAGS via DEB_CFLAGS_APPEND, keeping the hardening flags.

- - - - -
0111f612 by Andreas Tille at 2026-09-22T22:13:43+02:00
Make sure all relevant files will be installed

- - - - -
a18ddf7b by Andreas Tille at 2026-09-23T09:41:15+02:00
Install OCaml findlib package into versioned multiarch stdlib dir

Since the OCaml 5.4 transition the findlib search path no longer
contains /usr/lib/ocaml, so clients such as pplacer failed with
"ocamlfind: Package 'mcl' not found".  Turn libmcl-ocaml-dev.install
into a dh-exec .install.in template that places the package into
@OCamlStdlibDir at .  Also install mcl.a alongside mcl.cmxa (fixes lintian
ocaml-dangling-cmxa).

- - - - -
47f23e37 by Andreas Tille at 2026-09-23T10:01:59+02:00
Be less verbose in d/changelog

- - - - -


8 changed files:

- + debian/caml.mk
- debian/changelog
- debian/control
- − debian/libmcl-ocaml-dev.install
- + debian/libmcl-ocaml-dev.install.in
- debian/patches/OCamlSupport.patch
- debian/patches/series
- debian/rules


Changes:

=====================================
debian/caml.mk
=====================================
@@ -0,0 +1,31 @@
+# Build the OCaml bindings against the current MCL C library.
+#
+# OASIS is no longer used to build the bindings: its generated ocamlbuild
+# plugin cannot link them against current MCL.  The committed
+# caml/libmcl_stubs.clib lists objects (src/mcl/shadow.o, util/*.o) that no
+# longer exist in MCL 22-282 (the util/ code moved into the external tINGea
+# library and shadow.c was removed), and the bytecode/native archives it
+# produces would not link the external tINGea library for native clients.
+#
+# The bindings are therefore built directly with ocamlmklib against the
+# static libraries produced by the main make(1) build (libmcl.a, libclew.a,
+# libgryphon.a, libimpala.a).  ocamlmklib links tINGea into the C stubs
+# (dllmcl_stubs.so) and records -cclib -lmcl_stubs -ltingea -lm in
+# mcl.cma/mcl.cmxa, so that native clients such as pplacer (guppy) link
+# against libtingea automatically.
+
+CAMLC      ?= ocamlc
+OCAMLMKLIB ?= ocamlmklib
+
+OCAMLFLAGS = -ccopt -fPIC -ccopt -std=c99 -ccopt -I. -ccopt -Isrc -ccopt -Isrc/mcl
+MCL_OBJS   = $(wildcard src/clew/*.o src/gryphon/*.o src/impala/*.o src/mcl/*.o)
+
+.PHONY: all clean
+
+all:
+	$(CAMLC) -c $(OCAMLFLAGS) -o caml/caml_mcl.o caml/caml_mcl.c
+	$(OCAMLMKLIB) -o mcl -oc mcl_stubs caml/mcl.ml caml/caml_mcl.o $(MCL_OBJS) -ltingea -lm
+
+clean:
+	rm -f caml/caml_mcl.o mcl.cma mcl.cmxa mcl.cmi mcl.cmo mcl.cmx mcl.o mcl.a \
+	      libmcl_stubs.a dllmcl_stubs.so


=====================================
debian/changelog
=====================================
@@ -1,3 +1,14 @@
+mcl (1:22-282+ds-5) UNRELEASED; urgency=medium
+
+  * Re-enable OCaml bindings for the current MCL version and ship them in
+    the new binary package libmcl-ocaml-dev.
+  * Build the bindings without OASIS
+  * Install the OCaml findlib package into the versioned multiarch OCaml
+    stdlib directory (@OCamlStdlibDir@) instead of the hardcoded
+    /usr/lib/ocaml
+
+ -- Andreas Tille <tille at debian.org>  Mon, 21 Sep 2026 00:00:00 +0200
+
 mcl (1:22-282+ds-4) unstable; urgency=medium
 
   * Build-Depends: architecture-is-64-bit since it does not build on 32bit


=====================================
debian/control
=====================================
@@ -6,14 +6,14 @@ Section: math
 Priority: optional
 Build-Depends: debhelper-compat (= 13),
                architecture-is-64-bit,
-#               dh-ocaml,
+               dh-ocaml,
                zoem,
                tidy,
                aephea,
-#               ocaml,
-#               ocamlbuild,
-#               ocaml-findlib,
-#               oasis,
+               ocaml,
+               ocamlbuild,
+               ocaml-findlib,
+               oasis,
                bsdextrautils,
                dh-exec,
                libtingea-dev
@@ -51,3 +51,22 @@ Description: documentation for mcl
  .
  This is documentation for mcl: the MCL FAQ, some examples as well as manpages
  in HTML and PostScript format.
+
+Package: libmcl-ocaml-dev
+Architecture: any
+Section: ocaml
+Depends: ocaml-findlib,
+         mcl,
+         ${ocaml:Depends},
+         ${shlibs:Depends},
+         ${misc:Depends}
+Provides: ${ocaml:Provides}
+Description: library providing bindings between mcl and OCaml
+ The MCL package is an implementation of the MCL algorithm, and offers
+ utilities for manipulating sparse matrices (the essential data
+ structure in the MCL algorithm) and conducting cluster experiments.
+ .
+ This library provides bindings between mcl and OCaml.
+ .
+ It is used by pplacer for the "guppy mcl" subcommand and the "--mcl"
+ option of "guppy compress".


=====================================
debian/libmcl-ocaml-dev.install deleted
=====================================
@@ -1,4 +0,0 @@
-#!/usr/bin/dh-exec
-_build/caml/* usr/lib/ocaml
-caml/META usr/lib/ocaml/mcl
-src/*/*.a usr/lib/${DEB_HOST_MULTIARCH}


=====================================
debian/libmcl-ocaml-dev.install.in
=====================================
@@ -0,0 +1,9 @@
+#!/usr/bin/dh-exec
+mcl.cma @OCamlStdlibDir@/mcl
+mcl.cmxa @OCamlStdlibDir@/mcl
+mcl.a @OCamlStdlibDir@/mcl
+caml/mcl.cmi @OCamlStdlibDir@/mcl
+libmcl_stubs.a @OCamlStdlibDir@/mcl
+dllmcl_stubs.so @OCamlStdlibDir@/mcl
+caml/META @OCamlStdlibDir@/mcl
+src/*/*.a usr/lib/${DEB_HOST_MULTIARCH}


=====================================
debian/patches/OCamlSupport.patch
=====================================
@@ -4,7 +4,6 @@ Author: Shayan Doust <hello at shayandoust.me>
 Last-Update: 2020-06-02
 Origin: https://github.com/fhcrc/mcl
 
----
 --- /dev/null
 +++ b/_oasis
 @@ -0,0 +1,18 @@
@@ -28,18 +27,12 @@ Origin: https://github.com/fhcrc/mcl
 +  XMETAExtraLines: directory = "^"
 --- /dev/null
 +++ b/caml/META
-@@ -0,0 +1,11 @@
-+# OASIS_START
-+# DO NOT EDIT (digest: 95143524787fc999afaa0c2316c53ab8)
-+version = "12-068~oasis4"
+@@ -0,0 +1,5 @@
++version = "22-282"
 +description = "Graph clustering by flow simulation"
 +archive(byte) = "mcl.cma"
-+archive(byte, plugin) = "mcl.cma"
 +archive(native) = "mcl.cmxa"
-+archive(native, plugin) = "mcl.cmxs"
 +exists_if = "mcl.cma"
-+# OASIS_STOP
-+
 --- /dev/null
 +++ b/caml/caml_mcl.c
 @@ -0,0 +1,76 @@


=====================================
debian/patches/series
=====================================
@@ -1,4 +1,4 @@
-# OCamlSupport.patch
+OCamlSupport.patch
 02-wrong-interpreter-path.patch
 05-manual-what-is.patch
 spelling.patch


=====================================
debian/rules
=====================================
@@ -5,6 +5,10 @@
 
 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
 
+# MCL objects must be position-independent so that the OCaml bindings can be
+# linked into the shared library dllmcl_stubs.so (see debian/caml.mk).
+export DEB_CFLAGS_MAINT_APPEND = -fPIC
+
 # allow bashism's in commandlines
 SHELL = /bin/bash
 
@@ -60,7 +64,7 @@ confflags += --enable-blast
 docbackupdir:=$(CURDIR)/debian/doc.bak
 
 %:
-	dh $@
+	dh $@ --with ocaml
 
 override_dh_clean:
 	dh_clean
@@ -70,13 +74,16 @@ override_dh_clean:
 	rm -rf src/alien/oxygen/doc/*.1 src/alien/oxygen/doc/*.html src/alien/oxygen/doc/*.ps
 	if [ -d $(docbackupdir) ] ; then mv $(docbackupdir)/*.txt doc/ ; rm -rf $(docbackupdir) ; fi
 
-#override_dh_auto_build:
-#	#dh_auto_build
-#	autoreconf --install
-#	oasis setup
-#	ocaml setup.ml -all
+override_dh_auto_build:
+	dh_auto_build
+	$(MAKE) -f debian/caml.mk
+
+override_dh_auto_clean:
+	dh_auto_clean
+	$(MAKE) -f debian/caml.mk clean
 
 override_dh_auto_configure:
+	autoreconf --install
 	mkdir -p $(docbackupdir)
 	cp -a doc/mcl*.txt $(docbackupdir)
 	dh_auto_configure -- $(confflags)
@@ -92,3 +99,7 @@ override_dh_missing:
 	rm -f debian/tmp/usr/share/doc/mcl/*.html \
 	      debian/tmp/usr/share/doc/mcl/*.ps
 	dh_missing
+
+override_dh_usrlocal:
+	rm -rf debian/libmcl-ocaml-dev/usr/local
+	dh_usrlocal



View it on GitLab: https://salsa.debian.org/med-team/mcl/-/compare/8e1c4525c3869854c20070a3a0c6c5e091ddf912...47f23e3757c7f14cae66a28ce9762a910a037ee7

-- 
View it on GitLab: https://salsa.debian.org/med-team/mcl/-/compare/8e1c4525c3869854c20070a3a0c6c5e091ddf912...47f23e3757c7f14cae66a28ce9762a910a037ee7
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20260923/21eb6034/attachment-0001.htm>


More information about the debian-med-commit mailing list