Rule in forester.compiler build is not portable (OpenBSD) #45

Closed kento.tngl.sh
Closed opened by kento.tngl.sh

The following dune rule in lib/compiler/dune is calling md5sum, which is unfortunately not part of the standard OpenBSD distribution apparently. There is a user on IRC trying to build on OpenBSD and it would be nice if we can support that. I wonder if there is another way to achieve what this is doing? And actually, I am a little unsure myself of what this is doing 😉

(rule
 (target Cache_version.ml)
 (deps
  (:types ../core/Types.ml)
  (:uri ../core/URI.ml)
  (:range ../core/Range.ml)
  (:xml_types ../xml_names/Types.ml))
 (action
  (with-stdout-to
   Cache_version.ml
   (system
    "printf 'let value = \"%s\"\\n' \"$(cat %{types} %{uri} %{range} %{xml_types} | md5sum | cut -c1-16)\""))))

I came up with this when implementing the json blob caching to guard against loading incompatible blobs. It creates an ocaml module

val value = <hash>

It is definitely overengineered. I will replace it with a simpler version that uses the same mechanism as the --version command.

Ha, nice solution.

Sign up or Sign in to add to the discussion.