@@ -40,6 +40,8 @@ OCAMLRUN=$(shell which ocamlrun)
4040OCAMLRUND =$(shell which ocamlrund)
4141OCAMLRUNI =$(shell which ocamlruni)
4242OCAMLYACC =$(shell which ocamlyacc)
43+ OCAML_VERSION_MAJOR =$(shell echo $(MAKECONF_OCAML_VERSION ) | cut -d. -f1)
44+ OCAML_VERSION_MINOR =$(shell echo $(MAKECONF_OCAML_VERSION ) | cut -d. -f2)
4345ocaml/Makefile.config : ocaml/Makefile esperanto_sys.c
4446# configure: Use /usr/bin/cpp instead of /lib/cpp
4547 sed -e 's/\/lib\/cpp/\/usr\/bin\/cpp/g' ocaml/configure > ocaml/configure.sed
@@ -88,7 +90,7 @@ ocaml/Makefile.config: ocaml/Makefile esperanto_sys.c
8890 cat esperanto_systhreads_signals.c >> ocaml/otherlibs/systhreads/st_posix.h
8991 cat esperanto_termios.c >> ocaml/otherlibs/unix/termios.c
9092 patch ocaml/otherlibs/unix/gethost.c esperanto_gethost.patch
91- patch ocaml/otherlibs/unix/socketaddr.c esperanto_socketaddr.$(MAKECONF_OCAML_VERSION ).patch
93+ patch ocaml/otherlibs/unix/socketaddr.c esperanto_socketaddr.$(OCAML_VERSION_MAJOR).$(OCAML_VERSION_MINOR ).patch
9294# We must comment [alloc], [callback] and [flush] which are `#define` by Cosmopolitan
9395 sed -e '/ alloc /s/^/\/\//' ocaml/runtime/caml/compatibility.h > ocaml/runtime/caml/compatibility.h.sed
9496 mv ocaml/runtime/caml/compatibility.h.sed ocaml/runtime/caml/compatibility.h
@@ -103,7 +105,8 @@ ocaml/Makefile.config: ocaml/Makefile esperanto_sys.c
103105 printf "ocamlruni:\n\tcp $(OCAMLRUNI) .\n" >> ocaml/runtime/Makefile
104106 touch ocaml/runtime/libcamlrun.a ocaml/runtime/libcamlrund.a ocaml/runtime/libcamlruni.a
105107# Comment a CAML_STATIC_ASSERT which emits warnings ("variably modified 'static_assertion_failure_line_XX'")
106- @if [ "$(MAKECONF_OCAML_VERSION)" = "4.14.0" -o "$(MAKECONF_OCAML_VERSION)" = "4.14.1" ] ; then \
108+ # for >= OCaml 4.14 & then < OCaml 4.14
109+ @if [ "$(OCAML_VERSION_MAJOR)" -ge "4" -a "$(OCAML_VERSION_MINOR)" -ge "14" ] ; then \
107110 sed -e "56,58 s/^/\/\//" ocaml/runtime/caml/domain_state.h > ocaml/runtime/caml/domain_state.h.sed; \
108111 mv ocaml/runtime/caml/domain_state.h.sed ocaml/runtime/caml/domain_state.h; \
109112 else \
0 commit comments