66.7. ocaml-facile-1.1.4
Constraint programming library for OCaml, the solver behind Kalzium's equation balancer
| Version | 1.1.4, release 1 |
| Shelf | lang — Language implementations, plus the modules of any language that has no module shelf of its own |
| Phase | 40_lang (Languages), 50 of 186 in build order |
| Licence | LGPL-2.1-or-later |
| Homepage | https://github.com/Emmanuel-PLF/facile |
| Build time | 0.1 SBU |
| Installed size | 2.2 MiB in 83 files |
| Recipe | ports/core/lang/ocaml-facile/kpkgbuild |
About
FaCiLe is a constraint programming library for OCaml: finite-domain variables, constraints over them and search goals. KDOS carries it for one consumer, kalzium, whose chemical equation balancer is written in OCaml against it; kalzium’s build requires it (CMAKE_REQUIRE_FIND_PACKAGE_Libfacile=ON).
Sources
ocaml-facile-1.1.4.tar.bz2(81.9 KiB)
sha2565712a00802c525d19fb59b7800ffd9d3f7ca08ee9cd295b3905b64676ce5194b
upstream: https://github.com/Emmanuel-PLF/facile/releases/download/1.1.4/facile-1.1.4.tbz
archive copy: sources-3/lang--ocaml-facile-1.1.4.tar.bz2
Dependencies
Depends on: ocaml.
Required by (1): kalzium.
Patches
build.sh applies these; kpkg applies nothing by itself.
ocaml5-stdlib.patch— Replaces every use of thePervasivesmodule in five of the library’s sources (fcl_cstr.ml,fcl_fdArray.ml,fcl_misc.ml,fcl_nonlinear.ml,fcl_sorting.ml) withStdlib, the same module under the name OCaml 5 keeps. OCaml 5 has noPervasives, so the library does not compile against the ocaml port without it.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/40_lang/phase.env && kpkg install ocaml-facile'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/lang/ocaml-facile.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/lang/ocaml-facile
echo '5712a00802c525d19fb59b7800ffd9d3f7ca08ee9cd295b3905b64676ce5194b ocaml-facile-1.1.4.tar.bz2' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/ocaml-facile
SRC=$SRC_ROOT/ocaml-facile-1.1.4
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf ocaml-facile-1.1.4.tar.bz2 -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/ocaml5-stdlib.patch"
make -C lib facile.cma facile.cmxa
_dest="$PKG$(ocamlc -where)/facile"
install -d "$_dest"
install -m644 lib/facile.cma lib/facile.cmxa lib/facile.a \
lib/*.cmi lib/*.cmx lib/*.mli "$_dest"/
cat > "$_dest/META" <<META
version = "$version"
description = "Constraint programming library"
archive(byte) = "facile.cma"
archive(native) = "facile.cmxa"
META
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/ocaml-facile, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf ocaml-facile-1.1.4-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/ocaml-facile, and runs the triggers its paths call for.
Contents
Installed directories: /usr/lib/ocaml/facile, /usr/share/licenses/ocaml-facile.
Notes
The release describes its dune build in jbuild files, a format current dune does not read, and the tree has no dune port. The library is built with the plain Makefile in lib/ instead, which compiles the same modules; make -C lib facile.cma facile.cmxa builds the bytecode and native libraries and leaves out the facile toplevel that its default target also makes.
The files go where kalzium’s FindLibfacile.cmake looks: facile.a and facile.cmi under $(ocamlc -where)/facile, that is /usr/lib/ocaml/facile. build.sh also writes a findlib META file there, naming the bytecode and native archives.