3fc58c8fb6
These are needed to get OCaml 5 to work.
125 lines
5.4 KiB
Diff
125 lines
5.4 KiB
Diff
From b778c56443e11817d4974dcab5356e2d4065980b Mon Sep 17 00:00:00 2001
|
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
Date: Wed, 21 Jun 2023 18:56:58 +0100
|
|
Subject: [PATCH 07/15] ocaml: Add -I +unix before using unix.cmxa
|
|
|
|
In OCaml 5.0 you will see this warning:
|
|
|
|
Alert ocaml_deprecated_auto_include:
|
|
OCaml's lib directory layout changed in 5.0. The unix subdirectory has been
|
|
automatically added to the search path, but you should add -I +unix to the
|
|
command-line to silence this alert (e.g. by adding unix to the list of
|
|
libraries in your dune file, or adding use_unix to your _tags file for
|
|
ocamlbuild, or using -package unix for ocamlfind).
|
|
|
|
Using -I +unix doesn't hurt earlier versions, as the directory is just
|
|
ignored if it doesn't exist, and anyway findlib adds the directory if
|
|
you're using that.
|
|
---
|
|
plugins/cc/nbdkit-cc-plugin.pod | 4 ++--
|
|
plugins/ocaml/nbdkit-ocaml-plugin.pod | 2 +-
|
|
plugins/ocaml/Makefile.am | 2 +-
|
|
tests/Makefile.am | 4 ++--
|
|
tests/test-cc-ocaml.sh | 2 +-
|
|
tests/cc_shebang.ml | 2 +-
|
|
6 files changed, 8 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/plugins/cc/nbdkit-cc-plugin.pod b/plugins/cc/nbdkit-cc-plugin.pod
|
|
index 412233797..f55f74ab0 100644
|
|
--- a/plugins/cc/nbdkit-cc-plugin.pod
|
|
+++ b/plugins/cc/nbdkit-cc-plugin.pod
|
|
@@ -89,7 +89,7 @@ C<CC=g++> as a parameter to exec nbdkit.
|
|
=head2 Using this plugin with OCaml
|
|
|
|
nbdkit cc CC=ocamlopt \
|
|
- CFLAGS="-output-obj -runtime-variant _pic unix.cmxa NBDKit.cmx -cclib -lnbdkitocaml" \
|
|
+ CFLAGS="-output-obj -runtime-variant _pic -I +unix unix.cmxa NBDKit.cmx -cclib -lnbdkitocaml" \
|
|
source.ml
|
|
|
|
OCaml plugin scripts can be created using this trick:
|
|
@@ -97,7 +97,7 @@ OCaml plugin scripts can be created using this trick:
|
|
(*/.)>/dev/null 2>&1
|
|
exec nbdkit cc "$0" \
|
|
CC=ocamlopt \
|
|
- CFLAGS="-output-obj -runtime-variant _pic unix.cmxa NBDKit.cmx -cclib -lnbdkitocaml" \
|
|
+ CFLAGS="-output-obj -runtime-variant _pic -I +unix unix.cmxa NBDKit.cmx -cclib -lnbdkitocaml" \
|
|
"$@"
|
|
*)
|
|
(* followed by OCaml code for the plugin here *)
|
|
diff --git a/plugins/ocaml/nbdkit-ocaml-plugin.pod b/plugins/ocaml/nbdkit-ocaml-plugin.pod
|
|
index dc8260174..e4a8cf0b0 100644
|
|
--- a/plugins/ocaml/nbdkit-ocaml-plugin.pod
|
|
+++ b/plugins/ocaml/nbdkit-ocaml-plugin.pod
|
|
@@ -53,7 +53,7 @@ using this command:
|
|
|
|
ocamlopt.opt -output-obj -runtime-variant _pic \
|
|
-o nbdkit-myplugin-plugin.so \
|
|
- unix.cmxa NBDKit.cmx myplugin.ml \
|
|
+ -I +unix unix.cmxa NBDKit.cmx myplugin.ml \
|
|
-cclib -lnbdkitocaml
|
|
|
|
You can then use C<nbdkit-myplugin-plugin.so> as an nbdkit plugin (see
|
|
diff --git a/plugins/ocaml/Makefile.am b/plugins/ocaml/Makefile.am
|
|
index da1b1ec96..e7faae506 100644
|
|
--- a/plugins/ocaml/Makefile.am
|
|
+++ b/plugins/ocaml/Makefile.am
|
|
@@ -84,7 +84,7 @@ noinst_SCRIPTS = nbdkit-ocamlexample-plugin.so
|
|
nbdkit-ocamlexample-plugin.so: example.cmx libnbdkitocaml.la NBDKit.cmi NBDKit.cmx
|
|
$(OCAMLOPT) $(OCAMLOPTFLAGS) \
|
|
-output-obj -runtime-variant _pic -o $@ \
|
|
- unix.cmxa NBDKit.cmx $< \
|
|
+ -I +unix unix.cmxa NBDKit.cmx $< \
|
|
-cclib -L.libs -cclib -lnbdkitocaml
|
|
example.cmx: example.ml NBDKit.cmi NBDKit.cmx
|
|
$(OCAMLOPT) $(OCAMLOPTFLAGS) -c $< -o $@
|
|
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
index f2912aa93..d8a640e1e 100644
|
|
--- a/tests/Makefile.am
|
|
+++ b/tests/Makefile.am
|
|
@@ -1185,7 +1185,7 @@ OCAML_PLUGIN_DEPS = \
|
|
test-ocaml-plugin.so: test_ocaml_plugin.cmx $(OCAML_PLUGIN_DEPS)
|
|
$(OCAMLOPT) $(OCAMLOPTFLAGS) -I ../plugins/ocaml \
|
|
-output-obj -runtime-variant _pic -o $@ \
|
|
- unix.cmxa NBDKit.cmx $< \
|
|
+ -I +unix unix.cmxa NBDKit.cmx $< \
|
|
-cclib -L../plugins/ocaml/.libs -cclib -lnbdkitocaml
|
|
test_ocaml_plugin.cmx: test_ocaml_plugin.ml $(OCAML_PLUGIN_DEPS)
|
|
$(OCAMLOPT) $(OCAMLOPTFLAGS) -I ../plugins/ocaml -c $< -o $@
|
|
@@ -1194,7 +1194,7 @@ test-ocaml-errorcodes-plugin.so: \
|
|
test_ocaml_errorcodes_plugin.cmx $(OCAML_PLUGIN_DEPS)
|
|
$(OCAMLOPT) $(OCAMLOPTFLAGS) -I ../plugins/ocaml \
|
|
-output-obj -runtime-variant _pic -o $@ \
|
|
- unix.cmxa NBDKit.cmx $< \
|
|
+ -I +unix unix.cmxa NBDKit.cmx $< \
|
|
-cclib -L../plugins/ocaml/.libs -cclib -lnbdkitocaml
|
|
test_ocaml_errorcodes_plugin.cmx: \
|
|
test_ocaml_errorcodes_plugin.ml $(OCAML_PLUGIN_DEPS)
|
|
diff --git a/tests/test-cc-ocaml.sh b/tests/test-cc-ocaml.sh
|
|
index 659fa195e..3b4f6a553 100755
|
|
--- a/tests/test-cc-ocaml.sh
|
|
+++ b/tests/test-cc-ocaml.sh
|
|
@@ -61,6 +61,6 @@ cleanup_fn rm -f $out
|
|
rm -f $out
|
|
|
|
nbdkit -U - cc $script a=1 b=2 c=3 d=4 \
|
|
- CC="$OCAMLOPT" CFLAGS="-output-obj -runtime-variant _pic -I $SRCDIR/../plugins/ocaml unix.cmxa NBDKit.cmx -cclib -lnbdkitocaml" \
|
|
+ CC="$OCAMLOPT" CFLAGS="-output-obj -runtime-variant _pic -I $SRCDIR/../plugins/ocaml -I +unix unix.cmxa NBDKit.cmx -cclib -lnbdkitocaml" \
|
|
--run 'nbdinfo --size $uri' > $out
|
|
test "$(cat $out)" -eq $((512 * 2048))
|
|
diff --git a/tests/cc_shebang.ml b/tests/cc_shebang.ml
|
|
index d78d76618..619b08bb5 100755
|
|
--- a/tests/cc_shebang.ml
|
|
+++ b/tests/cc_shebang.ml
|
|
@@ -4,7 +4,7 @@
|
|
# shell as an impossible command which is ignored. The line below is
|
|
# run by the shell and ignored by OCaml.
|
|
|
|
-exec nbdkit cc "$0" CC=ocamlopt CFLAGS="-output-obj -runtime-variant _pic unix.cmxa NBDKit.cmx -cclib -lnbdkitocaml" "$@"
|
|
+exec nbdkit cc "$0" CC=ocamlopt CFLAGS="-output-obj -runtime-variant _pic -I +unix unix.cmxa NBDKit.cmx -cclib -lnbdkitocaml" "$@"
|
|
*)
|
|
|
|
open Printf
|
|
--
|
|
2.41.0
|
|
|