On Thu, Jan 21 2021, Stuart Henderson <s...@spacehopper.org> wrote:
> On 2021/01/21 06:43, Bjorn Ketelaars wrote:
>> On Wed 20/01/2021 21:42, Jeremie Courreges-Anglas wrote:
>> > On Wed, Jan 20 2021, Bjorn Ketelaars <b...@openbsd.org> wrote:
>> > > (Maintainer timeout)
>> > >
>> > > ocaml is currently a RDEP for all ports that are build with it. This is
>> > > unnecessary for a couple of them, i.e. net/unison.
>> > 
>> > As far as I know, programs written in OCaml should run without the OCaml
>> > runtime installed on ${OCAML_NATIVE_ARCHS}, currently i386 and amd64.
>> > Except for OCaml programs that make direct use of the OCaml runtime, of
>> > course... But the rundep is still needed on non-native archs.
>> > 
>> > > I would like to
>> > > propose the addition of MODOCAML_RUNDEP and MODOCAML_BUILDDEP, which are
>> > > modelled on python.port.mk.
>> > >
>> > > Default behaviour is not changed. Setting MODOCAML_RUNDEP=No in a
>> > > Makefile excludes ocaml as RDEP.
>> > >
>> > > OK?
>> > 
>> > Your diff makes sense I think, but you can't just use it to
>> > disable the run-dep in net/unison: you'd break unison installs on
>> > non-native archs.
>> 
>> Oops, I didn't think about the above.
>> 
>> I will look further for a fitting, clean solution that serves all
>> arches.
>> 
>
> Maybe allow MODOCAML_RUNDEP=yes/no/nonative or some similar thing?

Hmm, so "nonative" would be for ports that produce bytecode-only
programs, even on native archs?  (No idea how many ports are affected.)
We could call it "bytecode" then, that would seem a bit more descriptive
than a plain MODOCAML_RUNDEP=Yes in a port Makefile.

And then MODOCAML_RUNDEP=Yes would be useful for ports that always
use lang/ocaml programs/files at runtime?

> It would be nice to handle the arch detection in ocaml.port.mk rather
> than in any port using this.

Here's the simple diff I had in mind yesterday, on top of Bjorn's diff.
It probably helps Bjorn with unison but it would require testing all
other OCaml programs, and bumping REVISION for a bunch of them.
Maybe not the easiest or safest approach.

I suspect that most people caring about OCaml in ports have thought
about this before, hopefully they can share their ideas. :)


Index: ocaml.port.mk
===================================================================
--- ocaml.port.mk.orig
+++ ocaml.port.mk
@@ -37,9 +37,15 @@ MODOCAML_RUN_DEPENDS=        lang/ocaml
 MODOCAML_BUILD_DEPENDS=        lang/ocaml
 
 # Assume that we want to automatically add ocaml to BUILD_DEPENDS
-# and RUN_DEPENDS unless the port specifically requests not to.
+# unless the port specifically requests not to.
+# Automatically add ocaml to RUN_DEPENDS on non-native archs
+# unless the port specifically requests not to.
 MODOCAML_BUILDDEP?=    Yes
+.if ${MODOCAML_NATIVE} == Yes
+MODOCAML_RUNDEP?=      No
+.else
 MODOCAML_RUNDEP?=      Yes
+.endif
 
 .if ${NO_BUILD:L} == no && ${MODOCAML_BUILDDEP:L} == yes
 BUILD_DEPENDS+=                ${MODOCAML_BUILD_DEPENDS}


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to