Christopher Zimmermann <chr...@openbsd.org> writes:
>
> If you add ONLY_FOR_ARCHS=${OCAML_NATIVE_DYNLINK_ARCHS}, then ok chrisz@
>
> But please do try and test non-native builds. Clearing 
> OCAML_NATIVE_ARCHS and OCAML_NATIVE_DYNLINK_ARCHS in 
> /usr/ports/infrastructure/mk/arch-defines.mk will allow you to build all 
> ocaml ports bytecode only on any architecture.
>

For now, I am playing the following diff. It adds a FLAVOR in lang/ocaml
and an option in lang/ocaml module.


diff --git a/lang/ocaml/Makefile b/lang/ocaml/Makefile
index 37e85763fa..91f93ac26e 100644
--- a/lang/ocaml/Makefile
+++ b/lang/ocaml/Makefile
@@ -11,14 +11,9 @@
 USE_NOBTCFI =  Yes
 
 # It's possible to check PLISTs for non-native archs from a
-# native arch. To do so on amd64, edit:
-#
-#      /usr/ports/infrastructure/mk/arch-defines.mk
-#
-# and remove "amd64" from OCAML_NATIVE_ARCHS. Then:
-#
-# $ make clean=all
-# $ make package
+# native arch. To do so use bytecode flavor:
+#
+# $ env FLAVOR=bytecode make repackage
 #
 # and check if packaging worked.
 
@@ -42,6 +37,9 @@
 
 .include <bsd.port.arch.mk>
 
+FLAVOR ?=
+FLAVORS =      bytecode
+
 # XXX: cannot run autoconf due to use of gnu m4 feature
 # that isn't in base m4
 CONFIGURE_STYLE =      gnu
@@ -66,7 +64,7 @@
 
 WANTLIB =              c m pthread
 
-.if ${PROPERTIES:Mocaml_native}
+.if !${FLAVOR:Mbytecode} && ${PROPERTIES:Mocaml_native}
 ALL_TARGET=    world.opt
 PKG_ARGS +=    -Dnative=1
 
diff --git a/lang/ocaml/ocaml.port.mk b/lang/ocaml/ocaml.port.mk
index 593b390715..225182c6c0 100644
--- a/lang/ocaml/ocaml.port.mk
+++ b/lang/ocaml/ocaml.port.mk
@@ -9,7 +9,9 @@
 
 .include <bsd.port.arch.mk>
 
-.if ${PROPERTIES:Mocaml_native}
+MODOCAML_FORCE_BYTECODE ?= No
+
+.if ${MODOCAML_FORCE_BYTECODE:L} == no && ${PROPERTIES:Mocaml_native}
 MODOCAML_NATIVE=Yes
 # include nativecode base files
 PKG_ARGS+=     -Dnative=1
@@ -20,7 +22,7 @@
 PKG_ARGS+=-Dnative=0
 .endif
 
-.if ${PROPERTIES:Mocaml_native_dynlink}
+.if ${MODOCAML_FORCE_BYTECODE:L} == no && ${PROPERTIES:Mocaml_native_dynlink}
 MODOCAML_NATDYNLINK=Yes
 MODOCAML_OCAMLDOC?=ocamldoc.opt
 # include native dynlink base files




With it, I could confirm that textproc/slipshow didn't build on
no-native due to (modes native) dune option used. But I think keeping
ONLY_FOR_ARCHS=${OCAML_NATIVE_DYNLINK_ARCHS} is fine, as else it might
need lot of dependencies in ${LOCALBASE}/lib/ocaml.


Regards.
-- 
Sebastien Marie

Reply via email to