git: 4c90e1b3af44 - main - math/coq: force unsafe strings to unbreak against modern OCaml.

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Sun, 10 Apr 2022 18:28:17 UTC
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4c90e1b3af44ccf4d88df788767754e27c80366b

commit 4c90e1b3af44ccf4d88df788767754e27c80366b
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2022-04-10 18:27:14 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2022-04-10 18:27:14 +0000

    math/coq: force unsafe strings to unbreak against modern OCaml.
---
 math/coq/Makefile                   |  9 ++++++---
 math/coq/files/patch-Makefile.build | 20 +++++++++++++++++++-
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/math/coq/Makefile b/math/coq/Makefile
index 8e85c3b8dcf2..dd9757d6e5c1 100644
--- a/math/coq/Makefile
+++ b/math/coq/Makefile
@@ -33,7 +33,7 @@ CONFIGURE_ARGS=	-prefix ${PREFIX} \
 		-emacslib ${PREFIX}/share/emacs/site-lisp/coq \
 		-usecamlp5 \
 		-byteonly
-MAKE_ENV=	VERBOSE=1
+MAKE_ENV=	VERBOSE=1 USERFLAGS=-unsafe-string
 ALL_TARGET=	world
 
 CONFLICTS_INSTALL=	coq coq-emacs_* # bin/coq-tex bin/coq_makefile bin/coqc bin/coqchk bin/coqdep bin/coqdoc bin/coqide bin/coqmktop bin/coqtop bin/coqtop.byte bin/coqwc bin/coqworkmgr bin/gallina
@@ -56,8 +56,11 @@ add-plist-post:
 	@${DO_NADA}
 
 post-patch:
-	${REINPLACE_CMD} -e '/show_latex_mes/s/)$$/; true)/' \
-	    ${WRKSRC}/Makefile.doc
+	@${REINPLACE_CMD} -e '/show_latex_mes/s/)$$/; true)/' \
+		${WRKSRC}/Makefile.doc
+# Allow passing USERFLAGS down to inner make(1) via environment
+	@${REINPLACE_CMD} -e '/User compilation flag/,+1d' \
+		${WRKSRC}/configure.ml
 
 post-install:
 	cd ${STAGEDIR}${PREFIX} && ${STRIP_CMD} ${STRIP_FILES}
diff --git a/math/coq/files/patch-Makefile.build b/math/coq/files/patch-Makefile.build
index b66ed54c2c10..15fa789877ed 100644
--- a/math/coq/files/patch-Makefile.build
+++ b/math/coq/files/patch-Makefile.build
@@ -1,6 +1,6 @@
 --- Makefile.build.orig	2016-12-08 15:13:52 UTC
 +++ Makefile.build
-@@ -101,7 +101,7 @@ TIMER=$(if $(TIMED), $(STDTIME), $(TIMEC
+@@ -101,7 +101,7 @@ TIMER=$(if $(TIMED), $(STDTIME), $(TIMECMD))
  #   TIME="%C (%U user, %S sys, %e total, %M maxres)"
  
  COQOPTS=$(COQ_XML) $(NATIVECOMPUTE)
@@ -9,3 +9,21 @@
  
  LOCALINCLUDES=$(addprefix -I , $(SRCDIRS) )
  MLINCLUDES=$(LOCALINCLUDES) -I $(MYCAMLP4LIB)
+@@ -334,7 +334,7 @@ coqbinaries: $(COQMKTOP) $(COQTOPEXE) $(COQTOPBYTE) \
+ ifeq ($(BEST),opt)
+ $(COQTOPEXE): $(COQMKTOP) $(LINKCMX) $(LIBCOQRUN) $(TOPLOOPCMA:.cma=.cmxs)
+ 	$(SHOW)'COQMKTOP -o $@'	
+-	$(HIDE)$(COQMKTOP) -boot -opt $(OPTFLAGS) $(LINKMETADATA) -o $@
++	$(HIDE)$(COQMKTOP) -boot -opt $(filter-out -unsafe-string, $(OPTFLAGS)) $(LINKMETADATA) -o $@
+ 	$(STRIP) $@
+ 	$(CODESIGN) $@
+ else
+@@ -344,7 +344,7 @@ endif
+ 
+ $(COQTOPBYTE): $(COQMKTOP) $(LINKCMO) $(LIBCOQRUN) $(TOPLOOPCMA)
+ 	$(SHOW)'COQMKTOP -o $@'	
+-	$(HIDE)$(COQMKTOP) -boot -top $(BYTEFLAGS) -o $@
++	$(HIDE)$(COQMKTOP) -boot -top $(filter-out -unsafe-string, $(BYTEFLAGS)) -o $@
+ 
+ # coqmktop
+