From 9043add656177eeac1491a73d2f3ab92bec0013c Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Sat, 29 Dec 2018 14:31:27 -0500 Subject: Imported Upstream version 8.8.2 --- dev/Bugzilla_Coq_autolink.user.js | 25 + dev/Coq_Bugzilla_autolink.user.js | 68 + dev/Makefile.oug | 74 -- dev/README | 38 +- dev/TODO | 22 - dev/base_db | 10 +- dev/base_include | 27 +- dev/bugzilla2github_stripped.csv | 501 ++++++++ dev/build/osx/make-macos-dmg.sh | 19 +- dev/build/windows/MakeCoq_84pl6_abs_ocaml.bat | 22 +- dev/build/windows/MakeCoq_85pl2_abs_ocaml.bat | 22 +- dev/build/windows/MakeCoq_85pl3_abs_ocaml.bat | 22 +- dev/build/windows/MakeCoq_85pl3_installer.bat | 22 +- dev/build/windows/MakeCoq_85pl3_installer_32.bat | 22 +- dev/build/windows/MakeCoq_86git_abs_ocaml.bat | 22 +- .../windows/MakeCoq_86git_abs_ocaml_gtksrc.bat | 22 +- dev/build/windows/MakeCoq_86git_installer.bat | 22 +- dev/build/windows/MakeCoq_86git_installer_32.bat | 22 +- .../windows/MakeCoq_86git_installer_cyglocal.bat | 27 + dev/build/windows/MakeCoq_88git_installer.bat | 27 + dev/build/windows/MakeCoq_MinGW.bat | 225 ++-- dev/build/windows/MakeCoq_SetRootPath.bat | 11 + .../MakeCoq_explicitcachefolders_installer.bat | 28 + dev/build/windows/MakeCoq_local_installer.bat | 26 + dev/build/windows/MakeCoq_regtest_noproxy.bat | 17 +- dev/build/windows/MakeCoq_regtests.bat | 42 +- dev/build/windows/MakeCoq_trunk_installer.bat | 26 + dev/build/windows/ReadMe.txt | 29 +- dev/build/windows/configure_profile.sh | 15 +- dev/build/windows/difftar-folder.sh | 63 +- dev/build/windows/makecoq_mingw.sh | 1141 +++++++++++++---- dev/build/windows/patches_coq/ReplaceInFile.nsh | 67 - dev/build/windows/patches_coq/StrRep.nsh | 60 - ...-86ac28259030649ef51460e4de2441c8a1017751.patch | 21 + dev/build/windows/patches_coq/coq_new.nsi | 191 ++- dev/build/windows/patches_coq/lablgtk-2.18.3.patch | 44 +- dev/build/windows/patches_coq/lablgtk-2.18.6.patch | 101 ++ dev/build/windows/patches_coq/ln.c | 2 +- .../windows/patches_coq/quickchick-v1.0.2.patch | 38 + .../windows/patches_coq/sed-4.2.2-3.src.patch | 1301 +++++++++++++++++++ dev/build/windows/patches_coq/sed-4.2.2.patch | 1301 +++++++++++++++++++ dev/ci/README.md | 176 +++ dev/ci/appveyor.bat | 42 + dev/ci/appveyor.sh | 15 + dev/ci/ci-basic-overlay.sh | 236 ++++ dev/ci/ci-bedrock2.sh | 9 + dev/ci/ci-bignums.sh | 8 + dev/ci/ci-color.sh | 8 + dev/ci/ci-common.sh | 123 ++ dev/ci/ci-compcert.sh | 9 + dev/ci/ci-coq-dpdgraph.sh | 8 + dev/ci/ci-coquelicot.sh | 11 + dev/ci/ci-corn.sh | 8 + dev/ci/ci-cpdt.sh | 9 + dev/ci/ci-elpi.sh | 9 + dev/ci/ci-equations.sh | 9 + dev/ci/ci-ext-lib.sh | 8 + dev/ci/ci-fcsl-pcm.sh | 10 + dev/ci/ci-fiat-crypto-legacy.sh | 13 + dev/ci/ci-fiat-crypto.sh | 14 + dev/ci/ci-fiat-parsers.sh | 9 + dev/ci/ci-flocq.sh | 8 + dev/ci/ci-formal-topology.sh | 8 + dev/ci/ci-geocoq.sh | 10 + dev/ci/ci-hott.sh | 8 + dev/ci/ci-iris-lambda-rust.sh | 30 + dev/ci/ci-ltac2.sh | 8 + dev/ci/ci-math-classes.sh | 8 + dev/ci/ci-math-comp.sh | 12 + dev/ci/ci-mtac2.sh | 12 + dev/ci/ci-quickchick.sh | 10 + dev/ci/ci-sf.sh | 18 + dev/ci/ci-simple-io.sh | 9 + dev/ci/ci-tlc.sh | 9 + dev/ci/ci-unimath.sh | 8 + dev/ci/ci-vst.sh | 8 + dev/ci/ci-wrapper.sh | 27 + dev/ci/docker/bionic_coq/Dockerfile | 59 + dev/ci/gitlab.bat | 131 ++ .../user-overlays/00669-maximedenes-ssr-merge.sh | 4 + dev/ci/user-overlays/README.md | 31 + dev/core.dbg | 20 + dev/db | 96 +- dev/db_printers.ml | 16 - dev/doc/COMPATIBILITY | 201 +++ dev/doc/build-system.dev.txt | 22 +- dev/doc/build-system.txt | 8 +- dev/doc/changes.md | 1316 ++++++++++++++++++++ dev/doc/changes.txt | 1095 ---------------- dev/doc/cic.dtd | 2 +- dev/doc/coq-src-description.txt | 7 +- dev/doc/debugging.md | 106 ++ dev/doc/debugging.txt | 78 -- dev/doc/econstr.md | 129 ++ dev/doc/naming-conventions.tex | 2 +- dev/doc/notes-on-conversion | 73 -- dev/doc/notes-on-conversion.v | 73 ++ dev/doc/primproj.md | 41 + dev/doc/profiling.txt | 2 +- dev/doc/proof-engine.md | 133 ++ dev/doc/setup.txt | 40 +- dev/doc/style.txt | 215 ++-- dev/doc/universes.md | 226 ++++ dev/doc/universes.txt | 26 - dev/doc/univpoly.txt | 279 ----- dev/doc/versions-history.tex | 18 + dev/doc/xml-protocol.md | 755 +++++++++++ dev/header | 7 - dev/header.c | 9 + dev/header.ml | 9 + dev/header.py | 9 + dev/include | 7 +- dev/lint-commits.sh | 39 + dev/lint-repository.sh | 34 + dev/nsis/FileAssociation.nsh | 190 --- dev/nsis/coq.nsi | 2 +- dev/ocamldebug-coq.run | 16 +- dev/printers.mllib | 219 ---- dev/set_raw_db | 1 - dev/tools/Makefile.devel | 74 -- dev/tools/Makefile.dir | 131 -- dev/tools/Makefile.subdir | 7 - dev/tools/anomaly-traces-parser.el | 28 - dev/tools/backport-pr.sh | 74 ++ dev/tools/check-eof-newline.sh | 41 + dev/tools/coqdev.el | 107 ++ dev/tools/github-check-prs.py | 47 + dev/tools/merge-pr.sh | 50 + dev/tools/pre-commit | 73 ++ dev/tools/sudo-apt-get-update.sh | 4 + dev/top_printers.ml | 206 +-- dev/top_printers.mli | 175 +++ dev/v8-syntax/syntax-v8.tex | 2 +- dev/vm_printers.ml | 17 +- 134 files changed, 10245 insertions(+), 3249 deletions(-) create mode 100644 dev/Bugzilla_Coq_autolink.user.js create mode 100644 dev/Coq_Bugzilla_autolink.user.js delete mode 100644 dev/Makefile.oug delete mode 100644 dev/TODO create mode 100644 dev/bugzilla2github_stripped.csv create mode 100755 dev/build/windows/MakeCoq_86git_installer_cyglocal.bat create mode 100755 dev/build/windows/MakeCoq_88git_installer.bat mode change 100644 => 100755 dev/build/windows/MakeCoq_MinGW.bat create mode 100755 dev/build/windows/MakeCoq_explicitcachefolders_installer.bat create mode 100755 dev/build/windows/MakeCoq_local_installer.bat create mode 100755 dev/build/windows/MakeCoq_trunk_installer.bat mode change 100644 => 100755 dev/build/windows/makecoq_mingw.sh delete mode 100644 dev/build/windows/patches_coq/ReplaceInFile.nsh delete mode 100644 dev/build/windows/patches_coq/StrRep.nsh create mode 100644 dev/build/windows/patches_coq/aactactis-86ac28259030649ef51460e4de2441c8a1017751.patch create mode 100644 dev/build/windows/patches_coq/lablgtk-2.18.6.patch create mode 100644 dev/build/windows/patches_coq/quickchick-v1.0.2.patch create mode 100755 dev/build/windows/patches_coq/sed-4.2.2-3.src.patch create mode 100755 dev/build/windows/patches_coq/sed-4.2.2.patch create mode 100644 dev/ci/README.md create mode 100644 dev/ci/appveyor.bat create mode 100644 dev/ci/appveyor.sh create mode 100755 dev/ci/ci-basic-overlay.sh create mode 100755 dev/ci/ci-bedrock2.sh create mode 100755 dev/ci/ci-bignums.sh create mode 100755 dev/ci/ci-color.sh create mode 100644 dev/ci/ci-common.sh create mode 100755 dev/ci/ci-compcert.sh create mode 100755 dev/ci/ci-coq-dpdgraph.sh create mode 100755 dev/ci/ci-coquelicot.sh create mode 100755 dev/ci/ci-corn.sh create mode 100755 dev/ci/ci-cpdt.sh create mode 100755 dev/ci/ci-elpi.sh create mode 100755 dev/ci/ci-equations.sh create mode 100755 dev/ci/ci-ext-lib.sh create mode 100755 dev/ci/ci-fcsl-pcm.sh create mode 100755 dev/ci/ci-fiat-crypto-legacy.sh create mode 100755 dev/ci/ci-fiat-crypto.sh create mode 100755 dev/ci/ci-fiat-parsers.sh create mode 100755 dev/ci/ci-flocq.sh create mode 100755 dev/ci/ci-formal-topology.sh create mode 100755 dev/ci/ci-geocoq.sh create mode 100755 dev/ci/ci-hott.sh create mode 100755 dev/ci/ci-iris-lambda-rust.sh create mode 100755 dev/ci/ci-ltac2.sh create mode 100755 dev/ci/ci-math-classes.sh create mode 100755 dev/ci/ci-math-comp.sh create mode 100755 dev/ci/ci-mtac2.sh create mode 100755 dev/ci/ci-quickchick.sh create mode 100755 dev/ci/ci-sf.sh create mode 100755 dev/ci/ci-simple-io.sh create mode 100755 dev/ci/ci-tlc.sh create mode 100755 dev/ci/ci-unimath.sh create mode 100755 dev/ci/ci-vst.sh create mode 100755 dev/ci/ci-wrapper.sh create mode 100644 dev/ci/docker/bionic_coq/Dockerfile create mode 100755 dev/ci/gitlab.bat create mode 100644 dev/ci/user-overlays/00669-maximedenes-ssr-merge.sh create mode 100644 dev/ci/user-overlays/README.md create mode 100644 dev/core.dbg delete mode 100644 dev/db_printers.ml create mode 100644 dev/doc/COMPATIBILITY create mode 100644 dev/doc/changes.md delete mode 100644 dev/doc/changes.txt create mode 100644 dev/doc/debugging.md delete mode 100644 dev/doc/debugging.txt create mode 100644 dev/doc/econstr.md delete mode 100644 dev/doc/notes-on-conversion create mode 100644 dev/doc/notes-on-conversion.v create mode 100644 dev/doc/primproj.md create mode 100644 dev/doc/proof-engine.md create mode 100644 dev/doc/universes.md delete mode 100644 dev/doc/universes.txt delete mode 100644 dev/doc/univpoly.txt create mode 100644 dev/doc/xml-protocol.md delete mode 100644 dev/header create mode 100644 dev/header.c create mode 100644 dev/header.ml create mode 100644 dev/header.py create mode 100755 dev/lint-commits.sh create mode 100755 dev/lint-repository.sh delete mode 100644 dev/nsis/FileAssociation.nsh delete mode 100644 dev/printers.mllib delete mode 100644 dev/set_raw_db delete mode 100644 dev/tools/Makefile.devel delete mode 100644 dev/tools/Makefile.dir delete mode 100644 dev/tools/Makefile.subdir delete mode 100644 dev/tools/anomaly-traces-parser.el create mode 100755 dev/tools/backport-pr.sh create mode 100755 dev/tools/check-eof-newline.sh create mode 100644 dev/tools/coqdev.el create mode 100755 dev/tools/github-check-prs.py create mode 100755 dev/tools/merge-pr.sh create mode 100755 dev/tools/pre-commit create mode 100755 dev/tools/sudo-apt-get-update.sh create mode 100644 dev/top_printers.mli (limited to 'dev') diff --git a/dev/Bugzilla_Coq_autolink.user.js b/dev/Bugzilla_Coq_autolink.user.js new file mode 100644 index 00000000..ed056021 --- /dev/null +++ b/dev/Bugzilla_Coq_autolink.user.js @@ -0,0 +1,25 @@ +// ==UserScript== +// @name Bugzilla Coq autolink +// @namespace CoqScript +// @include https://coq.inria.fr/bugs/* +// @description Makes #XXXX into links to Github Coq PRs +// @version 1 +// @grant none +// ==/UserScript== + +var regex = /#(\d+)/g; +var substr = '$&'; + +function doNode(node) +{ + node.innerHTML = node.innerHTML.replace(regex,substr); +} + +var comments = document.getElementsByClassName("bz_comment_table")[0]; +var pars = comments.getElementsByClassName("bz_comment_text"); + +for(var j=0; j 1) + { + var range = document.createRange(); + var start = content.search(regex); + var end = start + matches[0].length; + range.setStart(node, start); + range.setEnd(node, end); + var linkNode = document.createElement("a"); + linkNode.href = "https://coq.inria.fr/bugs/show_bug.cgi?id=" + matches[1]; + range.surroundContents(linkNode); + + //handle multiple matches in one text node + doNode(linkNode.parentNode); + } + } +} + +for(var i=0; i" --useless-elements $@ - -core_intf.oug: - $(OUG) --dump-data $@ -rectypes $(MLINCLUDES) $(COREML) $(COREMLI) - -core_intf.useless: core_intf.oug - $(OUG) --load-data $< --no-reduce --print-loc --roots "" --useless-elements $@ - -# Analysis of coqchk, considering only files in the checker/ subdir - -CHECKERML:=$(call local_ml_of_cma,checker/check.cma) -CHECKERMLI:=$(call mli_of_ml,$(CHECKERML)) - -## BUG: in oug, include dirs have reversed priority compared with ocaml, cannot use CHKLIBS -MYCHKINCL:=$(MLINCLUDES) -I checker - -checker.oug: - $(OUG) --dump-data $@ -rectypes $(MYCHKINCL) $(CHECKERML) #$(CHECKERMLI) - -checker.useless: checker.oug - $(OUG) --load-data $< --no-reduce --print-loc --roots "" --useless-elements $@ - -# Analysis of extraction - -EXTRACTIONML:=$(call local_ml_of_cma,$(EXTRACTIONCMA)) -EXTRACTIONMLI:=$(call mli_of_ml,$(EXTRACTIONMLI)) - -extraction.oug: - $(OUG) --dump-data $@ -rectypes $(MLINCLUDES) $(EXTRACTIONML) #$(EXTRACTIONMLI) - -extraction.useless: extraction.oug - $(OUG) --load-data $< --no-reduce --print-loc --useless-elements $@ - -# More to come ... \ No newline at end of file diff --git a/dev/README b/dev/README index 814f6095..453f85f0 100644 --- a/dev/README +++ b/dev/README @@ -1,4 +1,4 @@ -This directory contains informations and tools to help developing the +This directory contains information and tools to help develop the Coq system ====================== @@ -6,30 +6,30 @@ This directory contains informations and tools to help developing the Debugging and profiling (in current directory - see doc/debugging.txt) ----------------------- -ocamldebug-coq: to launch ocaml debugger +ocamldebug-coq: to launch ocaml debugger (generated by the configure script) -db: to install pretty-printers from ocaml debugger -base_db: to install raw pretty-printers from ocaml debugger +db: to install pretty-printers from ocaml debugger +base_db: to install raw pretty-printers from ocaml debugger -include: to install pretty-printers from ocaml toplevel +include: to install pretty-printers from ocaml toplevel (use with the coq Drop command) base_include: to install raw pretty-printers from ocaml toplevel -vm_printers.ml, dev_printers.ml: ML pretty-printers for debugging +vm_printers.ml, top_printers.ml: ML pretty-printers for debugging -Miscellaneous informations about the code (directory doc) +Miscellaneous information about the code (directory doc) ----------------------------------------- -changes.txt: (partial) per-version summary of the evolutions of Coq ML source -style.txt: a few style recommendations for writing Coq ML files -debugging.txt: help for debugging or profiling -universes.txt: help to debug universes -translate.txt: help to use coq translator +changes.md: (partial) per-version summary of the evolution of Coq ML source +style.txt: a few style recommendations for writing Coq ML files +debugging.md: help for debugging or profiling +universes.txt: help for debugging universes +translate.txt: help for using coq translator extensions.txt: some help about TACTIC EXTEND -header: standard header for Coq ML files -perf-analysis: analysis of perfs measured on the compilation of user contribs -cic.dtd: official dtd of the calc. of ind. constr. for im/ex-portation +header: standard header for Coq ML files +perf-analysis: analysis of perfs measured on the compilation of user contribs +cic.dtd: official dtd of the calc. of ind. constr. for im/ex-portation Documentation of ML interfaces using ocamldoc (directory ocamldoc/html) @@ -40,11 +40,11 @@ Documentation of ML interfaces using ocamldoc (directory ocamldoc/html) Other development tools (directory tools) ----------------------- -Makefile.dir: makefile dedicated to intensive work in a given directory -Makefile.subdir: makefile dedicated to intensive work in a given subdirectory -Makefile.devel: utilities to automatically launch coq in various states -Makefile.common: used by other Makefiles +coqdev.el: helper customizations for everyday Coq development, eg + making `compile' work in subdirectories + objects.el: various development utilities at emacs level + anomaly-traces-parser.el: a .emacs-ready elisp snippet to parse location of Anomaly backtraces and jump to them conveniently from the Emacs *compilation* output. diff --git a/dev/TODO b/dev/TODO deleted file mode 100644 index e62ee6e5..00000000 --- a/dev/TODO +++ /dev/null @@ -1,22 +0,0 @@ - - o options de la ligne de commande - - reporter les options de l'ancien script coqtop sur le nouveau coqtop.ml - - o arguments implicites - - les calculer une fois pour toutes à la déclaration (dans Declare) - et stocker cette information dans le in_variable, in_constant, etc. - - o Environnements compilés (type Environ.compiled_env) - - pas de timestamp mais plutôt un checksum avec Digest (mais comment ?) - - o Efficacité - - utiliser DOPL plutôt que DOPN (sauf pour Case) - - batch mode => pas de undo, ni de reset - - conversion : déplier la constante la plus récente - - un cache pour type_of_const, type_of_inductive, type_of_constructor, - lookup_mind_specif - - o Toplevel - - parsing de la ligne de commande : utiliser Arg ??? - - diff --git a/dev/base_db b/dev/base_db index b540aed6..e18ac534 100644 --- a/dev/base_db +++ b/dev/base_db @@ -1,6 +1,6 @@ -load_printer "gramlib.cma" -load_printer "top_printers.cmo" -install_printer Top_printers.prid -install_printer Top_printers.prsp -install_printer Top_printers.print_pure_constr +source core.dbg +load_printer top_printers.cmo +install_printer Top_printers.ppid +install_printer Top_printers.ppsp +install_printer Top_printers.ppconstr diff --git a/dev/base_include b/dev/base_include index b09b6df2..1fb80dc0 100644 --- a/dev/base_include +++ b/dev/base_include @@ -17,9 +17,8 @@ #directory "grammar";; #directory "intf";; #directory "stm";; -#directory "ltac";; +#directory "vernac";; -#directory "+camlp4";; (* lazy solution: add both of camlp4/5 so that *) #directory "+camlp5";; (* Gramext is found in top_printers.ml *) #use "top_printers.ml";; @@ -52,7 +51,7 @@ #install_printer ppvblock;; #install_printer (* bigint *) ppbigint;; #install_printer (* loc *) pploc;; -#install_printer (* substitution *) prsubst;; +#install_printer (* substitution *) ppsubst;; (* Open main files *) @@ -128,7 +127,6 @@ open Reserve open Syntax_def open Constrexpr open Constrexpr_ops -open Topconstr open Notation_term open Notation_ops open Prettyp @@ -147,9 +145,6 @@ open Refiner open Tacmach open Tactic_debug -open Decl_proof_instr -open Decl_mode - open Hints open Auto open Autorewrite @@ -172,7 +167,7 @@ open Eqschemes open ExplainErr open Class -open Command +open ComDefinition open Indschemes open Ind_tables open Auto_ind_decl @@ -195,13 +190,16 @@ let qid = Libnames.qualid_of_string;; (* parsing of terms *) let parse_constr = Pcoq.parse_string Pcoq.Constr.constr;; -let parse_tac = Pcoq.parse_string Pcoq.Tactic.tactic;; -let parse_vernac = Pcoq.parse_string Pcoq.Vernac_.vernac;; +let parse_vernac = Pcoq.parse_string Pcoq.Vernac_.vernac_control;; +let parse_tac = Pcoq.parse_string Ltac_plugin.Pltac.tactic;; (* build a term of type glob_constr without type-checking or resolution of implicit syntax *) -let e s = Constrintern.intern_constr (Global.env()) (parse_constr s);; +let e s = + let env = Global.env () in + let sigma = Evd.from_env env in + Constrintern.intern_constr env sigma (parse_constr s);; (* build a term of type constr with type-checking and resolution of implicit syntax *) @@ -216,7 +214,7 @@ open Declareops;; let constbody_of_string s = let b = Global.lookup_constant (Nametab.locate_constant (qualid_of_string s)) in - Option.get (Declareops.body_of_constant Opaqueproof.empty_opaquetab b);; + Option.get (Global.body_of_constant_body b);; (* Get the current goal *) (* @@ -232,10 +230,9 @@ let pf_e gl s = let _ = Flags.in_debugger := false let _ = Flags.in_toplevel := true let _ = Constrextern.set_extern_reference - (fun loc _ r -> Libnames.Qualid (loc,Nametab.shortest_qualid_of_global Idset.empty r));; + (fun ?loc _ r -> CAst.make ?loc @@ Libnames.Qualid (Nametab.shortest_qualid_of_global Id.Set.empty r));; -open Coqloop -let go = loop +let go () = Coqloop.loop ~time:false ~state:Option.(get !Coqloop.drop_last_doc) let _ = print_string diff --git a/dev/bugzilla2github_stripped.csv b/dev/bugzilla2github_stripped.csv new file mode 100644 index 00000000..3f5cbfd7 --- /dev/null +++ b/dev/bugzilla2github_stripped.csv @@ -0,0 +1,501 @@ +2, 1156 +3, 1157 +4, 1158 +7, 1160 +8, 1161 +10, 1163 +12, 1164 +13, 1165 +14, 1169 +16, 1171 +17, 1184 +18, 1190 +19, 1191 +20, 1193 +21, 1200 +23, 1201 +24, 1203 +25, 1208 +26, 1210 +27, 1212 +28, 1216 +30, 1217 +31, 1223 +34, 1227 +35, 1232 +36, 1235 +38, 1238 +39, 1244 +40, 1245 +41, 1246 +42, 1247 +44, 1248 +45, 1249 +46, 1250 +47, 1252 +48, 1253 +49, 1254 +50, 1256 +52, 1262 +54, 1263 +55, 1264 +56, 1265 +59, 1266 +60, 1267 +61, 1268 +63, 1270 +64, 1272 +65, 1274 +66, 1275 +69, 1276 +70, 1279 +71, 1283 +72, 1284 +73, 1285 +74, 1286 +75, 1287 +78, 1288 +79, 1291 +80, 1292 +82, 1293 +83, 1295 +84, 1296 +85, 1297 +86, 1299 +88, 1301 +89, 1303 +90, 1304 +91, 1305 +92, 1307 +93, 1308 +94, 1310 +95, 1312 +96, 1313 +97, 1314 +98, 1316 +99, 1318 +100, 1319 +101, 1320 +102, 1321 +103, 1323 +105, 1324 +106, 1327 +107, 1328 +108, 1330 +109, 1334 +112, 1335 +115, 1336 +119, 1337 +121, 1341 +123, 1342 +124, 1343 +125, 1344 +126, 1345 +127, 1346 +128, 1348 +129, 1349 +134, 1350 +135, 1351 +136, 1352 +137, 1353 +138, 1354 +139, 1355 +140, 1356 +142, 1357 +143, 1358 +144, 1359 +145, 1360 +147, 1361 +148, 1362 +149, 1363 +150, 1365 +152, 1366 +154, 1368 +155, 1369 +160, 1370 +161, 1371 +162, 1372 +164, 1373 +165, 1374 +166, 1376 +167, 1377 +169, 1378 +170, 1380 +178, 1382 +179, 1383 +180, 1384 +181, 1385 +182, 1386 +183, 1387 +184, 1390 +185, 1391 +186, 1392 +187, 1393 +189, 1394 +190, 1398 +191, 1401 +192, 1402 +194, 1403 +195, 1404 +196, 1405 +197, 1407 +198, 1409 +199, 1410 +202, 1412 +204, 1413 +205, 1421 +207, 1422 +209, 1423 +210, 1426 +212, 1427 +213, 1428 +214, 1429 +215, 1433 +216, 1435 +219, 1436 +220, 1437 +221, 1440 +222, 1444 +224, 1445 +225, 1450 +228, 1452 +229, 1453 +235, 1457 +236, 1458 +238, 1459 +239, 1460 +240, 1462 +242, 1465 +243, 1466 +244, 1470 +245, 1471 +248, 1472 +250, 1473 +253, 1474 +254, 1475 +259, 1476 +261, 1478 +262, 1479 +263, 1480 +264, 1481 +265, 1484 +266, 1485 +267, 1486 +268, 1488 +269, 1489 +270, 1490 +271, 1492 +272, 1493 +273, 1494 +274, 1498 +275, 1500 +277, 1503 +278, 1504 +279, 1505 +282, 1506 +283, 1511 +289, 1513 +290, 1514 +291, 1516 +292, 1517 +294, 1520 +295, 1521 +299, 1523 +301, 1524 +302, 1525 +303, 1527 +305, 1529 +311, 1530 +315, 1531 +316, 1532 +317, 1534 +320, 1535 +322, 1539 +324, 1541 +328, 1542 +329, 1543 +330, 1544 +331, 1545 +333, 1546 +335, 1547 +336, 1548 +338, 1549 +343, 1550 +348, 1551 +350, 1552 +351, 1553 +352, 1554 +353, 1555 +356, 1556 +363, 1557 +368, 1558 +371, 1559 +372, 1560 +413, 1561 +418, 1562 +420, 1563 +426, 1564 +431, 1565 +444, 1566 +447, 1567 +452, 1569 +459, 1570 +462, 1571 +463, 1573 +468, 1574 +472, 1575 +473, 1577 +509, 1578 +519, 1579 +529, 1580 +540, 1581 +541, 1583 +545, 1584 +546, 1585 +547, 1589 +550, 1590 +552, 1591 +553, 1592 +554, 1593 +574, 1594 +592, 1595 +602, 1597 +603, 1598 +606, 1599 +607, 1600 +667, 1601 +668, 1602 +686, 1603 +690, 1605 +699, 1606 +705, 1607 +708, 1609 +711, 1610 +728, 1611 +739, 1612 +742, 1613 +743, 1615 +774, 1617 +775, 1619 +776, 1623 +777, 1624 +778, 1625 +779, 1627 +780, 1628 +781, 1629 +782, 1630 +783, 1631 +784, 1632 +785, 1633 +786, 1636 +787, 1637 +788, 1638 +789, 1639 +790, 1640 +793, 1641 +794, 1642 +795, 1644 +797, 1645 +798, 1646 +803, 1647 +804, 1649 +805, 1650 +808, 1652 +813, 1653 +815, 1655 +816, 1656 +818, 1657 +820, 1658 +821, 1659 +822, 1660 +823, 1661 +826, 1662 +828, 1663 +829, 1664 +830, 1665 +831, 1666 +832, 1667 +834, 1668 +835, 1669 +836, 1670 +837, 5689 +839, 5791 +840, 5792 +841, 5793 +842, 5794 +843, 5795 +844, 5796 +846, 5797 +849, 5798 +850, 5799 +854, 5800 +855, 5801 +856, 5802 +857, 5803 +860, 5804 +861, 5805 +862, 5806 +863, 5807 +864, 5808 +865, 5809 +867, 5810 +868, 5811 +869, 5812 +870, 5813 +871, 5814 +872, 5815 +874, 5816 +875, 5817 +878, 5818 +879, 5819 +881, 5820 +883, 5821 +884, 5822 +885, 5823 +886, 5824 +888, 5825 +889, 5826 +890, 5827 +891, 5828 +892, 5829 +893, 5830 +894, 5831 +896, 5832 +898, 5833 +901, 5834 +903, 5835 +905, 5836 +906, 5837 +909, 5838 +914, 5839 +915, 5840 +922, 5841 +923, 5842 +925, 5843 +927, 5844 +931, 5845 +932, 5846 +934, 5847 +935, 5848 +936, 5849 +937, 5850 +938, 5851 +939, 5852 +940, 5853 +941, 5854 +945, 5855 +946, 5856 +947, 5857 +949, 5858 +950, 5859 +951, 5860 +952, 5861 +953, 5862 +954, 5863 +957, 5864 +960, 5865 +963, 5866 +965, 5867 +967, 5868 +968, 5869 +969, 5870 +972, 5871 +973, 5872 +974, 5873 +975, 5874 +976, 5875 +977, 5876 +979, 5877 +983, 5878 +984, 5879 +985, 5880 +986, 5881 +987, 5882 +988, 5883 +990, 5884 +991, 5885 +993, 5886 +996, 5887 +997, 5888 +1000, 5889 +1001, 5890 +1002, 5891 +1003, 5892 +1004, 5893 +1005, 5894 +1006, 5895 +1007, 5896 +1010, 5897 +1012, 5898 +1013, 5899 +1014, 5900 +1015, 5901 +1016, 5902 +1017, 5903 +1018, 5904 +1025, 5905 +1028, 5906 +1029, 5907 +1030, 5908 +1031, 5909 +1033, 5910 +1035, 5911 +1036, 5912 +1037, 5913 +1039, 5914 +1041, 5915 +1042, 5916 +1044, 5917 +1045, 5918 +1052, 5919 +1053, 5920 +1054, 5921 +1055, 5922 +1056, 5923 +1060, 5924 +1064, 5925 +1067, 5926 +1070, 5927 +1072, 5928 +1075, 5929 +1076, 5930 +1085, 5931 +1086, 5932 +1087, 5933 +1089, 5934 +1091, 5935 +1096, 5936 +1097, 5937 +1098, 5938 +1099, 5939 +1100, 5940 +1101, 5941 +1102, 5942 +1104, 5943 +1107, 5944 +1108, 5945 +1111, 5946 +1113, 5947 +1114, 5948 +1115, 5949 +1116, 5950 +1118, 5951 +1119, 5952 +1120, 5953 +1122, 5954 +1123, 5955 +1124, 5956 +1128, 5957 +1129, 5958 +1132, 5959 +1136, 5960 +1137, 5961 +1138, 5962 +1140, 5963 +1141, 5964 +1142, 5965 +1144, 5966 +1145, 5967 +1149, 5968 +1151, 5969 +1153, 5970 diff --git a/dev/build/osx/make-macos-dmg.sh b/dev/build/osx/make-macos-dmg.sh index b43ada90..dc33838f 100755 --- a/dev/build/osx/make-macos-dmg.sh +++ b/dev/build/osx/make-macos-dmg.sh @@ -4,32 +4,25 @@ set -e # Configuration setup -eval `opam config env` -make distclean OUTDIR=$PWD/_install DMGDIR=$PWD/_dmg -./configure -debug -prefix $OUTDIR -native-compiler no VERSION=$(sed -n -e '/^let coq_version/ s/^[^"]*"\([^"]*\)"$/\1/p' configure.ml) APP=bin/CoqIDE_${VERSION}.app -# Create a .app file with CoqIDE -~/.local/bin/jhbuild run make -j -l2 $APP - -# Build Coq and run test-suite -make && make check +# Create a .app file with CoqIDE, without signing it +make PRIVATEBINARIES=$APP -j $NJOBS -l2 $APP # Add Coq to the .app file make OLDROOT=$OUTDIR COQINSTALLPREFIX=$APP/Contents/Resources/ install-coq install-ide-toploop -# Sign the .app file -codesign -f -s - $APP - # Create the dmg bundle mkdir -p $DMGDIR ln -sf /Applications $DMGDIR/Applications cp -r $APP $DMGDIR +mkdir -p _build + # Temporary countermeasure to hdiutil error 5341 -head -c9703424 /dev/urandom > $DMGDIR/.padding +# head -c9703424 /dev/urandom > $DMGDIR/.padding -hdiutil create -imagekey zlib-level=9 -volname CoqIDE_$VERSION -srcfolder $DMGDIR -ov -format UDZO CoqIDE_$VERSION.dmg +hdiutil create -imagekey zlib-level=9 -volname coq-$VERSION-installer-macos -srcfolder $DMGDIR -ov -format UDZO _build/coq-$VERSION-installer-macos.dmg diff --git a/dev/build/windows/MakeCoq_84pl6_abs_ocaml.bat b/dev/build/windows/MakeCoq_84pl6_abs_ocaml.bat index bdcb01db..9dbce192 100644 --- a/dev/build/windows/MakeCoq_84pl6_abs_ocaml.bat +++ b/dev/build/windows/MakeCoq_84pl6_abs_ocaml.bat @@ -1,3 +1,16 @@ +@ECHO OFF + +REM ========== COPYRIGHT/COPYLEFT ========== + +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== BUILD COQ ========== + call MakeCoq_SetRootPath call MakeCoq_MinGW.bat ^ @@ -6,5 +19,10 @@ call MakeCoq_MinGW.bat ^ -ocaml=Y ^ -make=Y ^ -coqver=8.4pl6 ^ - -destcyg=%ROOTPATH%\cygwin_coq64_84pl6_abs ^ - -destcoq=%ROOTPATH%\coq64_84pl6_abs + -destcyg="%ROOTPATH%\cygwin_coq64_84pl6_abs" ^ + -destcoq="%ROOTPATH%\coq64_84pl6_abs" + +IF %ERRORLEVEL% NEQ 0 ( + ECHO MakeCoq_84pl6_abs_ocaml.bat failed with error code %ERRORLEVEL% + EXIT /b %ERRORLEVEL% +) diff --git a/dev/build/windows/MakeCoq_85pl2_abs_ocaml.bat b/dev/build/windows/MakeCoq_85pl2_abs_ocaml.bat index 2e4a692e..7faf3e9c 100644 --- a/dev/build/windows/MakeCoq_85pl2_abs_ocaml.bat +++ b/dev/build/windows/MakeCoq_85pl2_abs_ocaml.bat @@ -1,3 +1,16 @@ +@ECHO OFF + +REM ========== COPYRIGHT/COPYLEFT ========== + +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== BUILD COQ ========== + call MakeCoq_SetRootPath call MakeCoq_MinGW.bat ^ @@ -6,5 +19,10 @@ call MakeCoq_MinGW.bat ^ -ocaml=Y ^ -make=Y ^ -coqver=8.5pl2 ^ - -destcyg=%ROOTPATH%\cygwin_coq64_85pl2_abs ^ - -destcoq=%ROOTPATH%\coq64_85pl2_abs + -destcyg="%ROOTPATH%\cygwin_coq64_85pl2_abs" ^ + -destcoq="%ROOTPATH%\coq64_85pl2_abs" + +IF %ERRORLEVEL% NEQ 0 ( + ECHO MakeCoq_85pl2_abs_ocaml.bat failed with error code %ERRORLEVEL% + EXIT /b %ERRORLEVEL% +) diff --git a/dev/build/windows/MakeCoq_85pl3_abs_ocaml.bat b/dev/build/windows/MakeCoq_85pl3_abs_ocaml.bat index 6e4e440a..b719b14c 100644 --- a/dev/build/windows/MakeCoq_85pl3_abs_ocaml.bat +++ b/dev/build/windows/MakeCoq_85pl3_abs_ocaml.bat @@ -1,3 +1,16 @@ +@ECHO OFF + +REM ========== COPYRIGHT/COPYLEFT ========== + +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== BUILD COQ ========== + call MakeCoq_SetRootPath call MakeCoq_MinGW.bat ^ @@ -6,5 +19,10 @@ call MakeCoq_MinGW.bat ^ -ocaml=Y ^ -make=Y ^ -coqver=8.5pl3 ^ - -destcyg=%ROOTPATH%\cygwin_coq64_85pl3_abs ^ - -destcoq=%ROOTPATH%\coq64_85pl3_abs + -destcyg="%ROOTPATH%\cygwin_coq64_85pl3_abs" ^ + -destcoq="%ROOTPATH%\coq64_85pl3_abs" + +IF %ERRORLEVEL% NEQ 0 ( + ECHO MakeCoq_85pl3_abs_ocaml.bat failed with error code %ERRORLEVEL% + EXIT /b %ERRORLEVEL% +) diff --git a/dev/build/windows/MakeCoq_85pl3_installer.bat b/dev/build/windows/MakeCoq_85pl3_installer.bat index c305e2f5..a9f4e2da 100644 --- a/dev/build/windows/MakeCoq_85pl3_installer.bat +++ b/dev/build/windows/MakeCoq_85pl3_installer.bat @@ -1,8 +1,26 @@ +@ECHO OFF + +REM ========== COPYRIGHT/COPYLEFT ========== + +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== BUILD COQ ========== + call MakeCoq_SetRootPath call MakeCoq_MinGW.bat ^ -arch=64 ^ -installer=Y ^ -coqver=8.5pl3 ^ - -destcyg=%ROOTPATH%\cygwin_coq64_85pl3_inst ^ - -destcoq=%ROOTPATH%\coq64_85pl3_inst + -destcyg="%ROOTPATH%\cygwin_coq64_85pl3_inst" ^ + -destcoq="%ROOTPATH%\coq64_85pl3_inst" + +IF %ERRORLEVEL% NEQ 0 ( + ECHO MakeCoq_85pl3_installer.bat failed with error code %ERRORLEVEL% + EXIT /b %ERRORLEVEL% +) diff --git a/dev/build/windows/MakeCoq_85pl3_installer_32.bat b/dev/build/windows/MakeCoq_85pl3_installer_32.bat index d87ff591..ef593cc6 100644 --- a/dev/build/windows/MakeCoq_85pl3_installer_32.bat +++ b/dev/build/windows/MakeCoq_85pl3_installer_32.bat @@ -1,8 +1,26 @@ +@ECHO OFF + +REM ========== COPYRIGHT/COPYLEFT ========== + +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== BUILD COQ ========== + call MakeCoq_SetRootPath call MakeCoq_MinGW.bat ^ -arch=32 ^ -installer=Y ^ -coqver=8.5pl3 ^ - -destcyg=%ROOTPATH%\cygwin_coq32_85pl3_inst ^ - -destcoq=%ROOTPATH%\coq32_85pl3_inst + -destcyg="%ROOTPATH%\cygwin_coq32_85pl3_inst" ^ + -destcoq="%ROOTPATH%\coq32_85pl3_inst" + +IF %ERRORLEVEL% NEQ 0 ( + ECHO MakeCoq_85pl3_installer_32.bat failed with error code %ERRORLEVEL% + EXIT /b %ERRORLEVEL% +) diff --git a/dev/build/windows/MakeCoq_86git_abs_ocaml.bat b/dev/build/windows/MakeCoq_86git_abs_ocaml.bat index f1d855a0..99a1f156 100644 --- a/dev/build/windows/MakeCoq_86git_abs_ocaml.bat +++ b/dev/build/windows/MakeCoq_86git_abs_ocaml.bat @@ -1,3 +1,16 @@ +@ECHO OFF + +REM ========== COPYRIGHT/COPYLEFT ========== + +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== BUILD COQ ========== + call MakeCoq_SetRootPath call MakeCoq_MinGW.bat ^ @@ -6,5 +19,10 @@ call MakeCoq_MinGW.bat ^ -ocaml=Y ^ -make=Y ^ -coqver=git-v8.6 ^ - -destcyg=%ROOTPATH%\cygwin_coq64_86git_abs ^ - -destcoq=%ROOTPATH%\coq64_86git_abs + -destcyg="%ROOTPATH%\cygwin_coq64_86git_abs" ^ + -destcoq="%ROOTPATH%\coq64_86git_abs" + +IF %ERRORLEVEL% NEQ 0 ( + ECHO MakeCoq_86git_abs_ocaml.bat failed with error code %ERRORLEVEL% + EXIT /b %ERRORLEVEL% +) diff --git a/dev/build/windows/MakeCoq_86git_abs_ocaml_gtksrc.bat b/dev/build/windows/MakeCoq_86git_abs_ocaml_gtksrc.bat index 70ab42bc..896d1cd6 100644 --- a/dev/build/windows/MakeCoq_86git_abs_ocaml_gtksrc.bat +++ b/dev/build/windows/MakeCoq_86git_abs_ocaml_gtksrc.bat @@ -1,3 +1,16 @@ +@ECHO OFF + +REM ========== COPYRIGHT/COPYLEFT ========== + +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== BUILD COQ ========== + call MakeCoq_SetRootPath call MakeCoq_MinGW.bat ^ @@ -7,5 +20,10 @@ call MakeCoq_MinGW.bat ^ -make=Y ^ -gtksrc=Y ^ -coqver=git-v8.6 ^ - -destcyg=%ROOTPATH%\cygwin_coq64_86git_abs_gtksrc ^ - -destcoq=%ROOTPATH%\coq64_86git_abs_gtksrc + -destcyg="%ROOTPATH%\cygwin_coq64_86git_abs_gtksrc" ^ + -destcoq="%ROOTPATH%\coq64_86git_abs_gtksrc" + +IF %ERRORLEVEL% NEQ 0 ( + ECHO MakeCoq_86git_abs_ocaml_gtksrc.bat failed with error code %ERRORLEVEL% + EXIT /b %ERRORLEVEL% +) diff --git a/dev/build/windows/MakeCoq_86git_installer.bat b/dev/build/windows/MakeCoq_86git_installer.bat index 40506318..c4823103 100644 --- a/dev/build/windows/MakeCoq_86git_installer.bat +++ b/dev/build/windows/MakeCoq_86git_installer.bat @@ -1,8 +1,26 @@ +@ECHO OFF + +REM ========== COPYRIGHT/COPYLEFT ========== + +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== BUILD COQ ========== + call MakeCoq_SetRootPath call MakeCoq_MinGW.bat ^ -arch=64 ^ -installer=Y ^ -coqver=git-v8.6 ^ - -destcyg=%ROOTPATH%\cygwin_coq64_86git_inst ^ - -destcoq=%ROOTPATH%\coq64_86git_inst + -destcyg="%ROOTPATH%\cygwin_coq64_86git_inst" ^ + -destcoq="%ROOTPATH%\coq64_86git_inst" + +IF %ERRORLEVEL% NEQ 0 ( + ECHO MakeCoq_86git_installer.bat failed with error code %ERRORLEVEL% + EXIT /b %ERRORLEVEL% +) diff --git a/dev/build/windows/MakeCoq_86git_installer_32.bat b/dev/build/windows/MakeCoq_86git_installer_32.bat index b9127c94..19146c96 100644 --- a/dev/build/windows/MakeCoq_86git_installer_32.bat +++ b/dev/build/windows/MakeCoq_86git_installer_32.bat @@ -1,8 +1,26 @@ +@ECHO OFF + +REM ========== COPYRIGHT/COPYLEFT ========== + +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== BUILD COQ ========== + call MakeCoq_SetRootPath call MakeCoq_MinGW.bat ^ -arch=32 ^ -installer=Y ^ -coqver=git-v8.6 ^ - -destcyg=%ROOTPATH%\cygwin_coq32_86git_inst ^ - -destcoq=%ROOTPATH%\coq32_86git_inst + -destcyg="%ROOTPATH%\cygwin_coq32_86git_inst" ^ + -destcoq="%ROOTPATH%\coq32_86git_inst" + +IF %ERRORLEVEL% NEQ 0 ( + ECHO MakeCoq_86git_installer_32.bat failed with error code %ERRORLEVEL% + EXIT /b %ERRORLEVEL% +) diff --git a/dev/build/windows/MakeCoq_86git_installer_cyglocal.bat b/dev/build/windows/MakeCoq_86git_installer_cyglocal.bat new file mode 100755 index 00000000..cf6cafaa --- /dev/null +++ b/dev/build/windows/MakeCoq_86git_installer_cyglocal.bat @@ -0,0 +1,27 @@ +@ECHO OFF + +REM ========== COPYRIGHT/COPYLEFT ========== + +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== BUILD COQ ========== + +call MakeCoq_SetRootPath + +call MakeCoq_MinGW.bat ^ + -arch=64 ^ + -installer=Y ^ + -coqver=git-v8.6 ^ + -cyglocal=Y ^ + -destcyg="%ROOTPATH%\cygwin_coq64_86git_inst_cyglocal" ^ + -destcoq="%ROOTPATH%\coq64_86git_inst_cyglocal" + +IF %ERRORLEVEL% NEQ 0 ( + ECHO MakeCoq_86git_installer_cyglocal.bat failed with error code %ERRORLEVEL% + EXIT /b %ERRORLEVEL% +) diff --git a/dev/build/windows/MakeCoq_88git_installer.bat b/dev/build/windows/MakeCoq_88git_installer.bat new file mode 100755 index 00000000..b016fb38 --- /dev/null +++ b/dev/build/windows/MakeCoq_88git_installer.bat @@ -0,0 +1,27 @@ +@ECHO OFF + +REM ========== COPYRIGHT/COPYLEFT ========== + +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== BUILD COQ ========== + +call MakeCoq_SetRootPath + +call MakeCoq_MinGW.bat ^ + -arch=64 ^ + -installer=Y ^ + -coqver=git-v8.8 ^ + -destcyg=%ROOTPATH%\cygwin_coq64_88_inst ^ + -destcoq=%ROOTPATH%\coq64_88_inst ^ + -addon=bignums + +IF %ERRORLEVEL% NEQ 0 ( + ECHO MakeCoq_88git_installer.bat failed with error code %ERRORLEVEL% + EXIT /b %ERRORLEVEL% +) diff --git a/dev/build/windows/MakeCoq_MinGW.bat b/dev/build/windows/MakeCoq_MinGW.bat old mode 100644 new mode 100755 index 1e08cc5a..61cf6bc4 --- a/dev/build/windows/MakeCoq_MinGW.bat +++ b/dev/build/windows/MakeCoq_MinGW.bat @@ -18,7 +18,7 @@ REM ========== DEFAULT VALUES FOR PARAMETERS ========== REM For a description of all parameters, see ReadMe.txt -SET BATCHFILE=%0 +SET BATCHFILE=%~0 SET BATCHDIR=%~dp0 REM see -arch in ReadMe.txt, but values are x86_64 or i686 (not 64 or 32) @@ -34,7 +34,7 @@ REM see -ocaml in ReadMe.txt SET INSTALLOCAML=N REM see -make in ReadMe.txt -SET INSTALLMAKE=Y +SET INSTALLMAKE=N REM see -destcyg in ReadMe.txt SET DESTCYG=C:\bin\cygwin_coq @@ -47,9 +47,11 @@ SET SETUP=setup-x86_64.exe REM see -proxy in ReadMe.txt IF DEFINED HTTP_PROXY ( - SET PROXY="%HTTP_PROXY:http://=%" + SET PROXY=%HTTP_PROXY:http://=% ) else ( - SET PROXY="" + REM One can't set a variable to empty in DOS, but you can set it to a space this way. + REM The quotes are just there to make the space visible and to protect from "remove trailing spaces". + SET "PROXY= " ) REM see -cygrepo in ReadMe.txt @@ -76,18 +78,21 @@ SET GTK_FROM_SOURCES=N REM see -threads in ReadMe.txt SET MAKE_THREADS=8 +REM see -addon in ReadMe.txt +SET "COQ_ADDONS= " + REM ========== PARSE COMMAND LINE PARAMETERS ========== SHIFT :Parse -IF "%0" == "-arch" ( - IF "%1" == "32" ( +IF "%~0" == "-arch" ( + IF "%~1" == "32" ( SET ARCH=i686 SET SETUP=setup-x86.exe ) ELSE ( - IF "%1" == "64" ( + IF "%~1" == "64" ( SET ARCH=x86_64 SET SETUP=setup-x86_64.exe ) ELSE ( @@ -100,15 +105,15 @@ IF "%0" == "-arch" ( GOTO Parse ) -IF "%0" == "-mode" ( - IF "%1" == "mingwincygwin" ( - SET INSTALLMODE=%1 +IF "%~0" == "-mode" ( + IF "%~1" == "mingwincygwin" ( + SET INSTALLMODE=%~1 ) ELSE ( - IF "%1" == "absolute" ( - SET INSTALLMODE=%1 + IF "%~1" == "absolute" ( + SET INSTALLMODE=%~1 ) ELSE ( - IF "%1" == "relocatable" ( - SET INSTALLMODE=%1 + IF "%~1" == "relocatable" ( + SET INSTALLMODE=%~1 ) ELSE ( ECHO "Invalid -mode, valid are mingwincygwin, absolute and relocatable" GOTO :EOF @@ -120,122 +125,137 @@ IF "%0" == "-mode" ( GOTO Parse ) -IF "%0" == "-installer" ( - SET MAKEINSTALLER=%1 +IF "%~0" == "-installer" ( + SET MAKEINSTALLER=%~1 + CALL :CheckYN -installer %~1 || GOTO ErrorExit + SHIFT + SHIFT + GOTO Parse +) + +IF "%~0" == "-ocaml" ( + SET INSTALLOCAML=%~1 + CALL :CheckYN -installer %~1 || GOTO ErrorExit SHIFT SHIFT GOTO Parse ) -IF "%0" == "-ocaml" ( - SET INSTALLOCAML=%1 +IF "%~0" == "-make" ( + SET INSTALLMAKE=%~1 + CALL :CheckYN -installer %~1 || GOTO ErrorExit SHIFT SHIFT GOTO Parse ) -IF "%0" == "-make" ( - SET INSTALLMAKE=%1 +IF "%~0" == "-destcyg" ( + SET DESTCYG=%~1 SHIFT SHIFT GOTO Parse ) -IF "%0" == "-destcyg" ( - SET DESTCYG=%1 +IF "%~0" == "-destcoq" ( + SET DESTCOQ=%~1 SHIFT SHIFT GOTO Parse ) -IF "%0" == "-destcoq" ( - SET DESTCOQ=%1 +IF "%~0" == "-setup" ( + SET SETUP=%~1 SHIFT SHIFT GOTO Parse ) -IF "%0" == "-setup" ( - SET SETUP=%1 +IF "%~0" == "-proxy" ( + SET PROXY=%~1 SHIFT SHIFT GOTO Parse ) -IF "%0" == "-proxy" ( - SET PROXY="%1" +IF "%~0" == "-cygrepo" ( + SET CYGWIN_REPOSITORY=%~1 SHIFT SHIFT GOTO Parse ) -IF "%0" == "-cygrepo" ( - SET CYGWIN_REPOSITORY="%1" +IF "%~0" == "-cygcache" ( + SET CYGWIN_LOCAL_CACHE_WFMT=%~1 SHIFT SHIFT GOTO Parse ) -IF "%0" == "-cygcache" ( - SET CYGWIN_LOCAL_CACHE_WFMT="%1" +IF "%~0" == "-cyglocal" ( + SET CYGWIN_FROM_CACHE=%~1 + CALL :CheckYN -cyglocal %~1 || GOTO ErrorExit SHIFT SHIFT GOTO Parse ) -IF "%0" == "-cyglocal" ( - SET CYGWIN_FROM_CACHE=%1 +IF "%~0" == "-cygquiet" ( + SET CYGWIN_QUIET=%~1 + CALL :CheckYN -cygquiet %~1 || GOTO ErrorExit SHIFT SHIFT GOTO Parse ) -IF "%0" == "-cygquiet" ( - SET CYGWIN_QUIET=%1 +IF "%~0" == "-srccache" ( + SET SOURCE_LOCAL_CACHE_WFMT=%~1 SHIFT SHIFT GOTO Parse ) -IF "%0" == "-srccache" ( - SET SOURCE_LOCAL_CACHE_WFMT="%1" +IF "%~0" == "-coqver" ( + SET COQ_VERSION=%~1 SHIFT SHIFT GOTO Parse ) -IF "%0" == "-coqver" ( - SET COQ_VERSION=%1 +IF "%~0" == "-gtksrc" ( + SET GTK_FROM_SOURCES=%~1 + CALL :CheckYN -gtksrc %~1 || GOTO ErrorExit SHIFT SHIFT GOTO Parse ) -IF "%0" == "-gtksrc" ( - SET GTK_FROM_SOURCES=%1 +IF "%~0" == "-threads" ( + SET MAKE_THREADS=%~1 SHIFT SHIFT GOTO Parse ) -IF "%0" == "-threads" ( - SET MAKE_THREADS=%1 +IF "%~0" == "-addon" ( + SET "COQ_ADDONS=%COQ_ADDONS% %~1" SHIFT SHIFT GOTO Parse ) -IF NOT "%0" == "" ( + +IF NOT "%~0" == "" ( ECHO Install cygwin and download, compile and install OCaml and Coq for MinGW - ECHO !!! Illegal parameter %0 - ECHO Usage: + ECHO !!! Illegal parameter %~0 + ECHO Usage: ECHO MakeCoq_MinGW CALL :PrintPars - goto :EOF + GOTO :EOF ) IF NOT EXIST %SETUP% ( ECHO The cygwin setup program %SETUP% doesn't exist. You must download it from https://cygwin.com/install.html. + ECHO If the setup is in a different folder, set the full path to %SETUP% using the -setup option. GOTO :EOF ) @@ -247,16 +267,14 @@ IF "%INSTALLMODE%" == "mingwincygwin" ( IF "%MAKEINSTALLER%" == "Y" ( SET INSTALLMODE=relocatable - SET INSTALLOCAML=Y - SET INSTALLMAKE=Y ) REM ========== CONFIRM PARAMETERS ========== CALL :PrintPars REM Note: DOS batch replaces variables on parsing, so one can't use a variable just set in an () block -IF "%COQREGTESTING%"=="Y" (GOTO :DontAsk) - SET /p ANSWER=Is this correct? y/n +IF "%COQREGTESTING%"=="Y" (GOTO DontAsk) + SET /p ANSWER="Is this correct? y/n " IF NOT "%ANSWER%"=="y" (GOTO :EOF) :DontAsk @@ -296,12 +314,13 @@ ECHO RESULT INSTALL DIR (MINGW) = %RESULT_INSTALLDIR_MFMT% ECHO RESULT INSTALL DIR (CYGWIN) = %RESULT_INSTALLDIR_CFMT% REM WARNING: Add a space after the = in case you want set this to empty, otherwise the variable will be unset -SET MAKE_OPT=-j %MAKE_THREADS% +SET MAKE_OPT=-j %MAKE_THREADS% REM ========== DERIVED CYGWIN SETUP OPTIONS ========== -REM WARNING: Add a space after the = otherwise the variable will be unset -SET CYGWIN_OPT= +REM One can't set a variable to empty in DOS, but you can set it to a space this way. +REM The quotes are just there to make the space visible and to protect from "remove trailing spaces". +SET "CYGWIN_OPT= " IF "%CYGWIN_FROM_CACHE%" == "Y" ( SET CYGWIN_OPT= %CYGWIN_OPT% -L @@ -315,17 +334,9 @@ IF "%GTK_FROM_SOURCES%"=="N" ( SET CYGWIN_OPT= %CYGWIN_OPT% -P mingw64-%ARCH%-gtk2.0,mingw64-%ARCH%-gtksourceview2.0 ) -ECHO ========== INSTALL CYGWIN ========== - REM Cygwin setup sets proper ACLs (permissions) for folders it CREATES. REM Otherwise chmod won't work and e.g. the ocaml build will fail. REM Cygwin setup does not touch the ACLs of existing folders. -REM => Create the setup log in a temporary location and move it later. - -REM Get Unique temporary file name -:logfileloop -SET LOGFILE=%TEMP%\CygwinSetUp%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.log -if exist "%LOGFILE%" goto :logfileloop REM Run Cygwin Setup @@ -337,18 +348,31 @@ IF NOT "%CYGWIN_QUIET%" == "Y" ( SET RUNSETUP=Y ) +IF "%COQREGTESTING%" == "Y" ( + ECHO "========== REMOVE EXISTING CYGWIN ==========" + DEL /S /F /Q "%CYGWIN_INSTALLDIR_WFMT%" > NUL + SET RUNSETUP=Y +) + +SET "EXTRAPACKAGES= " + +IF NOT "%APPVEYOR%" == "True" ( + SET EXTRAPACKAGES=-P wget,curl,git,gcc-core,gcc-g++,automake1.5 +) + +ECHO "========== INSTALL CYGWIN ==========" + IF "%RUNSETUP%"=="Y" ( %SETUP% ^ - --proxy %PROXY% ^ - --site %CYGWIN_REPOSITORY% ^ - --root %CYGWIN_INSTALLDIR_WFMT% ^ - --local-package-dir %CYGWIN_LOCAL_CACHE_WFMT% ^ + --proxy "%PROXY%" ^ + --site "%CYGWIN_REPOSITORY%" ^ + --root "%CYGWIN_INSTALLDIR_WFMT%" ^ + --local-package-dir "%CYGWIN_LOCAL_CACHE_WFMT%" ^ --no-shortcuts ^ %CYGWIN_OPT% ^ - -P wget,curl,git,make,unzip ^ - -P gcc-core,gcc-g++ ^ + -P make,unzip ^ -P gdb,liblzma5 ^ - -P patch,automake1.14,automake1.15 ^ + -P patch,automake1.14 ^ -P mingw64-%ARCH%-binutils,mingw64-%ARCH%-gcc-core,mingw64-%ARCH%-gcc-g++,mingw64-%ARCH%-pkg-config,mingw64-%ARCH%-windows_default_manifest ^ -P mingw64-%ARCH%-headers,mingw64-%ARCH%-runtime,mingw64-%ARCH%-pthreads,mingw64-%ARCH%-zlib ^ -P libiconv-devel,libunistring-devel,libncurses-devel ^ @@ -358,15 +382,13 @@ IF "%RUNSETUP%"=="Y" ( -P gtk-update-icon-cache ^ -P libtool,automake ^ -P intltool ^ - > "%LOGFILE%" ^ - || GOTO :Error + %EXTRAPACKAGES% ^ + || GOTO ErrorExit - MKDIR %CYGWIN_INSTALLDIR_WFMT%\build - MKDIR %CYGWIN_INSTALLDIR_WFMT%\build\buildlogs - MOVE "%LOGFILE%" %CYGWIN_INSTALLDIR_WFMT%\build\buildlogs\cygwinsetup.log || GOTO :Error + MKDIR "%CYGWIN_INSTALLDIR_WFMT%\build" + MKDIR "%CYGWIN_INSTALLDIR_WFMT%\build\buildlogs" ) - IF NOT "%CYGWIN_QUIET%" == "Y" ( REM Like most setup programs, cygwin setup starts the real setup as a separate process, so wait for it. REM This is not required with the -cygquiet=Y and the resulting --no-admin option. @@ -377,18 +399,24 @@ IF NOT "%CYGWIN_QUIET%" == "Y" ( ECHO ========== CONFIGURE CYGWIN USER ACCOUNT ========== -copy %BATCHDIR%\configure_profile.sh %CYGWIN_INSTALLDIR_WFMT%\var\tmp || GOTO :Error -%BASH% --login %CYGWIN_INSTALLDIR_CFMT%\var\tmp\configure_profile.sh %PROXY% || GOTO :Error +REM In case this batch file is called from a cygwin bash (e.g. a git repo) we need to clear +REM HOME (otherwise we get to the home directory of the other installation) +REM PROFILEREAD (this is set to true if the /etc/profile has been read, which creates user) +SET "HOME=" +SET "PROFILEREAD=" + +copy "%BATCHDIR%\configure_profile.sh" "%CYGWIN_INSTALLDIR_WFMT%\var\tmp" || GOTO ErrorExit +%BASH% --login "%CYGWIN_INSTALLDIR_CFMT%\var\tmp\configure_profile.sh" "%PROXY%" || GOTO ErrorExit ECHO ========== BUILD COQ ========== -MKDIR %CYGWIN_INSTALLDIR_WFMT%\build -MKDIR %CYGWIN_INSTALLDIR_WFMT%\build\patches +MKDIR "%CYGWIN_INSTALLDIR_WFMT%\build" +MKDIR "%CYGWIN_INSTALLDIR_WFMT%\build\patches" -COPY %BATCHDIR%\makecoq_mingw.sh %CYGWIN_INSTALLDIR_WFMT%\build || GOTO :Error -COPY %BATCHDIR%\patches_coq\*.* %CYGWIN_INSTALLDIR_WFMT%\build\patches || GOTO :Error +COPY "%BATCHDIR%\makecoq_mingw.sh" "%CYGWIN_INSTALLDIR_WFMT%\build" || GOTO ErrorExit +COPY "%BATCHDIR%\patches_coq\*.*" "%CYGWIN_INSTALLDIR_WFMT%\build\patches" || GOTO ErrorExit -%BASH% --login %CYGWIN_INSTALLDIR_CFMT%\build\makecoq_mingw.sh || GOTO :Error +%BASH% --login "%CYGWIN_INSTALLDIR_CFMT%\build\makecoq_mingw.sh" || GOTO ErrorExit ECHO ========== FINISHED ========== @@ -411,12 +439,13 @@ ECHO ========== BATCH FUNCTIONS ========== ECHO -proxy ^ ECHO -cygrepo ^ ECHO -cygcache ^ - ECHO -cyglocal ^ install cygwin from cache + ECHO -cyglocal ^ install cygwin from cache ECHO -cygquiet ^ install cygwin without user interaction ECHO -srccache ^ - ECHO -coqver ^ + ECHO -coqver ^ ECHO -gtksrc ^ build GTK ^(90 min^) or use cygwin version ECHO -threads ^<1..N^> Number of make threads + ECHO -addon ^ Enable building selected addon (can be repeated) ECHO( ECHO See ReadMe.txt for a detailed description of all parameters ECHO( @@ -426,9 +455,9 @@ ECHO ========== BATCH FUNCTIONS ========== ECHO -ocaml = %INSTALLOCAML% ECHO -installer= %MAKEINSTALLER% ECHO -make = %INSTALLMAKE% - ECHO -destcyg = %DESTCYG% - ECHO -destcoq = %DESTCOQ% - ECHO -setup = %SETUP% + ECHO -destcyg = %DESTCYG% + ECHO -destcoq = %DESTCOQ% + ECHO -setup = %SETUP% ECHO -proxy = %PROXY% ECHO -cygrepo = %CYGWIN_REPOSITORY% ECHO -cygcache = %CYGWIN_LOCAL_CACHE_WFMT% @@ -438,8 +467,22 @@ ECHO ========== BATCH FUNCTIONS ========== ECHO -coqver = %COQ_VERSION% ECHO -gtksrc = %GTK_FROM_SOURCES% ECHO -threads = %MAKE_THREADS% + ECHO -addon = %COQ_ADDONS% + GOTO :EOF + +:CheckYN + REM Reset errorlevel to 0 + CMD /c "EXIT /b 0" + IF "%2" == "Y" ( + REM OK Y + ) ELSE IF "%2" == "N" ( + REM OK N + ) ELSE ( + ECHO ERROR Parameter %1 must be Y or N, but is %2 + GOTO ErrorExit + ) GOTO :EOF -:Error -ECHO Building Coq failed with error code %errorlevel% -EXIT /b %errorlevel% +:ErrorExit + ECHO ERROR MakeCoq_MinGW.bat failed + EXIT /b 1 diff --git a/dev/build/windows/MakeCoq_SetRootPath.bat b/dev/build/windows/MakeCoq_SetRootPath.bat index 3a371172..bcb10477 100644 --- a/dev/build/windows/MakeCoq_SetRootPath.bat +++ b/dev/build/windows/MakeCoq_SetRootPath.bat @@ -1,3 +1,14 @@ +REM ========== COPYRIGHT/COPYLEFT ========== + +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== CHOOSE A SENSIBLE ROOT PATH ========== + @ ECHO OFF REM Figure out a root path for coq and cygwin diff --git a/dev/build/windows/MakeCoq_explicitcachefolders_installer.bat b/dev/build/windows/MakeCoq_explicitcachefolders_installer.bat new file mode 100755 index 00000000..d7d3c5b9 --- /dev/null +++ b/dev/build/windows/MakeCoq_explicitcachefolders_installer.bat @@ -0,0 +1,28 @@ +@ECHO OFF + +REM ========== COPYRIGHT/COPYLEFT ========== + +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== BUILD COQ ========== + +call MakeCoq_SetRootPath + +call MakeCoq_MinGW.bat ^ + -arch=64 ^ + -installer=Y ^ + -coqver=git-v8.6 ^ + -destcyg="%ROOTPATH%\cygwin_coq64_cachefolder_inst" ^ + -destcoq="%ROOTPATH%\coq64_cachefolder_inst" ^ + -cygcache="%ROOTPATH%\cache\cygwin" ^ + -srccache="%ROOTPATH%\cache\source" + +IF %ERRORLEVEL% NEQ 0 ( + ECHO MakeCoq_explicitcachefolders_installer.bat failed with error code %ERRORLEVEL% + EXIT /b %ERRORLEVEL% +) diff --git a/dev/build/windows/MakeCoq_local_installer.bat b/dev/build/windows/MakeCoq_local_installer.bat new file mode 100755 index 00000000..752b73c1 --- /dev/null +++ b/dev/build/windows/MakeCoq_local_installer.bat @@ -0,0 +1,26 @@ +@ECHO OFF + +REM ========== COPYRIGHT/COPYLEFT ========== + +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== BUILD COQ ========== + +call MakeCoq_SetRootPath + +call MakeCoq_MinGW.bat ^ + -arch=64 ^ + -installer=Y ^ + -coqver=/cygdrive/d/coqgit/coq-8.6 ^ + -destcyg="%ROOTPATH%\cygwin_coq64_local_inst" ^ + -destcoq="%ROOTPATH%\coq64_local_inst" + +IF %ERRORLEVEL% NEQ 0 ( + ECHO MakeCoq_local_installer.bat failed with error code %ERRORLEVEL% + EXIT /b %ERRORLEVEL% +) diff --git a/dev/build/windows/MakeCoq_regtest_noproxy.bat b/dev/build/windows/MakeCoq_regtest_noproxy.bat index 2b0b83fe..7140a7c6 100644 --- a/dev/build/windows/MakeCoq_regtest_noproxy.bat +++ b/dev/build/windows/MakeCoq_regtest_noproxy.bat @@ -1,7 +1,18 @@ +REM ========== COPYRIGHT/COPYLEFT ========== + +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== BUILD COQ ========== + call MakeCoq_SetRootPath SET HTTP_PROXY= -EXPORT HTTP_PROXY= +SET HTTPS_PROXY= MKDIR C:\Temp\srccache call MakeCoq_MinGW.bat ^ @@ -14,5 +25,5 @@ call MakeCoq_MinGW.bat ^ -cygquiet=Y ^ -destcyg %ROOTPATH%\cygwin_coq64_85pl2_abs ^ -destcoq %ROOTPATH%\coq64_85pl2_abs - -pause \ No newline at end of file + +pause diff --git a/dev/build/windows/MakeCoq_regtests.bat b/dev/build/windows/MakeCoq_regtests.bat index 6e36d014..74c26456 100644 --- a/dev/build/windows/MakeCoq_regtests.bat +++ b/dev/build/windows/MakeCoq_regtests.bat @@ -1,16 +1,36 @@ -SET COQREGTESTING=Y +REM ========== COPYRIGHT/COPYLEFT ========== -REM Bleeding edge -call MakeCoq_86git_abs_ocaml.bat -call MakeCoq_86git_installer.bat -call MakeCoq_86git_installer_32.bat -call MakeCoq_86git_abs_ocaml_gtksrc.bat +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== RUN REGRESSION TESTS FOR COQ BUILD SCRIPTS ========== + +SET COQREGTESTING=Y REM Current stable -call MakeCoq_85pl3_abs_ocaml.bat -call MakeCoq_85pl3_installer.bat -call MakeCoq_85pl3_installer_32.bat +call MakeCoq_86git_abs_ocaml.bat || GOTO Error +call MakeCoq_86git_installer.bat || GOTO Error +call MakeCoq_86git_installer_32.bat || GOTO Error REM Old but might still be used -call MakeCoq_85pl2_abs_ocaml.bat -call MakeCoq_84pl6_abs_ocaml.bat +call MakeCoq_85pl3_abs_ocaml.bat || GOTO Error +call MakeCoq_84pl6_abs_ocaml.bat || GOTO Error + +REM Special variants, e.g. for debugging +call MakeCoq_86git_abs_ocaml_gtksrc.bat || GOTO Error +call MakeCoq_local_installer.bat || GOTO Error +call MakeCoq_explicitcachefolders_installer.bat || GOTO Error + +REM Bleeding edge +call MakeCoq_trunk_installer.bat || GOTO Error + +ECHO MakeCoq_regtests.bat: All tests finished successfully +GOTO :EOF + +:Error +ECHO MakeCoq_regtests.bat failed with error code %ERRORLEVEL% +EXIT /b %ERRORLEVEL% diff --git a/dev/build/windows/MakeCoq_trunk_installer.bat b/dev/build/windows/MakeCoq_trunk_installer.bat new file mode 100755 index 00000000..f4f58273 --- /dev/null +++ b/dev/build/windows/MakeCoq_trunk_installer.bat @@ -0,0 +1,26 @@ +@ECHO OFF + +REM ========== COPYRIGHT/COPYLEFT ========== + +REM (C) 2016 Intel Deutschland GmbH +REM Author: Michael Soegtrop + +REM Released to the public by Intel under the +REM GNU Lesser General Public License Version 2.1 or later +REM See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +REM ========== BUILD COQ ========== + +call MakeCoq_SetRootPath + +call MakeCoq_MinGW.bat ^ + -arch=64 ^ + -installer=Y ^ + -coqver=git-trunk ^ + -destcyg="%ROOTPATH%\cygwin_coq64_trunk_inst" ^ + -destcoq="%ROOTPATH%\coq64_trunk_inst" + +IF %ERRORLEVEL% NEQ 0 ( + ECHO MakeCoq_86git_installer.bat failed with error code %ERRORLEVEL% + EXIT /b %ERRORLEVEL% +) diff --git a/dev/build/windows/ReadMe.txt b/dev/build/windows/ReadMe.txt index 0faf5bc5..93851aeb 100644 --- a/dev/build/windows/ReadMe.txt +++ b/dev/build/windows/ReadMe.txt @@ -1,3 +1,12 @@ +(C) 2016 Intel Deutschland GmbH +Author: Michael Soegtrop + +Released to the public by Intel under the +GNU Lesser General Public License Version 2.1 or later +See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +This license also applies to all files in the patches_coq subfolder. + ==================== Purpose / Goal ==================== The main purpose of these scripts is to build Coq for Windows in a reproducible @@ -52,6 +61,7 @@ The Script MakeCoq_MinGW does: - either installs MinGW GTK via Cygwin or compiles it fom sources - download, compile and install OCaml, CamlP5, Menhir, lablgtk - download, compile and install Coq +- download, compile and install selected addons - create a Windows installer (NSIS based) The parameters are described below. Mostly paths and the HTTP proxy need to be @@ -286,9 +296,16 @@ Default value: \source_cache The version of Coq to download and compile. -Possible values: 8.4pl6, 8.5pl2, 8.5pl3, git-v8.6 - Others might work, but are untested. +Possible values: 8.4pl6, 8.5pl2, 8.5pl3, 8.6 + (download from https://coq.inria.fr/distrib/V$COQ_VERSION/files/coq-.tar.gz) + Others versions might work, but are untested. 8.4 is only tested in mode=absoloute + + git-v8.6, git-trunk + (download from https://github.com/coq/coq/archive/.zip) + + /cygdrive/.... + Use local folder. The sources are archived as coq-local.tar.gz Default value: 8.5pl3 @@ -319,9 +336,15 @@ Possible values: 1..N. Should not be more than 1.5x the number of cores. Should not be more than available RAM/2GB (e.g. 4 for 8GB) +===== -addon ===== + +Enable build and installation of selected Coq package (can be repeated for +selecting more packages) ==================== TODO ==================== +- Check for spaces in destination paths +- Check for = signs in all paths (DOS commands don't work with pathes with = in it, possibly even when quoted) - Installer doesn't remove OCAMLLIB environment variables (it is in the script, but doesn't seem to work) - CoqIDE doesn't find theme files - Finish / test mingw_in_Cygwin mode (coqide doesn't start, coqc slow cause of scanning complete share folder) @@ -400,7 +423,6 @@ Binary file ./bin/coqchk.exe matches Binary file ./bin/coqdep.exe matches Binary file ./bin/coqdoc.exe matches Binary file ./bin/coqide.exe matches -Binary file ./bin/coqmktop.exe matches Binary file ./bin/coqtop.byte.exe matches Binary file ./bin/coqtop.exe matches Binary file ./bin/coqworkmgr.exe matches @@ -420,7 +442,6 @@ Binary file ./bin/ocamldoc.exe matches Binary file ./bin/ocamldoc.opt.exe matches Binary file ./bin/ocamlfind.exe matches Binary file ./bin/ocamlmklib.exe matches -Binary file ./bin/ocamlmktop.exe matches Binary file ./bin/ocamlobjinfo.exe matches Binary file ./bin/ocamlopt.exe matches Binary file ./bin/ocamlopt.opt.exe matches diff --git a/dev/build/windows/configure_profile.sh b/dev/build/windows/configure_profile.sh index 09a9cf35..16c972e8 100644 --- a/dev/build/windows/configure_profile.sh +++ b/dev/build/windows/configure_profile.sh @@ -1,5 +1,16 @@ #!/bin/bash +###################### COPYRIGHT/COPYLEFT ###################### + +# (C) 2016 Intel Deutschland GmbH +# Author: Michael Soegtrop +# +# Released to the public by Intel under the +# GNU Lesser General Public License Version 2.1 or later +# See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + +###################### CONFIGURE CYGWIN USER PROFILE FOR BUILDING COQ ###################### + rcfile=~/.bash_profile donefile=~/.bash_profile.upated @@ -7,7 +18,7 @@ if [ ! -f $donefile ] ; then echo >> $rcfile - if [ -n "$1" ]; then + if [ "$1" != "" -a "$1" != " " ]; then echo export http_proxy="http://$1" >> $rcfile echo export https_proxy="http://$1" >> $rcfile echo export ftp_proxy="http://$1" >> $rcfile @@ -29,4 +40,4 @@ if [ ! -f $donefile ] ; then echo unset OCAMLLIB >> $rcfile touch $donefile -fi \ No newline at end of file +fi diff --git a/dev/build/windows/difftar-folder.sh b/dev/build/windows/difftar-folder.sh index 65278d5c..cbcf14ec 100644 --- a/dev/build/windows/difftar-folder.sh +++ b/dev/build/windows/difftar-folder.sh @@ -8,35 +8,28 @@ # Released to the public by Intel under the # GNU Lesser General Public License Version 2.1 or later # See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html -# -# With very valuable help on building GTK from -# https://wiki.gnome.org/Projects/GTK+/Win32/MSVCCompilationOfGTKStack -# http://www.gaia-gis.it/spatialite-3.0.0-BETA/mingw64_how_to.html -###################### Script safety and debugging settings ###################### +###################### DIFF A TAR FILE AND A FOLDER ###################### set -o nounset # Print usage -if [ "$#" -lt 1 ] ; then +if [ "$#" -lt 2 ] ; then echo 'Diff a tar (or compressed tar) file with a folder' - echo 'difftar-folder.sh [] [strip]' - echo default for folder is . - echo default for strip is 0. - echo 'strip must be 0 or 1.' + echo 'difftar-folder.sh [strip]' + echo ' is the name of the tar file do diff with (required)' + echo ' is the name of the folder to diff with (required)' + echo ' is the number of path components to strip from tar file (default is 0)' + echo 'All files in the tar file must have at least path components.' + echo 'This also adds new files from folder.new, if folder.new exists' exit 1 fi # Parse parameters tarfile=$1 - -if [ "$#" -ge 2 ] ; then - folder=$2 -else - folder=. -fi +folder=$2 if [ "$#" -ge 3 ] ; then strip=$3 @@ -47,27 +40,33 @@ fi # Get path prefix if --strip is used if [ "$strip" -gt 0 ] ; then - prefix=`tar -t -f $tarfile | head -1` + # Get the path/name of the first file from teh tar and extract the first $strip path components + # This assumes that the first file in the tar file has at least $strip many path components + prefix=$(tar -t -f $tarfile | head -1 | cut -d / -f -$strip)/ else prefix= fi # Original folder -if [ "$strip" -gt 0 ] ; then - orig=${prefix%/}.orig -elif [ "$folder" = "." ] ; then - orig=${tarfile##*/} - orig=./${orig%%.tar*}.orig -elif [ "$folder" = "" ] ; then - orig=${tarfile##*/} - orig=${orig%%.tar*}.orig -else - orig=$folder.orig -fi -echo $orig +orig=$folder.orig mkdir -p "$orig" +# New amd empty filefolder + +new=$folder.new +empty=$folder.empty +mkdir -p "$empty" + +# Print information (this is ignored by patch) + +echo diff/patch file created on $(date) with: +echo difftar-folder.sh $@ +echo TARFILE= $tarfile +echo FOLDER= $folder +echo TARSTRIP= $strip +echo TARPREFIX= $prefix +echo ORIGFOLDER= $orig # Make sure tar uses english output (for Mod time differs) export LC_ALL=C @@ -83,4 +82,8 @@ tar --diff -a -f "$tarfile" --strip $strip --directory "$folder" | grep "Mod tim # Compute diff diff -u "$orig/$file" "$folder/$file" fi -done \ No newline at end of file +done + +if [ -d "$new" ] ; then + diff -u -r --unidirectional-new-file $empty $new +fi diff --git a/dev/build/windows/makecoq_mingw.sh b/dev/build/windows/makecoq_mingw.sh old mode 100644 new mode 100755 index 52b15887..86cc5f2d --- a/dev/build/windows/makecoq_mingw.sh +++ b/dev/build/windows/makecoq_mingw.sh @@ -2,7 +2,7 @@ ###################### COPYRIGHT/COPYLEFT ###################### -# (C) 2016 Intel Deutschland GmbH +# (C) 2016..2018 Intel Deutschland GmbH # Author: Michael Soegtrop # # Released to the public by Intel under the @@ -18,6 +18,8 @@ set -o nounset set -o errexit set -x +# Print current wall time as part of the xtrace +export PS4='+\t ' # Set this to 1 if all module directories shall be removed before build (no incremental make) RMDIR_BEFORE_BUILD=1 @@ -67,7 +69,7 @@ RMDIR_BEFORE_BUILD=1 ###################### ARCHITECTURES ##################### # The OS on which the build of the tool/lib runs -BUILD=`gcc -dumpmachine` +BUILD=$(gcc -dumpmachine) # The OS on which the tool runs # "`find /bin -name "*mingw32-gcc.exe"`" -dumpmachine @@ -98,6 +100,8 @@ mkdir -p $TARBALLS mkdir -p $FILELISTS cd /build +# Create source cache folder +mkdir -p "$SOURCE_LOCAL_CACHE_CFMT" # sysroot prefix for the above /build/host/target combination PREFIX=$CYGWIN_INSTALLDIR_MFMT/usr/$TARGET_ARCH/sys-root/mingw @@ -112,9 +116,16 @@ else PREFIXOCAML=$PREFIX fi -mkdir -p $PREFIX/bin -mkdir -p $PREFIXCOQ/bin -mkdir -p $PREFIXOCAML/bin +mkdir -p "$PREFIX/bin" +mkdir -p "$PREFIXCOQ/bin" +mkdir -p "$PREFIXOCAML/bin" + +# This is required for building addons and plugins +# This must be CFMT (/cygdrive/c/...) otherwise coquelicot 3.0.2 configure fails. +# coquelicot uses which ${COQBIN}/coqc to check if coqc exists. This does not work with COQBIN in MFMT. +export COQBIN=$RESULT_INSTALLDIR_CFMT/bin/ +# This must be MFMT (C:/) otherwise bignums 68a7a3d7e0b21985913a6c3ee12067f4c5ac4e20 fails +export COQLIB=$RESULT_INSTALLDIR_MFMT/lib/coq/ ###################### Copy Cygwin Setup Info ##################### @@ -128,36 +139,92 @@ CYGWIN_REPO_FOLDER=${CYGWIN_REPO_FOLDER//:/%3a} CYGWIN_REPO_FOLDER=${CYGWIN_REPO_FOLDER//\//%2f} # Copy files -cp $CYGWIN_LOCAL_CACHE_WFMT/$CYGWIN_REPO_FOLDER/$CYGWINARCH/setup.ini $TARBALLS +cp "$CYGWIN_LOCAL_CACHE_WFMT/$CYGWIN_REPO_FOLDER/$CYGWINARCH/setup.ini" $TARBALLS cp /etc/setup/installed.db $TARBALLS - + ###################### LOGGING ##################### # The folder which receives log files mkdir -p buildlogs -LOGS=`pwd`/buildlogs +LOGS=$(pwd)/buildlogs # The current log target (first part of the log file name) LOGTARGET=other -log1() { - "$@" > $LOGS/$LOGTARGET-$1.log 2> $LOGS/$LOGTARGET-$1.err -} +# For an explanation of ${COQREGTESTING:-N} search for ${parameter:-word} in +# http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html + +if [ "${COQREGTESTING:-N}" == "Y" ] ; then + # If COQREGTESTING, log to log files only + # Log command output - take log target name from command name (like log1 make => log target is "-make") + log1() { + { local -; set +x; } 2> /dev/null + "$@" >"$LOGS/$LOGTARGET-$1.log" 2>"$LOGS/$LOGTARGET-$1.err" + } + + # Log command output - take log target name from command name and first argument (like log2 make install => log target is "-make-install") + log2() { + { local -; set +x; } 2> /dev/null + "$@" >"$LOGS/$LOGTARGET-$1-$2.log" 2>"$LOGS/$LOGTARGET-$1-$2.err" + } + + # Log command output - take log target name from command name and second argument (like log_1_3 ocaml setup.ml -configure => log target is "-ocaml--configure") + log_1_3() { + { local -; set +x; } 2> /dev/null + "$@" >"$LOGS/$LOGTARGET-$1-$3.log" 2>"$LOGS/$LOGTARGET-$1-$3.err" + } + + # Log command output - log target name is first argument (like logn untar tar xvaf ... => log target is "-untar") + logn() { + { local -; set +x; } 2> /dev/null + LOGTARGETEX=$1 + shift + "$@" >"$LOGS/$LOGTARGET-$LOGTARGETEX.log" 2>"$LOGS/$LOGTARGET-$LOGTARGETEX.err" + } +else + # If COQREGTESTING, log to log files and console + # Log command output - take log target name from command name (like log1 make => log target is "-make") + log1() { + { local -; set +x; } 2> /dev/null + "$@" > >(tee "$LOGS/$LOGTARGET-$1.log" | sed -e "s/^/$LOGTARGET-$1.log: /") 2> >(tee "$LOGS/$LOGTARGET-$1.err" | sed -e "s/^/$LOGTARGET-$1.err: /" 1>&2) + } + + # Log command output - take log target name from command name and first argument (like log2 make install => log target is "-make-install") + log2() { + { local -; set +x; } 2> /dev/null + "$@" > >(tee "$LOGS/$LOGTARGET-$1-$2.log" | sed -e "s/^/$LOGTARGET-$1-$2.log: /") 2> >(tee "$LOGS/$LOGTARGET-$1-$2.err" | sed -e "s/^/$LOGTARGET-$1-$2.err: /" 1>&2) + } + + # Log command output - take log target name from command name and second argument (like log_1_3 ocaml setup.ml -configure => log target is "-ocaml--configure") + log_1_3() { + { local -; set +x; } 2> /dev/null + "$@" > >(tee "$LOGS/$LOGTARGET-$1-$3.log" | sed -e "s/^/$LOGTARGET-$1-$3.log: /") 2> >(tee "$LOGS/$LOGTARGET-$1-$3.err" | sed -e "s/^/$LOGTARGET-$1-$3.err: /" 1>&2) + } + + # Log command output - log target name is first argument (like logn untar tar xvaf ... => log target is "-untar") + logn() { + { local -; set +x; } 2> /dev/null + LOGTARGETEX=$1 + shift + "$@" > >(tee "$LOGS/$LOGTARGET-$LOGTARGETEX.log" | sed -e "s/^/$LOGTARGET-$LOGTARGETEX.log: /") 2> >(tee "$LOGS/$LOGTARGET-$LOGTARGETEX.err" | sed -e "s/^/$LOGTARGET-$LOGTARGETEX.err: /" 1>&2) + } +fi -log2() { - "$@" > $LOGS/$LOGTARGET-$1-$2.log 2> $LOGS/$LOGTARGET-$1-$2.err -} +###################### 'UNFIX' SED ##################### -log_1_3() { - "$@" > $LOGS/$LOGTARGET-$1-$3.log 2> $LOGS/$LOGTARGET-$1-$3.err -} +# In Cygwin SED used to do CR-LF to LF conversion, but since sed 4.4-1 this was changed +# We replace sed with a shell script which restores the old behavior for piped input + +#if [ -f /bin/sed.exe ] +#then +# mv /bin/sed.exe /bin/sed_orig.exe +#fi +#cat > /bin/sed << EOF +##!/bin/sh +#dos2unix | /bin/sed_orig.exe "$@" +#EOF +#chmod a+x /bin/sed -logn() { - LOGTARGETEX=$1 - shift - "$@" > $LOGS/$LOGTARGET-$LOGTARGETEX.log 2> $LOGS/$LOGTARGET-$LOGTARGETEX.err -} - ###################### UTILITY FUNCTIONS ##################### # ------------------------------------------------------------------------------ @@ -166,7 +233,7 @@ logn() { # - create build folder # - extract source archive # - patch source file if patch exists -# +# # Parameters # $1 file server name including protocol prefix # $2 file name (without extension) @@ -189,62 +256,68 @@ function get_expand_source_tar { else name=$2 fi - + if [ "$#" -ge 6 ] ; then folder=$6 else folder=$name fi - + # Set logging target logtargetold=$LOGTARGET LOGTARGET=$name - + # Get the source archive either from the source cache or online - if [ ! -f $TARBALLS/$name.$3 ] ; then - if [ -f $SOURCE_LOCAL_CACHE_CFMT/$name.$3 ] ; then - cp $SOURCE_LOCAL_CACHE_CFMT/$name.$3 $TARBALLS + if [ ! -f "$TARBALLS/$name.$3" ] ; then + if [ -f "$SOURCE_LOCAL_CACHE_CFMT/$name.$3" ] ; then + cp "$SOURCE_LOCAL_CACHE_CFMT/$name.$3" "$TARBALLS" else - wget $1/$2.$3 + wget --progress=dot:giga "$1/$2.$3" + if file -i "$2.$3" | grep text/html; then + echo Download failed: "$1/$2.$3" + echo The file wget downloaded is an html file: + cat "$2.$3" + exit 1 + fi if [ ! "$2.$3" == "$name.$3" ] ; then - mv $2.$3 $name.$3 + mv "$2.$3" "$name.$3" fi - mv $name.$3 $TARBALLS + mv "$name.$3" "$TARBALLS" # Save the source archive in the source cache - if [ -d $SOURCE_LOCAL_CACHE_CFMT ] ; then - cp $TARBALLS/$name.$3 $SOURCE_LOCAL_CACHE_CFMT + if [ -d "$SOURCE_LOCAL_CACHE_CFMT" ] ; then + cp "$TARBALLS/$name.$3" "$SOURCE_LOCAL_CACHE_CFMT" fi fi fi - + # Remove build directory (clean build) if [ $RMDIR_BEFORE_BUILD -eq 1 ] ; then - rm -f -r $folder + rm -f -r "$folder" fi - + # Create build directory and cd - mkdir -p $folder - cd $folder - + mkdir -p "$folder" + cd "$folder" + # Extract source archive if [ "$3" == "zip" ] ; then - log1 unzip $TARBALLS/$name.$3 + log1 unzip "$TARBALLS/$name.$3" if [ "$strip" == "1" ] ; then - # Ok, this is dirty, but it works and it fails if there are name clashes - mv */* . + # move subfolders of root folders one level up + find "$(ls)" -mindepth 1 -maxdepth 1 -exec mv -- "{}" . \; else echo "Unzip strip count not supported" return 1 fi else - logn untar tar xvaf $TARBALLS/$name.$3 --strip $strip + logn untar tar xvaf "$TARBALLS/$name.$3" --strip $strip fi - + # Patch if patch file exists - if [ -f $PATCHES/$name.patch ] ; then - log1 patch -p1 -i $PATCHES/$name.patch + if [ -f "$PATCHES/$name.patch" ] ; then + log1 patch -p1 -i "$PATCHES/$name.patch" fi - + # Go back to base folder cd .. @@ -260,7 +333,7 @@ function get_expand_source_tar { # - cd to build folder and extract source archive # - create bin_special subfolder and add it to $PATH # - remember things for build_post -# +# # Parameters # $1 file server name including protocol prefix # $2 file name (without extension) @@ -282,31 +355,89 @@ function build_prep { else name=$2 fi - + + # Set installer section to not set by default + installersection= + # Check if build is already done - if [ ! -f flagfiles/$name.finished ] ; then + if [ ! -f "$FLAGFILES/$name.finished" ] ; then BUILD_PACKAGE_NAME=$name BUILD_OLDPATH=$PATH - BUILD_OLDPWD=`pwd` + BUILD_OLDPWD=$(pwd) LOGTARGET=$name - touch flagfiles/$name.started - - get_expand_source_tar $1 $2 $3 $strip $name - - cd $name - + touch "$FLAGFILES/$name.started" + + get_expand_source_tar "$1" "$2" "$3" "$strip" "$name" + + cd "$name" + # Create a folder and add it to path, where we can put special binaries # The path is restored in build_post mkdir bin_special - PATH=`pwd`/bin_special:$PATH - + PATH=$(pwd)/bin_special:$PATH + return 0 - else + else return 1 fi } +# ------------------------------------------------------------------------------ +# Like build_prep, but gets the data from an entry in ci-basic-overlay.sh +# This assumes the following definitions exist in ci-basic-overlay.sh, +# or in a file in the user-overlays folder: +# $1_CI_REF +# $1_CI_ARCHIVEURL +# $1_CI_GITURL +# ATTENTION: variables in ci-basic-overlay.sh are loaded by load_overlay_data. +# load_overlay_data is is called at the end of make_coq (even if the build is skipped) +# +# Parameters +# $1 base name of module in ci-basic-overlay.sh, e.g. mathcomp, bignums, ... +# ------------------------------------------------------------------------------ + +function build_prep_overlay { + urlvar=$1_CI_ARCHIVEURL + gitvar=$1_CI_GITURL + refvar=$1_CI_REF + url=${!urlvar} + git=${!gitvar} + ref=${!refvar} + ver=$(git ls-remote "$git" "refs/heads/$ref" | cut -f 1) + if [[ "$ver" == "" ]]; then + # $1_CI_REF must have been a tag or hash, not a branch + ver="$ref" + fi + build_prep "$url" "$ver" tar.gz 1 "$1-$ver" +} + +# ------------------------------------------------------------------------------ +# Load overlay version variables from ci-basic-overlay.sh and user-overlays/*.sh +# ------------------------------------------------------------------------------ + +function load_overlay_data { + if [ -n "${GITLAB_CI+}" ]; then + export CI_BRANCH="$CI_COMMIT_REF_NAME" + if [[ ${CI_BRANCH#pr-} =~ ^[0-9]*$ ]]; then + export CI_PULL_REQUEST="${CI_BRANCH#pr-}" + else + export CI_PULL_REQUEST="" + fi + else + export CI_BRANCH="" + export CI_PULL_REQUEST="" + # Used when building 8.8.0 with the latest scripts + export TRAVIS_BRANCH="" + export TRAVIS_PULL_REQUEST="" + fi + + for overlay in /build/user-overlays/*.sh; do + . "$overlay" + done + . /build/ci-basic-overlay.sh +} + # ------------------------------------------------------------------------------ # Finalize a module build # - create name.finished @@ -314,11 +445,12 @@ function build_prep { # ------------------------------------------------------------------------------ function build_post { - if [ ! -f flagfiles/$BUILD_PACKAGE_NAME.finished ]; then - cd $BUILD_OLDPWD - touch flagfiles/$BUILD_PACKAGE_NAME.finished + if [ ! -f "$FLAGFILES/$BUILD_PACKAGE_NAME.finished" ]; then + cd "$BUILD_OLDPWD" + touch "$FLAGFILES/$BUILD_PACKAGE_NAME.finished" PATH=$BUILD_OLDPATH LOGTARGET=other + installer_addon_end fi } @@ -339,9 +471,10 @@ function build_post { # ------------------------------------------------------------------------------ function build_conf_make_inst { - if build_prep $1 $2 $3 ; then + if build_prep "$1" "$2" "$3" ; then $4 - logn configure ./configure --build=$BUILD --host=$HOST --target=$TARGET --prefix=$PREFIX "${@:5}" + logn configure ./configure --build="$BUILD" --host="$HOST" --target="$TARGET" --prefix="$PREFIX" "${@:5}" + # shellcheck disable=SC2086 log1 make $MAKE_OPT log2 make install log2 make clean @@ -353,18 +486,17 @@ function build_conf_make_inst { # Install all files given by a glob pattern to a given folder # # parameters -# $1 glob pattern (in '') -# $2 target folder +# $1 source path +# $2 pattern (in '') +# $3 target folder # ------------------------------------------------------------------------------ function install_glob { - # Check if any files matching the pattern exist - if [ "$(echo $1)" != "$1" ] ; then - install -D -t $2 $1 - fi + SRCDIR=$(realpath -m $1) + DESTDIR=$(realpath -m $3) + ( cd "$SRCDIR" && find . -maxdepth 1 -type f -name "$2" -exec install -D -T "$SRCDIR"/{} "$DESTDIR"/{} \; ) } - # ------------------------------------------------------------------------------ # Recursively Install all files given by a glob pattern to a given folder # @@ -375,12 +507,15 @@ function install_glob { # ------------------------------------------------------------------------------ function install_rec { - ( cd $1 && find -type f -name "$2" -exec install -D -T $1/{} $3/{} \; ) + SRCDIR=$(realpath -m $1) + DESTDIR=$(realpath -m $3) + ( cd "$SRCDIR" && find . -type f -name "$2" -exec install -D -T "$SRCDIR"/{} "$DESTDIR"/{} \; ) } # ------------------------------------------------------------------------------ # Write a file list of the target folder # The file lists are used to create file lists for the windows installer +# Don't overwrite an existing file list # # parameters # $1 name of file list @@ -388,10 +523,23 @@ function install_rec { function list_files { if [ ! -e "/build/filelists/$1" ] ; then - ( cd $PREFIXCOQ && find -type f | sort > /build/filelists/$1 ) + ( cd "$PREFIXCOQ" && find . -type f | sort > /build/filelists/"$1" ) fi } +# ------------------------------------------------------------------------------ +# Write a file list of the target folder +# The file lists are used to create file lists for the windows installer +# Do overwrite an existing file list +# +# parameters +# $1 name of file list +# ------------------------------------------------------------------------------ + +function list_files_always { + ( cd "$PREFIXCOQ" && find . -type f | sort > /build/filelists/"$1" ) +} + # ------------------------------------------------------------------------------ # Compute the set difference of two file lists # @@ -416,7 +564,7 @@ function diff_files { # ------------------------------------------------------------------------------ function filter_files { - egrep "$3" "/build/filelists/$2" > "/build/filelists/$1" + grep -E "$3" "/build/filelists/$2" > "/build/filelists/$1" } # ------------------------------------------------------------------------------ @@ -430,28 +578,124 @@ function files_to_nsis { # Split the path in the file list into path and filename and create SetOutPath and File instructions # Note: File /oname cannot be used, because it does not create the paths as SetOutPath does # Note: I didn't check if the redundant SetOutPath instructions have a bad impact on installer size or install time - cat "/build/filelists/$1" | tr '/' '\\' | sed -r 's/^\.(.*)\\([^\\]+)$/SetOutPath $INSTDIR\\\1\nFile ${COQ_SRC_PATH}\\\1\\\2/' > "/build/filelists/$1.nsh" + tr '/' '\\' < "/build/filelists/$1" | sed -r 's/^\.(.*)\\([^\\]+)$/SetOutPath $INSTDIR\\\1\nFile ${COQ_SRC_PATH}\\\1\\\2/' > "/build/filelists/$1.nsh" } +# ------------------------------------------------------------------------------ +# Create an nsis installer addon section +# +# parameters +# $1 identifier of installer section and base name of file list files +# $2 human readable name of section +# $3 description of section +# $4 flags (space separated list of keywords): off = default off +# +# $1 must be a valid NSIS identifier! +# ------------------------------------------------------------------------------ + +function installer_addon_section { + installersection=$1 + list_files "addon_pre_$installersection" + + echo 'LangString' "DESC_$1" '${LANG_ENGLISH}' "\"$3\"" >> "/build/filelists/addon_strings.nsh" + + echo '!insertmacro MUI_DESCRIPTION_TEXT' '${'"Sec_$1"'}' '$('"DESC_$1"')' >> "/build/filelists/addon_descriptions.nsh" + + local sectionoptions= + if [[ "$4" == *off* ]] ; then sectionoptions+=" /o" ; fi + + echo "Section $sectionoptions \"$2\" Sec_$1" >> "/build/filelists/addon_sections.nsh" + echo 'SetOutPath "$INSTDIR\"' >> "/build/filelists/addon_sections.nsh" + echo '!include "..\..\..\filelists\addon_'"$1"'.nsh"' >> "/build/filelists/addon_sections.nsh" + echo 'SectionEnd' >> "/build/filelists/addon_sections.nsh" +} + +# ------------------------------------------------------------------------------ +# Start an installer addon dependency group +# +# parameters +# $1 identifier of the section which depends on other sections +# The parameters must match the $1 parameter of a installer_addon_section call +# ------------------------------------------------------------------------------ + +dependencysections= + +function installer_addon_dependency_beg { + installer_addon_dependency "$1" + dependencysections="$1 $dependencysections" +} + +# ------------------------------------------------------------------------------ +# End an installer addon dependency group +# ------------------------------------------------------------------------------ + +function installer_addon_dependency_end { + set -- $dependencysections + shift + dependencysections="$*" +} + +# ------------------------------------------------------------------------------ +# Create an nsis installer addon dependency entry +# This needs to be bracketed with installer_addon_dependencies_beg/end +# +# parameters +# $1 identifier of the section on which other sections might depend +# The parameters must match the $1 parameter of a installer_addon_section call +# ------------------------------------------------------------------------------ + +function installer_addon_dependency { + for section in $dependencysections ; do + echo '${CheckSectionDependency} ${Sec_'"$section"'} ${Sec_'"$1"'} '"'$section' '$1'" >> "/build/filelists/addon_dependencies.nsh" + done +} + +# ------------------------------------------------------------------------------ +# Finish an installer section after an addon build +# +# This creates the file list files +# +# parameters: none +# ------------------------------------------------------------------------------ + +function installer_addon_end { + if [ -n "$installersection" ]; then + list_files "addon_post_$installersection" + diff_files "addon_$installersection" "addon_post_$installersection" "addon_pre_$installersection" + files_to_nsis "addon_$installersection" + fi +} ###################### MODULE BUILD FUNCTIONS ##################### +##### SED ##### + +function make_sed { + if build_prep https://ftp.gnu.org/gnu/sed/ sed-4.2.2 tar.gz ; then + logn configure ./configure + log1 make + log2 make install + log2 make clean + build_post + fi +} + ##### LIBPNG ##### function make_libpng { - build_conf_make_inst http://prdownloads.sourceforge.net/libpng libpng-1.6.18 tar.gz true + build_conf_make_inst http://prdownloads.sourceforge.net/libpng libpng-1.6.34 tar.gz true } ##### PIXMAN ##### function make_pixman { - build_conf_make_inst http://cairographics.org/releases pixman-0.32.8 tar.gz true + build_conf_make_inst http://cairographics.org/releases pixman-0.34.0 tar.gz true } ##### FREETYPE ##### function make_freetype { - build_conf_make_inst http://sourceforge.net/projects/freetype/files/freetype2/2.6.1 freetype-2.6.1 tar.bz2 true + build_conf_make_inst http://sourceforge.net/projects/freetype/files/freetype2/2.9.1 freetype-2.9.1 tar.bz2 true } ##### EXPAT ##### @@ -466,8 +710,8 @@ function make_fontconfig { make_freetype make_expat # CONFIGURE PARAMETERS - # build/install fails without --disable-docs - build_conf_make_inst http://www.freedesktop.org/software/fontconfig/release fontconfig-2.11.94 tar.gz true --disable-docs + # build/install fails without --disable-docs + build_conf_make_inst http://www.freedesktop.org/software/fontconfig/release fontconfig-2.12.93 tar.gz true --disable-docs } ##### ICONV ##### @@ -497,7 +741,7 @@ function make_ncurses { # # CONFIGURE PARAMETERS # --enable-term-driver --enable-sp-funcs is rewuired for mingw (see README.MinGW) - # additional changes + # additional changes # ADD --with-pkg-config # ADD --enable-pc-files # ADD --without-manpages @@ -547,8 +791,7 @@ function make_glib { make_gettext make_libffi make_libpcre - # build_conf_make_inst http://ftp.gnome.org/pub/gnome/sources/glib/2.46 glib-2.46.0 tar.xz true - build_conf_make_inst http://ftp.gnome.org/pub/gnome/sources/glib/2.47 glib-2.47.5 tar.xz true + build_conf_make_inst http://ftp.gnome.org/pub/gnome/sources/glib/2.57 glib-2.57.1 tar.xz true } ##### ATK ##### @@ -556,7 +799,7 @@ function make_glib { function make_atk { make_gettext make_glib - build_conf_make_inst http://ftp.gnome.org/pub/gnome/sources/atk/2.18 atk-2.18.0 tar.xz true + build_conf_make_inst http://ftp.gnome.org/pub/gnome/sources/atk/2.29 atk-2.29.1 tar.xz true } ##### PIXBUF ##### @@ -569,7 +812,7 @@ function make_gdk-pixbuf { # CONFIGURE PARAMETERS # --with-included-loaders=yes statically links the image file format handlers # This avoids "Cannot open pixbuf loader module file '/usr/x86_64-w64-mingw32/sys-root/mingw/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache': No such file or directory" - build_conf_make_inst http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.32 gdk-pixbuf-2.32.1 tar.xz true --with-included-loaders=yes + build_conf_make_inst http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.36 gdk-pixbuf-2.36.12 tar.xz true --with-included-loaders=yes } ##### CAIRO ##### @@ -580,7 +823,7 @@ function make_cairo { make_glib make_pixman make_fontconfig - build_conf_make_inst http://cairographics.org/releases cairo-1.14.2 tar.xz true + build_conf_make_inst http://cairographics.org/releases rcairo-1.15.13 tar.xz true } ##### PANGO ##### @@ -589,7 +832,7 @@ function make_pango { make_cairo make_glib make_fontconfig - build_conf_make_inst http://ftp.gnome.org/pub/GNOME/sources/pango/1.38 pango-1.38.0 tar.xz true + build_conf_make_inst http://ftp.gnome.org/pub/GNOME/sources/pango/1.42 pango-1.42.1 tar.xz true } ##### GTK2 ##### @@ -606,7 +849,7 @@ function make_gtk2 { make_pango make_gdk-pixbuf make_cairo - build_conf_make_inst http://ftp.gnome.org/pub/gnome/sources/gtk+/2.24 gtk+-2.24.28 tar.xz patch_gtk2 + build_conf_make_inst http://ftp.gnome.org/pub/gnome/sources/gtk+/2.24 gtk+-2.24.32 tar.xz patch_gtk2 fi } @@ -619,11 +862,11 @@ function make_gtk3 { make_gdk-pixbuf make_cairo make_libepoxy - build_conf_make_inst http://ftp.gnome.org/pub/gnome/sources/gtk+/3.16 gtk+-3.16.7 tar.xz true + build_conf_make_inst http://ftp.gnome.org/pub/gnome/sources/gtk+/3.22 gtk+-3.22.30 tar.xz true # make all incl. tests and examples runs through fine - # make install fails with issue with - # + # make install fails with issue with + # # make[5]: Entering directory '/home/soegtrop/GTK/gtk+-3.16.7/demos/gtk-demo' # test -n "" || ../../gtk/gtk-update-icon-cache --ignore-theme-index --force "/usr/x86_64-w64-mingw32/sys-root/mingw/share/icons/hicolor" # gtk-update-icon-cache.exe: Failed to open file /usr/x86_64-w64-mingw32/sys-root/mingw/share/icons/hicolor/.icon-theme.cache : No such file or directory @@ -639,9 +882,10 @@ function make_libxml2 { # Note: latest release version 2.9.2 fails during configuring lzma, so using 2.9.1 # Note: python binding requires which doesn't exist on cygwin if build_prep https://git.gnome.org/browse/libxml2/snapshot libxml2-2.9.1 tar.xz ; then - # ./autogen.sh --build=$BUILD --host=$HOST --target=$TARGET --prefix=$PREFIX --disable-shared --without-python + # ./autogen.sh --build=$BUILD --host=$HOST --target=$TARGET --prefix="$PREFIX" --disable-shared --without-python # shared library required by gtksourceview - ./autogen.sh --build=$BUILD --host=$HOST --target=$TARGET --prefix=$PREFIX --without-python + ./autogen.sh --build="$BUILD" --host="$HOST" --target="$TARGET" --prefix="$PREFIX" --without-python + # shellcheck disable=SC2086 log1 make $MAKE_OPT all log2 make install log2 make clean @@ -673,13 +917,13 @@ function make_gtk_sourceview2 { # Install flexdll objects function install_flexdll { - cp flexdll.h /usr/$TARGET_ARCH/sys-root/mingw/include + cp flexdll.h "/usr/$TARGET_ARCH/sys-root/mingw/include" if [ "$TARGET_ARCH" == "i686-w64-mingw32" ]; then - cp flexdll*_mingw.o /usr/$TARGET_ARCH/bin - cp flexdll*_mingw.o $PREFIXOCAML/bin + cp flexdll*_mingw.o "/usr/$TARGET_ARCH/bin" + cp flexdll*_mingw.o "$PREFIXOCAML/bin" elif [ "$TARGET_ARCH" == "x86_64-w64-mingw32" ]; then - cp flexdll*_mingw64.o /usr/$TARGET_ARCH/bin - cp flexdll*_mingw64.o $PREFIXOCAML/bin + cp flexdll*_mingw64.o "/usr/$TARGET_ARCH/bin" + cp flexdll*_mingw64.o "$PREFIXOCAML/bin" else echo "Unknown target architecture" return 1 @@ -689,16 +933,16 @@ function install_flexdll { # Install flexlink function install_flexlink { - cp flexlink.exe /usr/$TARGET_ARCH/bin - - cp flexlink.exe $PREFIXOCAML/bin + cp flexlink.exe "/usr/$TARGET_ARCH/bin" + + cp flexlink.exe "$PREFIXOCAML/bin" } # Get binary flexdll flexlink for building OCaml # An alternative is to first build an OCaml without shared library support and build flexlink with it function get_flex_dll_link_bin { - if build_prep http://alain.frisch.fr/flexdll flexdll-bin-0.34 zip 1 ; then + if build_prep https://github.com/alainfrisch/flexdll/releases/download/0.37/ flexdll-bin-0.37 zip 1 ; then install_flexdll install_flexlink build_post @@ -708,10 +952,12 @@ function get_flex_dll_link_bin { # Build flexdll and flexlink from sources after building OCaml function make_flex_dll_link { - if build_prep http://alain.frisch.fr/flexdll flexdll-0.34 tar.gz ; then + if build_prep https://github.com/alainfrisch/flexdll/releases/download/0.37/ flexdll-bin-0.37 zip ; then if [ "$TARGET_ARCH" == "i686-w64-mingw32" ]; then + # shellcheck disable=SC2086 log1 make $MAKE_OPT build_mingw flexlink.exe elif [ "$TARGET_ARCH" == "x86_64-w64-mingw32" ]; then + # shellcheck disable=SC2086 log1 make $MAKE_OPT build_mingw64 flexlink.exe else echo "Unknown target architecture" @@ -731,15 +977,15 @@ function make_flex_dll_link { # For this purpose hard links are better. function make_ln { - if [ ! -f flagfiles/myln.finished ] ; then - touch flagfiles/myln.started + if [ ! -f $FLAGFILES/myln.finished ] ; then + touch $FLAGFILES/myln.started mkdir -p myln - cd myln + ( cd myln cp $PATCHES/ln.c . - $TARGET_ARCH-gcc -DUNICODE -D_UNICODE -DIGNORE_SYMBOLIC -mconsole -o ln.exe ln.c - install -D ln.exe $PREFIXCOQ/bin/ln.exe - cd .. - touch flagfiles/myln.finished + "$TARGET_ARCH-gcc" -DUNICODE -D_UNICODE -DIGNORE_SYMBOLIC -mconsole -o ln.exe ln.c + install -D ln.exe "$PREFIXCOQ/bin/ln.exe" + ) + touch $FLAGFILES/myln.finished fi } @@ -747,11 +993,10 @@ function make_ln { function make_ocaml { get_flex_dll_link_bin - if build_prep http://caml.inria.fr/pub/distrib/ocaml-4.02 ocaml-4.02.3 tar.gz 1 ; then - # if build_prep http://caml.inria.fr/pub/distrib/ocaml-4.01 ocaml-4.01.0 tar.gz 1 ; then - # See README.win32 - cp config/m-nt.h config/m.h - cp config/s-nt.h config/s.h + if build_prep https://github.com/ocaml/ocaml/archive 4.07.0 tar.gz 1 ocaml-4.07.0 ; then + # See README.win32.adoc + cp config/m-nt.h byterun/caml/m.h + cp config/s-nt.h byterun/caml/s.h if [ "$TARGET_ARCH" == "i686-w64-mingw32" ]; then cp config/Makefile.mingw config/Makefile elif [ "$TARGET_ARCH" == "x86_64-w64-mingw32" ]; then @@ -762,15 +1007,16 @@ function make_ocaml { fi # Prefix is fixed in make file - replace it with the real one + # TODO: this might not work if PREFIX contains spaces sed -i "s|^PREFIX=.*|PREFIX=$PREFIXOCAML|" config/Makefile - - # We don't want to mess up Coq's dirctory structure so put the OCaml library in a separate folder - # If we refer to the make variable ${PREFIX} below, camlp4 ends up having a wrong path: + + # We don't want to mess up Coq's directory structure so put the OCaml library in a separate folder + # If we refer to the make variable ${PREFIX} below, camlp5 ends up having the wrong path: # D:\bin\coq64_buildtest_abs_ocaml4\bin>ocamlc -where => D:/bin/coq64_buildtest_abs_ocaml4/libocaml # D:\bin\coq64_buildtest_abs_ocaml4\bin>camlp4 -where => ${PREFIX}/libocaml\camlp4 # So we put an explicit path in there sed -i "s|^LIBDIR=.*|LIBDIR=$PREFIXOCAML/libocaml|" config/Makefile - + # Note: ocaml doesn't support -j 8, so don't pass MAKE_OPT # I verified that 4.02.3 still doesn't support parallel build log2 make world -f Makefile.nt @@ -779,18 +1025,18 @@ function make_ocaml { log2 make opt.opt -f Makefile.nt log2 make install -f Makefile.nt # TODO log2 make clean -f Makefile.nt Temporarily disabled for ocamlbuild development - + # Move license files and other into into special folder if [ "$INSTALLMODE" == "absolute" ] || [ "$INSTALLMODE" == "relocatable" ]; then - mkdir -p $PREFIXOCAML/license_readme/ocaml + mkdir -p "$PREFIXOCAML/license_readme/ocaml" # 4.01 installs these files, 4.02 doesn't. So delete them and copy them from the sources. - rm -f *.txt - cp LICENSE $PREFIXOCAML/license_readme/ocaml/License.txt - cp INSTALL $PREFIXOCAML/license_readme/ocaml/Install.txt - cp README $PREFIXOCAML/license_readme/ocaml/ReadMe.txt - cp README.win32 $PREFIXOCAML/license_readme/ocaml/ReadMeWin32.txt - cp VERSION $PREFIXOCAML/license_readme/ocaml/Version.txt - cp Changes $PREFIXOCAML/license_readme/ocaml/Changes.txt + rm -f ./*.txt + cp LICENSE "$PREFIXOCAML/license_readme/ocaml/License.txt" + cp INSTALL.adoc "$PREFIXOCAML/license_readme/ocaml/Install.txt" + cp README.adoc "$PREFIXOCAML/license_readme/ocaml/ReadMe.txt" + cp README.win32.adoc "$PREFIXOCAML/license_readme/ocaml/ReadMeWin32.txt" + cp VERSION "$PREFIXOCAML/license_readme/ocaml/Version.txt" + cp Changes "$PREFIXOCAML/license_readme/ocaml/Changes.txt" fi build_post @@ -798,17 +1044,63 @@ function make_ocaml { make_flex_dll_link } +##### OCAML EXTRA TOOLS ##### + +function make_ocaml_tools { + make_findlib + make_camlp5 +} + +##### OCAML EXTRA LIBRARIES ##### + +function make_ocaml_libs { + make_num + make_findlib + make_lablgtk + # make_stdint +} + +##### Ocaml num library ##### +function make_num { + make_ocaml + # We need this commit due to windows fixed, IMHO this is better than patching v1.1. + if build_prep https://github.com/ocaml/num/archive 7dd5e935aaa2b902585b3b2d0e55ad9b2442fff0 zip 1 num-1.1-7d; then + log2 make all + # log2 make test + log2 make install + log2 make clean + build_post + fi +} + +##### OCAMLBUILD ##### + +function make_ocamlbuild { + make_ocaml + if build_prep https://github.com/ocaml/ocamlbuild/archive 0.12.0 tar.gz 1 ocamlbuild-0.12.0; then + log2 make configure OCAML_NATIVE=true OCAMLBUILD_PREFIX=$PREFIXOCAML OCAMLBUILD_BINDIR=$PREFIXOCAML/bin OCAMLBUILD_LIBDIR=$PREFIXOCAML/lib + log1 make + log2 make install + build_post + fi +} + ##### FINDLIB Ocaml library manager ##### function make_findlib { make_ocaml - if build_prep http://download.camlcity.org/download findlib-1.5.6 tar.gz 1 ; then - ./configure -bindir $PREFIXOCAML\\bin -sitelib $PREFIXOCAML\\libocaml\\site-lib -config $PREFIXOCAML\\etc\\findlib.conf + make_ocamlbuild + if build_prep https://opam.ocaml.org/1.2.2/archives ocamlfind.1.8.0+opam tar.gz 1 ; then + logn configure ./configure -bindir "$PREFIXOCAML\\bin" -sitelib "$PREFIXOCAML\\libocaml\\site-lib" -config "$PREFIXOCAML\\etc\\findlib.conf" # Note: findlib doesn't support -j 8, so don't pass MAKE_OPT log2 make all log2 make opt log2 make install log2 make clean + # Add Coq install library path to ocamlfind config file + # $(ocamlfind printconf conf | tr -d '\r') is the name of the config file + # printf "%q" "$PREFIXCOQ/lib" | sed -e 's/\\/\\\\/g' is the coq lib path double escaped for sed + sed -i -e 's|path="\(.*\)"|path="\1;'$(printf "%q" "$PREFIXCOQ/lib" | sed -e 's/\\/\\\\/g')'"|' $(ocamlfind printconf conf | tr -d '\r') build_post fi } @@ -818,15 +1110,11 @@ function make_findlib { function make_menhir { make_ocaml make_findlib - # if build_prep http://gallium.inria.fr/~fpottier/menhir menhir-20151112 tar.gz 1 ; then - # For Ocaml 4.02 - # if build_prep http://gallium.inria.fr/~fpottier/menhir menhir-20151012 tar.gz 1 ; then - # For Ocaml 4.01 - if build_prep http://gallium.inria.fr/~fpottier/menhir menhir-20140422 tar.gz 1 ; then + make_ocamlbuild + if build_prep http://gallium.inria.fr/~fpottier/menhir menhir-20180530 tar.gz 1 ; then # Note: menhir doesn't support -j 8, so don't pass MAKE_OPT - log2 make all PREFIX=$PREFIXOCAML - log2 make install PREFIX=$PREFIXOCAML - mv $PREFIXOCAML/bin/menhir $PREFIXOCAML/bin/menhir.exe + log2 make all PREFIX="$PREFIXOCAML" + log2 make install PREFIX="$PREFIXOCAML" build_post fi } @@ -839,7 +1127,7 @@ function make_camlp4 { if ! command camlp4 ; then make_ocaml make_findlib - if build_prep https://github.com/ocaml/camlp4/archive 4.02+6 tar.gz 1 camlp4-4.02+6 ; then + if build_prep https://github.com/ocaml/camlp4/archive 4.06+2 tar.gz 1 camlp4-4.06+2 ; then # See https://github.com/ocaml/camlp4/issues/41#issuecomment-112018910 logn configure ./configure # Note: camlp4 doesn't support -j 8, so don't pass MAKE_OPT @@ -856,14 +1144,20 @@ function make_camlp4 { function make_camlp5 { make_ocaml make_findlib - if build_prep http://camlp5.gforge.inria.fr/distrib/src camlp5-6.14 tgz 1 ; then - logn configure ./configure + + if build_prep https://github.com/camlp5/camlp5/archive rel706 tar.gz 1 camlp5-rel706; then + logn configure ./configure # Somehow my virus scanner has the boot.new/SAVED directory locked after the move for a second => repeat until success sed -i 's/mv boot.new boot/until mv boot.new boot; do sleep 1; done/' Makefile + # shellcheck disable=SC2086 log1 make world.opt $MAKE_OPT log2 make install # For some reason gramlib.a is not copied, but it is required by Coq - cp lib/gramlib.a $PREFIXOCAML/libocaml/camlp5/ + cp lib/gramlib.a "$PREFIXOCAML/libocaml/camlp5/" + # For some reason META is not copied, but it is required by coq_makefile + log2 make -C etc META + mkdir -p "$PREFIXOCAML/libocaml/site-lib/camlp5/" + cp etc/META "$PREFIXOCAML/libocaml/site-lib/camlp5/" log2 make clean build_post fi @@ -878,19 +1172,36 @@ function make_camlp5 { function make_lablgtk { make_ocaml make_findlib - make_camlp4 - if build_prep https://forge.ocamlcore.org/frs/download.php/1479 lablgtk-2.18.3 tar.gz 1 ; then + # make_camlp4 # required by lablgtk-2.18.3 and lablgtk-2.18.5 + make_gtk2 + make_gtk_sourceview2 + if build_prep https://forge.ocamlcore.org/frs/download.php/1726 lablgtk-2.18.6 tar.gz 1 ; then # configure should be fixed to search for $TARGET_ARCH-pkg-config.exe - cp /bin/$TARGET_ARCH-pkg-config.exe bin_special/pkg-config.exe - logn configure ./configure --build=$BUILD --host=$HOST --target=$TARGET --prefix=$PREFIXOCAML - + cp "/bin/$TARGET_ARCH-pkg-config.exe" bin_special/pkg-config.exe + logn configure ./configure --build="$BUILD" --host="$HOST" --target="$TARGET" --prefix="$PREFIXOCAML" + # lablgtk shows occasional errors with -j, so don't pass $MAKE_OPT - - # See https://sympa.inria.fr/sympa/arc/caml-list/2015-10/msg00204.html for the make || true + strip - logn make-world-pre make world || true - $TARGET_ARCH-strip.exe --strip-unneeded src/dlllablgtk2.dll - + + # lablgtk binary needs to be stripped - otherwise flexdll goes wild + # Fix version 1: explicit strip after failed build - this randomly fails in CI + # See https://sympa.inria.fr/sympa/arc/caml-list/2015-10/msg00204.html + # logn make-world-pre make world || true + # $TARGET_ARCH-strip.exe --strip-unneeded src/dlllablgtk2.dll + + # Fix version 2: Strip by passing linker argument rather than explicit call to strip + # See https://github.com/alainfrisch/flexdll/issues/6 + # Argument to ocamlmklib: -ldopt "-link -Wl,-s" + # -ldopt is the okamlmklib linker prefix option + # -link is the flexlink linker prefix option + # -Wl, is the gcc (linker driver) linker prefix option + # -s is the gnu linker option for stripping symbols + # These changes are included in dev/build/windows/patches_coq/lablgtk-2.18.3.patch + log2 make world + + # lablgtk does not escape FINDLIBDIR path, which can contain backslashes + sed -i "s|^FINDLIBDIR=.*|FINDLIBDIR=$PREFIXOCAML/libocaml/site-lib|" config.make + log2 make install log2 make clean build_post @@ -920,7 +1231,7 @@ function make_stdint { function copy_coq_dll { if [ "$INSTALLMODE" == "absolute" ] || [ "$INSTALLMODE" == "relocatable" ]; then - cp /usr/${ARCH}-w64-mingw32/sys-root/mingw/bin/$1 $PREFIXCOQ/bin/$1 + cp "/usr/${ARCH}-w64-mingw32/sys-root/mingw/bin/$1" "$PREFIXCOQ/bin/$1" fi } @@ -936,7 +1247,7 @@ function copy_coq_dlls { # Do this recursively until there are no further missing DLLs (File close + reopen) # For running this quickly, just do "cd coq- ; call copy_coq_dlls ; cd .." at the end of this script. # Do the same for coqc and ocamlc (usually doesn't result in additional files) - + copy_coq_dll LIBATK-1.0-0.DLL copy_coq_dll LIBCAIRO-2.DLL copy_coq_dll LIBEXPAT-1.DLL @@ -954,15 +1265,15 @@ function copy_coq_dlls { copy_coq_dll LIBPANGO-1.0-0.DLL copy_coq_dll LIBPANGOCAIRO-1.0-0.DLL copy_coq_dll LIBPANGOWIN32-1.0-0.DLL + copy_coq_dll libpcre-1.dll copy_coq_dll LIBPIXMAN-1-0.DLL copy_coq_dll LIBPNG16-16.DLL copy_coq_dll LIBXML2-2.DLL copy_coq_dll ZLIB1.DLL - # Depends on if GTK is built from sources + # Depends on if GTK is built from sources if [ "$GTK_FROM_SOURCES" == "Y" ]; then copy_coq_dll libiconv-2.dll - copy_coq_dll libpcre-1.dll else copy_coq_dll ICONV.DLL copy_coq_dll LIBBZ2-1.DLL @@ -978,21 +1289,21 @@ function copy_coq_dlls { i686) copy_coq_dll LIBGCC_S_SJLJ-1.DLL ;; *) false ;; esac - + # Win pthread version change copy_coq_dll LIBWINPTHREAD-1.DLL } function copy_coq_objects { # copy objects only from folders which exist in the target lib directory - find . -type d | while read FOLDER ; do - if [ -e $PREFIXCOQ/lib/$FOLDER ] ; then - install_glob $FOLDER/'*.cmxa' $PREFIXCOQ/lib/$FOLDER - install_glob $FOLDER/'*.cmi' $PREFIXCOQ/lib/$FOLDER - install_glob $FOLDER/'*.cma' $PREFIXCOQ/lib/$FOLDER - install_glob $FOLDER/'*.cmo' $PREFIXCOQ/lib/$FOLDER - install_glob $FOLDER/'*.a' $PREFIXCOQ/lib/$FOLDER - install_glob $FOLDER/'*.o' $PREFIXCOQ/lib/$FOLDER + find . -type d | while read -r FOLDER ; do + if [ -e "$PREFIXCOQ/lib/coq/$FOLDER" ] ; then + install_glob "$FOLDER" '*.cmxa' "$PREFIXCOQ/lib/coq/$FOLDER" + install_glob "$FOLDER" '*.cmi' "$PREFIXCOQ/lib/coq/$FOLDER" + install_glob "$FOLDER" '*.cma' "$PREFIXCOQ/lib/coq/$FOLDER" + install_glob "$FOLDER" '*.cmo' "$PREFIXCOQ/lib/coq/$FOLDER" + install_glob "$FOLDER" '*.a' "$PREFIXCOQ/lib/coq/$FOLDER" + install_glob "$FOLDER" '*.o' "$PREFIXCOQ/lib/coq/$FOLDER" fi done } @@ -1000,23 +1311,28 @@ function copy_coq_objects { # Copy required GTK config and suport files function copq_coq_gtk { - echo 'gtk-theme-name = "MS-Windows"' > $PREFIX/etc/gtk-2.0/gtkrc - echo 'gtk-fallback-icon-theme = "Tango"' >> $PREFIX/etc/gtk-2.0/gtkrc + echo 'gtk-theme-name = "MS-Windows"' > "$PREFIX/etc/gtk-2.0/gtkrc" + echo 'gtk-fallback-icon-theme = "Tango"' >> "$PREFIX/etc/gtk-2.0/gtkrc" if [ "$INSTALLMODE" == "absolute" ] || [ "$INSTALLMODE" == "relocatable" ]; then - install_glob $PREFIX/etc/gtk-2.0/'*' $PREFIXCOQ/gtk-2.0 - install_glob $PREFIX/share/gtksourceview-2.0/language-specs/'*' $PREFIXCOQ/share/gtksourceview-2.0/language-specs - install_glob $PREFIX/share/gtksourceview-2.0/styles/'*' $PREFIXCOQ/share/gtksourceview-2.0/styles - install_rec $PREFIX/share/themes/ '*' $PREFIXCOQ/share/themes - + install_glob "$PREFIX/etc/gtk-2.0" '*' "$PREFIXCOQ/gtk-2.0" + install_glob "$PREFIX/share/gtksourceview-2.0/language-specs" '*' "$PREFIXCOQ/share/gtksourceview-2.0/language-specs" + install_glob "$PREFIX/share/gtksourceview-2.0/styles" '*' "$PREFIXCOQ/share/gtksourceview-2.0/styles" + install_rec "$PREFIX/share/themes" '*' "$PREFIXCOQ/share/themes" + # This below item look like a bug in make install + if [ -d "$PREFIXCOQ/share/coq/" ] ; then + COQSHARE="$PREFIXCOQ/share/coq/" + else + COQSHARE="$PREFIXCOQ/share/" + fi if [[ ! $COQ_VERSION == 8.4* ]] ; then - mv $PREFIXCOQ/share/coq/*.lang $PREFIXCOQ/share/gtksourceview-2.0/language-specs - mv $PREFIXCOQ/share/coq/*.xml $PREFIXCOQ/share/gtksourceview-2.0/styles + mv "$COQSHARE"*.lang "$PREFIXCOQ/share/gtksourceview-2.0/language-specs" + mv "$COQSHARE"*.xml "$PREFIXCOQ/share/gtksourceview-2.0/styles" fi - mkdir -p $PREFIXCOQ/ide - mv $PREFIXCOQ/share/coq/*.png $PREFIXCOQ/ide - rmdir $PREFIXCOQ/share/coq + mkdir -p "$PREFIXCOQ/ide" + mv "$COQSHARE"*.png "$PREFIXCOQ/ide" + rmdir "$PREFIXCOQ/share/coq" || true fi } @@ -1024,16 +1340,16 @@ function copq_coq_gtk { function copy_coq_license { if [ "$INSTALLMODE" == "absolute" ] || [ "$INSTALLMODE" == "relocatable" ]; then - install -D doc/LICENSE $PREFIXCOQ/license_readme/coq/LicenseDoc.txt - install -D LICENSE $PREFIXCOQ/license_readme/coq/License.txt - install -D plugins/micromega/LICENSE.sos $PREFIXCOQ/license_readme/coq/LicenseMicromega.txt - install -D README $PREFIXCOQ/license_readme/coq/ReadMe.txt || true - install -D README.md $PREFIXCOQ/license_readme/coq/ReadMe.md || true - install -D README.doc $PREFIXCOQ/license_readme/coq/ReadMeDoc.txt - install -D CHANGES $PREFIXCOQ/license_readme/coq/Changes.txt - install -D INSTALL $PREFIXCOQ/license_readme/coq/Install.txt - install -D INSTALL.doc $PREFIXCOQ/license_readme/coq/InstallDoc.txt - install -D INSTALL.ide $PREFIXCOQ/license_readme/coq/InstallIde.txt + install -D doc/LICENSE "$PREFIXCOQ/license_readme/coq/LicenseDoc.txt" + install -D LICENSE "$PREFIXCOQ/license_readme/coq/License.txt" + install -D plugins/micromega/LICENSE.sos "$PREFIXCOQ/license_readme/coq/LicenseMicromega.txt" + install -D README "$PREFIXCOQ/license_readme/coq/ReadMe.txt" || true + install -D README.md "$PREFIXCOQ/license_readme/coq/ReadMe.md" || true + install -D README.win "$PREFIXCOQ/license_readme/coq/ReadMeWindows.txt" || true + install -D README.doc "$PREFIXCOQ/license_readme/coq/ReadMeDoc.txt" || true + install -D CHANGES "$PREFIXCOQ/license_readme/coq/Changes.txt" + install -D INSTALL "$PREFIXCOQ/license_readme/coq/Install.txt" + install -D doc/README.md "$PREFIXCOQ/license_readme/coq/ReadMeDoc.md" || true fi } @@ -1041,54 +1357,82 @@ function copy_coq_license { function make_coq { make_ocaml - make_lablgtk + make_num + make_findlib make_camlp5 - if + make_lablgtk + if case $COQ_VERSION in - git-*) build_prep https://github.com/coq/coq/archive ${COQ_VERSION##git-} zip 1 coq-${COQ_VERSION} ;; - *) build_prep https://coq.inria.fr/distrib/V$COQ_VERSION/files coq-$COQ_VERSION tar.gz ;; + # e.g. git-v8.6 => download from https://github.com/coq/coq/archive/v8.6.zip + # e.g. git-trunk => download from https://github.com/coq/coq/archive/trunk.zip + git-*) + COQ_BUILD_PATH=/build/coq-${COQ_VERSION} + build_prep https://github.com/coq/coq/archive "${COQ_VERSION##git-}" zip 1 "coq-${COQ_VERSION}" + ;; + + # e.g. /cygdrive/d/coqgit + /*) + # Todo: --exclude-vcs-ignores doesn't work because tools/coqdoc/coqdoc.sty is excluded => fix .gitignore + # But this is not a big deal, only 2 files are removed with --exclude-vcs-ignores from a fresch clone + COQ_BUILD_PATH=/build/coq-local + tar -zcf $TARBALLS/coq-local.tar.gz --exclude-vcs -C "${COQ_VERSION%/*}" "${COQ_VERSION##*/}" + build_prep NEVER-DOWNLOADED coq-local tar.gz + ;; + + # e.g. 8.6 => https://coq.inria.fr/distrib/8.6/files/coq-8.6.tar.gz + *) + COQ_BUILD_PATH=/build/coq-$COQ_VERSION + build_prep "https://coq.inria.fr/distrib/V$COQ_VERSION/files" "coq-$COQ_VERSION" tar.gz + ;; esac then if [ "$INSTALLMODE" == "relocatable" ]; then # HACK: for relocatable builds, first configure with ./, then build but before install reconfigure with the real target path - logn configure ./configure -debug -with-doc no -prefix ./ -libdir ./lib -mandir ./man + logn configure ./configure -with-doc no -prefix ./ -libdir ./lib/coq -mandir ./man elif [ "$INSTALLMODE" == "absolute" ]; then - logn configure ./configure -debug -with-doc no -prefix $PREFIXCOQ -libdir $PREFIXCOQ/lib -mandir $PREFIXCOQ/man + logn configure ./configure -with-doc no -prefix "$PREFIXCOQ" -libdir "$PREFIXCOQ/lib/coq" -mandir "$PREFIXCOQ/man" else - logn configure ./configure -debug -with-doc no -prefix $PREFIXCOQ + logn configure ./configure -with-doc no -prefix "$PREFIXCOQ" fi # The windows resource compiler binary name is hard coded - sed -i "s/i686-w64-mingw32-windres/$TARGET_ARCH-windres/" Makefile.build + sed -i "s/i686-w64-mingw32-windres/$TARGET_ARCH-windres/" Makefile.build sed -i "s/i686-w64-mingw32-windres/$TARGET_ARCH-windres/" Makefile.ide || true # 8.4x doesn't support parallel make if [[ $COQ_VERSION == 8.4* ]] ; then log1 make else + # shellcheck disable=SC2086 log1 make $MAKE_OPT fi - + if [ "$INSTALLMODE" == "relocatable" ]; then - ./configure -debug -with-doc no -prefix $PREFIXCOQ -libdir $PREFIXCOQ/lib -mandir $PREFIXCOQ/man + logn reconfigure ./configure -with-doc no -prefix "$PREFIXCOQ" -libdir "$PREFIXCOQ/lib/coq" -mandir "$PREFIXCOQ/man" fi log2 make install log1 copy_coq_dlls if [ "$INSTALLOCAML" == "Y" ]; then - log1 copy_coq_objects + copy_coq_objects fi - - copq_coq_gtk - copy_coq_license - # make clean seems to br broken for 8.5pl2 + log1 copq_coq_gtk + log1 copy_coq_license + + # make clean seems to be broken for 8.5pl2 # 1.) find | xargs fails on cygwin, can be fixed by sed -i 's|\| xargs rm -f|-exec rm -fv \{\} \+|' Makefile # 2.) clean of test suites fails with "cannot run complexity tests (no bogomips found)" # make clean - + + # Copy these files somewhere the plugin builds can find them + logn copy-basic-overlays cp dev/ci/ci-basic-overlay.sh /build/ + logn copy-user-overlays cp -r dev/ci/user-overlays /build/ + build_post fi + + load_overlay_data } ##### GNU Make for MinGW ##### @@ -1097,11 +1441,11 @@ function make_mingw_make { if build_prep http://ftp.gnu.org/gnu/make make-4.2 tar.bz2 ; then # The config.h.win32 file is fine - don't edit it # We need to copy the mingw gcc here as "gcc" - then the batch file will use it - cp /usr/bin/${ARCH}-w64-mingw32-gcc-5.4.0.exe ./gcc.exe + cp "/usr/bin/${ARCH}-w64-mingw32-gcc-6.4.0.exe" ./gcc.exe # By some magic cygwin bash can run batch files logn build ./build_w32.bat gcc # Copy make to Coq folder - cp GccRel/gnumake.exe $PREFIXCOQ/bin/make.exe + cp GccRel/gnumake.exe "$PREFIXCOQ/bin/make.exe" build_post fi } @@ -1110,7 +1454,8 @@ function make_mingw_make { function make_binutils { if build_prep http://ftp.gnu.org/gnu/binutils binutils-2.27 tar.gz ; then - logn configure ./configure --build=$BUILD --host=$HOST --target=$TARGET --prefix=$PREFIXCOQ --program-prefix=$TARGET- + logn configure ./configure --build="$BUILD" --host="$HOST" --target="$TARGET" --prefix="$PREFIXCOQ" --program-prefix="$TARGET-" + # shellcheck disable=SC2086 log1 make $MAKE_OPT log2 make install # log2 make clean @@ -1133,15 +1478,16 @@ function make_gcc { # For whatever reason gcc needs this (although it never puts anything into it) # Error: "The directory that should contain system headers does not exist:" # mkdir -p /mingw/include without --with-sysroot - mkdir -p $PREFIXCOQ/mingw/include + mkdir -p "$PREFIXCOQ/mingw/include" # See https://gcc.gnu.org/install/configure.html - logn configure ./configure --build=$BUILD --host=$HOST --target=$TARGET \ - --prefix=$PREFIXCOQ --program-prefix=$TARGET- --disable-win32-registry --with-sysroot=$PREFIXCOQ \ + logn configure ./configure --build="$BUILD" --host="$HOST" --target="$TARGET" \ + --prefix="$PREFIXCOQ" --program-prefix="$TARGET-" --disable-win32-registry --with-sysroot="$PREFIXCOQ" \ --enable-languages=c --disable-nls \ --disable-libsanitizer --disable-libssp --disable-libquadmath --disable-libgomp --disable-libvtv --disable-lto # --disable-decimal-float seems to be required - # --with-sysroot=$PREFIX results in configure error that this is not an absolute path + # --with-sysroot="$PREFIX" results in configure error that this is not an absolute path + # shellcheck disable=SC2086 log1 make $MAKE_OPT log2 make install # log2 make clean @@ -1152,8 +1498,8 @@ function make_gcc { ##### Get sources for Cygwin MinGW packages ##### function get_cygwin_mingw_sources { - if [ ! -f flagfiles/cygwin_mingw_sources.finished ] ; then - touch flagfiles/cygwin_mingw_sources.started + if [ ! -f $FLAGFILES/cygwin_mingw_sources.finished ] ; then + touch $FLAGFILES/cygwin_mingw_sources.started # Find all installed files with mingw in the name and download the corresponding source code file from cygwin # Steps: @@ -1169,28 +1515,29 @@ function get_cygwin_mingw_sources { # Take the 2nd field of the last line => ${SOURCE} = x86_64/release/mingw64-x86_64-gcc/mingw64-x86_64-gcc-5.4.0-2-src.tar.xz # Remove that path part => ${SOURCEFILE} = mingw64-x86_64-gcc-5.4.0-2-src.tar.xz - grep "mingw" /etc/setup/installed.db | sed 's/\.tar\.bz2 [0-1]$//' | sed 's/ /\//' | while read ARCHIVE ; do + grep "mingw" /etc/setup/installed.db | sed 's/\.tar\.bz2 [0-1]$//' | sed 's/ /\//' | while read -r ARCHIVE ; do local ARCHIVEESC=${ARCHIVE//+/\\+} - local SOURCE=`egrep -A 1 "install: ($CYGWINARCH|noarch)/release/[-+_/a-z0-9]*$ARCHIVEESC" $TARBALLS/setup.ini | tail -1 | cut -d " " -f 2` + local SOURCE + SOURCE=$(grep -E -A 1 "install: ($CYGWINARCH|noarch)/release/[-+_/a-z0-9]*$ARCHIVEESC" $TARBALLS/setup.ini | tail -1 | cut -d " " -f 2) local SOURCEFILE=${SOURCE##*/} # Get the source file (either from the source cache or online) - if [ ! -f $TARBALLS/$SOURCEFILE ] ; then - if [ -f $SOURCE_LOCAL_CACHE_CFMT/$SOURCEFILE ] ; then - cp $SOURCE_LOCAL_CACHE_CFMT/$SOURCEFILE $TARBALLS + if [ ! -f "$TARBALLS/$SOURCEFILE" ] ; then + if [ -f "$SOURCE_LOCAL_CACHE_CFMT/$SOURCEFILE" ] ; then + cp "$SOURCE_LOCAL_CACHE_CFMT/$SOURCEFILE" $TARBALLS else - wget "$CYGWIN_REPOSITORY/$SOURCE" - mv $SOURCEFILE $TARBALLS + wget --progress=dot:giga "$CYGWIN_REPOSITORY/$SOURCE" + mv "$SOURCEFILE" "$TARBALLS" # Save the source archive in the source cache - if [ -d $SOURCE_LOCAL_CACHE_CFMT ] ; then - cp $TARBALLS/$SOURCEFILE $SOURCE_LOCAL_CACHE_CFMT + if [ -d "$SOURCE_LOCAL_CACHE_CFMT" ] ; then + cp "$TARBALLS/$SOURCEFILE" "$SOURCE_LOCAL_CACHE_CFMT" fi fi fi done - touch flagfiles/cygwin_mingw_sources.finished + touch $FLAGFILES/cygwin_mingw_sources.finished fi } @@ -1198,64 +1545,355 @@ function get_cygwin_mingw_sources { function make_coq_installer { make_coq - make_mingw_make get_cygwin_mingw_sources # Prepare the file lists for the installer. We created to file list dumps of the target folder during the build: # ocaml: ocaml + menhir + camlp5 + findlib - # ocal_coq: as above + coq - + # ocaml_coq: as above + coq + # ocaml_coq_addons: as above + lib/user-contrib/* + # Create coq file list as ocaml_coq / ocaml diff_files coq ocaml_coq ocaml - + # Filter out object files - filter_files coq_objects coq '\.(cmxa|cmi|cma|cmo|a|o)$' - + filter_files coq_objects coq '\.(cmxa|cmi|cma|cmo|a|o)$' + # Filter out plugin object files - filter_files coq_objects_plugins coq_objects '/lib/plugins/.*\.(cmxa|cmi|cma|cmo|a|o)$' - + filter_files coq_objects_plugins coq_objects '/lib/coq/plugins/.*\.(cmxa|cmi|cma|cmo|a|o)$' + # Coq objects objects required for plugin development = coq objects except those for pre installed plugins diff_files coq_plugindev coq_objects coq_objects_plugins - + + # Addons (TODO: including objects that could go to the plugindev thing, but + # then one would have to make that package depend on this one, so not + # implemented yet) + diff_files coq_addons ocaml_coq_addons ocaml_coq + # Coq files, except objects needed only for plugin development diff_files coq_base coq coq_plugindev - + # Convert section files to NSIS format files_to_nsis coq_base + files_to_nsis coq_addons files_to_nsis coq_plugindev files_to_nsis ocaml - + # Get and extract NSIS Binaries if build_prep http://downloads.sourceforge.net/project/nsis/NSIS%202/2.51 nsis-2.51 zip ; then - NSIS=`pwd`/makensis.exe + NSIS=$(pwd)/makensis.exe chmod u+x "$NSIS" # Change to Coq folder - cd ../coq-${COQ_VERSION} + cd "$COQ_BUILD_PATH" # Copy patched nsi file cp ../patches/coq_new.nsi dev/nsis cp ../patches/StrRep.nsh dev/nsis cp ../patches/ReplaceInFile.nsh dev/nsis - VERSION=`grep ^VERSION= config/Makefile | cut -d = -f 2` + VERSION=$(grep '^VERSION=' config/Makefile | cut -d = -f 2 | tr -d '\r') cd dev/nsis - logn nsis-installer "$NSIS" -DVERSION=$VERSION -DARCH=$ARCH -DCOQ_SRC_PATH=$PREFIXCOQ -DCOQ_ICON=..\\..\\ide\\coq.ico coq_new.nsi - + logn nsis-installer "$NSIS" -DVERSION="$VERSION" -DARCH="$ARCH" -DCOQ_SRC_PATH="$PREFIXCOQ" -DCOQ_ICON=..\\..\\ide\\coq.ico -DCOQ_ADDONS="$COQ_ADDONS" coq_new.nsi + build_post fi } +###################### ADDON COQ LIBRARIES / PLUGINS / TOOLS ##################### + +# The bignums library +# Provides BigN, BigZ, BigQ that used to be part of Coq standard library + +function make_addon_bignums { + installer_addon_dependency bignums + if build_prep_overlay bignums; then + installer_addon_section bignums "Bignums" "Coq library for fast arbitrary size numbers" "" + # To make command lines shorter :-( + echo 'COQ_SRC_SUBDIRS:=$(filter-out plugins/%,$(COQ_SRC_SUBDIRS)) plugins/syntax' >> Makefile.coq.local + log1 make all + log2 make install + build_post + fi +} + +# Equations plugin +# A function definition plugin + +function make_addon_equations { + installer_addon_dependency equations + if build_prep_overlay Equations; then + installer_addon_section equations "Equations" "Coq plugin for defining functions by equations" "" + # Note: PATH is autmatically saved/restored by build_prep / build_post + PATH=$COQBIN:$PATH + logn coq_makefile ${COQBIN}coq_makefile -f _CoqProject -o Makefile + log1 make + log2 make install + build_post + fi +} + +# mathcomp - ssreflect and mathematical components library + +function make_addon_mathcomp { + installer_addon_dependency mathcomp + if build_prep_overlay mathcomp; then + installer_addon_section mathcomp "Math-Components" "Coq library with mathematical components" "" + cd mathcomp + log1 make $MAKE_OPT + log2 make install + build_post + fi +} + +# ssreflect part of mathcomp + +function make_addon_ssreflect { + # if mathcomp addon is requested, build this instead + if [[ "$COQ_ADDONS" == *mathcomp* ]]; then + make_addon_mathcomp + else + # Note: since either mathcomp or ssreflect is defined, it is fine to name both mathcomp + installer_addon_dependency ssreflect + if build_prep_overlay mathcomp; then + installer_addon_section ssreflect "SSReflect" "Coq support library for small scale reflection plugin" "" + cd mathcomp + logn make-makefile make Makefile.coq + logn make-ssreflect make $MAKE_OPT -f Makefile.coq ssreflect/all_ssreflect.vo + logn make-install make -f Makefile.coq install + build_post + fi + fi +} + +# Ltac-2 plugin +# A new (experimental) tactic language + +function make_addon_ltac2 { + installer_addon_dependency ltac2 + if build_prep_overlay ltac2; then + installer_addon_section ltac2 "Ltac-2" "Coq plugin with the Ltac-2 enhanced tactics language" "" + log1 make all + log2 make install + build_post + fi +} + +# UniCoq plugin +# An alternative unification algorithm +function make_addon_unicoq { + installer_addon_dependency unicoq + if build_prep_overlay unicoq; then + log1 coq_makefile -f Make -o Makefile + log1 make + log2 make install + build_post + fi +} + +# Mtac2 plugin +# An alternative typed tactic language +function make_addon_mtac2 { + installer_addon_dependency_beg mtac2 + make_addon_unicoq + installer_addon_dependency_end + if build_prep_overlay mtac2; then + log1 coq_makefile -f _CoqProject -o Makefile + log1 make + log2 make install + build_post + fi +} + +# Menhir parser generator + +function make_addon_menhir { + make_menhir + # If COQ and OCaml are installed to the same folder, there is nothing to do + installer_addon_dependency menhir + if [ "$PREFIXOCAML" != "$PREFIXCOQ" ] ; then + # Just install menhir files required for COQ to COQ target folder + if [ ! -f "$FLAGFILES/menhir-addon.finished" ] ; then + installer_addon_section menhir "Menhir" "Menhir parser generator windows executable and libraries" "" + LOGTARGET=menhir-addon + touch "$FLAGFILES/menhir-addon.started" + # Menhir executable + install_glob "$PREFIXOCAML/bin" 'menhir.exe' "$PREFIXCOQ/bin/" + # Menhir Standard library + install_glob "$PREFIXOCAML/share/menhir/" '*.mly' "$PREFIXCOQ/share/menhir/" + # Menhir PDF doc + install_glob "$PREFIXOCAML/share/doc/menhir/" '*.pdf' "$PREFIXCOQ/doc/menhir/" + touch "$FLAGFILES/menhir-addon.finished" + LOGTARGET=other + installer_addon_end + fi + fi +} + +# COQ library for Menhir + +function make_addon_menhirlib { + installer_addon_dependency menhirlib + if build_prep_overlay menhirlib; then + installer_addon_section menhirlib "Menhirlib" "Coq support library for using Menhir generated parsers in Coq" "" + # The supplied makefiles don't work in any way on cygwin + cd src + echo -R . MenhirLib > _CoqProject + ls -1 *.v >> _CoqProject + log1 coq_makefile -f _CoqProject -o Makefile.coq + log1 make -f Makefile.coq all + logn make-install make -f Makefile.coq install + build_post + fi +} + +# CompCert + +function make_addon_compcert { + installer_addon_dependency_beg compcert + make_menhir + make_addon_menhirlib + installer_addon_dependency_end + if build_prep_overlay CompCert; then + installer_addon_section compcert "CompCert" "ATTENTION: THIS IS NOT OPEN SOURCE! CompCert verified C compiler and Clightgen (required for using VST for your own code)" "off" + logn configure ./configure -ignore-coq-version -clightgen -prefix "$PREFIXCOQ" -coqdevdir "$PREFIXCOQ/lib/coq/user-contrib/compcert" x86_32-cygwin + log1 make + log2 make install + logn install-license-1 install -D -T "LICENSE" "$PREFIXCOQ/lib/coq/user-contrib/compcert/LICENSE" + logn install-license-2 install -D -T "LICENSE" "$PREFIXCOQ/lib/compcert/LICENSE" + build_post + fi +} + +# Princeton VST + +function install_addon_vst { + VSTDEST="$PREFIXCOQ/lib/coq/user-contrib/VST" + + # Install VST .v, .vo, .c and .h files + install_rec compcert '*.v' "$VSTDEST/compcert/" + install_rec compcert '*.vo' "$VSTDEST/compcert/" + install_glob "msl" '*.v' "$VSTDEST/msl/" + install_glob "msl" '*.vo' "$VSTDEST/msl/" + install_glob "sepcomp" '*.v' "$VSTDEST/sepcomp/" + install_glob "sepcomp" '*.vo' "$VSTDEST/sepcomp/" + install_glob "floyd" '*.v' "$VSTDEST/floyd/" + install_glob "floyd" '*.vo' "$VSTDEST/floyd/" + install_glob "progs" '*.v' "$VSTDEST/progs/" + install_glob "progs" '*.c' "$VSTDEST/progs/" + install_glob "progs" '*.h' "$VSTDEST/progs/" + install_glob "veric" '*.v' "$VSTDEST/msl/" + install_glob "veric" '*.vo' "$VSTDEST/msl/" + + # Install VST documentation files + install_glob "." 'LICENSE' "$VSTDEST" + install_glob "." '*.md' "$VSTDEST" + install_glob "compcert" '*' "$VSTDEST/compcert" + install_glob "doc" '*.pdf' "$VSTDEST/doc" + + # Install VST _CoqProject files + install_glob "." '_CoqProject*' "$VSTDEST" + install_glob "." '_CoqProject-export' "$VSTDEST/progs" +} + +function make_addon_vst { + installer_addon_dependency vst + if build_prep_overlay VST; then + installer_addon_section vst "VST" "ATTENTION: SOME INCLUDED COMPCERT PARTS ARE NOT OPEN SOURCE! Verified Software Toolchain for verifying C code" "off" + log1 make IGNORECOQVERSION=true $MAKE_OPT + log1 install_addon_vst + build_post + fi +} + +# coquelicot Real analysis + +function make_addon_coquelicot { + installer_addon_dependency_beg coquelicot + make_addon_ssreflect + installer_addon_dependency_end + if build_prep_overlay Coquelicot; then + installer_addon_section coquelicot "Coquelicot" "Coq library for real analysis" "" + logn configure ./configure --libdir="$PREFIXCOQ/lib/coq/user-contrib/Coquelicot" + logn remake ./remake + logn remake-install ./remake install + build_post + fi +} + +# AAC associative / commutative rewriting + +function make_addon_aactactics { + installer_addon_dependency aac + if build_prep_overlay aactactis; then + installer_addon_section aac "AAC" "Coq plugin for extensible associative and commutative rewriting" "" + log1 make + log2 make install + build_post + fi +} + +# extlib + +function make_addon_extlib { + installer_addon_dependency extlib + if build_prep_overlay ext_lib; then + installer_addon_section extlib "Ext-Lib" "Coq library with many reusable general purpose components" "" + log1 make $MAKE_OPT + log2 make install + build_post + fi +} + +# SimpleIO + +function make_addon_simple_io { + installer_addon_dependency simpleIO + if build_prep_overlay simple_io; then + installer_addon_section simpleIO "SimpleIO" "Coq plugin for reading and writing files directly from Coq code" "" + log1 make $MAKE_OPT + log2 make install + build_post + fi +} + +# Quickchick Randomized Property-Based Testing Plugin for Coq + +function make_addon_quickchick { + installer_addon_dependency_beg quickchick + make_addon_ssreflect + make_addon_extlib + make_addon_simple_io + make_ocamlbuild + installer_addon_dependency_end + if build_prep_overlay quickchick; then + installer_addon_section quickchick "QuickChick" "Coq plugin for randomized testing and counter example search" "" + log1 make + log2 make install + build_post + fi +} + +# Main function for building addons + +function make_addons { + # Note: ':' is the empty command, which does not produce any output + : > "/build/filelists/addon_dependencies.nsh" + + for addon in $COQ_ADDONS; do + "make_addon_$addon" + done + + sort -u -o "/build/filelists/addon_dependencies.nsh" "/build/filelists/addon_dependencies.nsh" +} + ###################### TOP LEVEL BUILD ##################### -make_gtk2 -make_gtk_sourceview2 +ocamlfind list || true +make_sed make_ocaml -make_findlib -make_lablgtk -make_camlp4 -make_camlp5 -make_menhir -make_stdint +make_ocaml_tools +make_ocaml_libs + list_files ocaml + make_coq if [ "$INSTALLMAKE" == "Y" ] ; then @@ -1264,7 +1902,10 @@ fi list_files ocaml_coq +make_addons + +list_files_always ocaml_coq_addons + if [ "$MAKEINSTALLER" == "Y" ] ; then make_coq_installer fi - diff --git a/dev/build/windows/patches_coq/ReplaceInFile.nsh b/dev/build/windows/patches_coq/ReplaceInFile.nsh deleted file mode 100644 index 27c7eb2f..00000000 --- a/dev/build/windows/patches_coq/ReplaceInFile.nsh +++ /dev/null @@ -1,67 +0,0 @@ -; From NSIS Wiki http://nsis.sourceforge.net/ReplaceInFile -; Modifications: -; - Replace only once per line -; - Don't keep original as .old -; - Use StrRep instead of StrReplace (seems to be cleaner) - -Function Func_ReplaceInFile - ClearErrors - - Exch $0 ; REPLACEMENT - Exch - Exch $1 ; SEARCH_TEXT - Exch 2 - Exch $2 ; SOURCE_FILE - - Push $R0 ; SOURCE_FILE file handle - Push $R1 ; temporary file handle - Push $R2 ; unique temporary file name - Push $R3 ; a line to search and replace / save - Push $R4 ; shift puffer - - IfFileExists $2 +1 error ; Check if file exists and open it - FileOpen $R0 $2 "r" - - GetTempFileName $R2 ; Create temporary output file - FileOpen $R1 $R2 "w" - - loop: ; Loop over lines of file - FileRead $R0 $R3 ; Read line - IfErrors finished - Push "$R3" ; Replacine string in line once - Push "$1" - Push "$0" - Call Func_StrRep - Pop $R3 - FileWrite $R1 "$R3" ; Write result - Goto loop - - finished: - FileClose $R1 ; Close files - FileClose $R0 - Delete "$2" ; Delete original file and rename temporary file to target - Rename "$R2" "$2" - ClearErrors - Goto out - - error: - SetErrors - - out: - Pop $R4 - Pop $R3 - Pop $R2 - Pop $R1 - Pop $R0 - Pop $2 - Pop $0 - Pop $1 -FunctionEnd - -!macro ReplaceInFile SOURCE_FILE SEARCH_TEXT REPLACEMENT - Push "${SOURCE_FILE}" - Push "${SEARCH_TEXT}" - Push "${REPLACEMENT}" - Call Func_ReplaceInFile -!macroend - diff --git a/dev/build/windows/patches_coq/StrRep.nsh b/dev/build/windows/patches_coq/StrRep.nsh deleted file mode 100644 index d94a9f88..00000000 --- a/dev/build/windows/patches_coq/StrRep.nsh +++ /dev/null @@ -1,60 +0,0 @@ -; From NSIS Wiki http://nsis.sourceforge.net/StrRep -; Slightly modified - -Function Func_StrRep - Exch $R2 ;new - Exch 1 - Exch $R1 ;old - Exch 2 - Exch $R0 ;string - Push $R3 - Push $R4 - Push $R5 - Push $R6 - Push $R7 - Push $R8 - Push $R9 - - StrCpy $R3 0 - StrLen $R4 $R1 - StrLen $R6 $R0 - StrLen $R9 $R2 - loop: - StrCpy $R5 $R0 $R4 $R3 - StrCmp $R5 $R1 found - StrCmp $R3 $R6 done - IntOp $R3 $R3 + 1 ;move offset by 1 to check the next character - Goto loop - found: - StrCpy $R5 $R0 $R3 - IntOp $R8 $R3 + $R4 - StrCpy $R7 $R0 "" $R8 - StrCpy $R0 $R5$R2$R7 - StrLen $R6 $R0 - IntOp $R3 $R3 + $R9 ;move offset by length of the replacement string - Goto loop - done: - - Pop $R9 - Pop $R8 - Pop $R7 - Pop $R6 - Pop $R5 - Pop $R4 - Pop $R3 - Push $R0 - Push $R1 - Pop $R0 - Pop $R1 - Pop $R0 - Pop $R2 - Exch $R1 -FunctionEnd - -!macro StrRep output string old new - Push `${string}` - Push `${old}` - Push `${new}` - Call Func_StrRep - Pop ${output} -!macroend diff --git a/dev/build/windows/patches_coq/aactactis-86ac28259030649ef51460e4de2441c8a1017751.patch b/dev/build/windows/patches_coq/aactactis-86ac28259030649ef51460e4de2441c8a1017751.patch new file mode 100644 index 00000000..d9b134b2 --- /dev/null +++ b/dev/build/windows/patches_coq/aactactis-86ac28259030649ef51460e4de2441c8a1017751.patch @@ -0,0 +1,21 @@ +--- aac-tactics-v8.8.orig\Tutorial.v 2018-05-30 16:09:06.000000000 +0200 ++++ aac-tactics-v8.8\Tutorial.v 2018-08-24 19:47:25.000000000 +0200 +@@ -9,16 +9,14 @@ + (** * Tutorial for using the [aac_tactics] library. + + Depending on your installation, either modify the following two + lines, or add them to your .coqrc files, replacing "." with the + path to the [aac_tactics] library. *) + +-Add Rec LoadPath "." as AAC_tactics. +-Add ML Path ".". +-Require Import AAC. +-Require Instances. ++Require Import AAC_tactics.AAC. ++Require AAC_tactics.Instances. + Require Arith ZArith. + + (** ** Introductory example + + Here is a first example with relative numbers ([Z]): one can + rewrite an universally quantified hypothesis modulo the diff --git a/dev/build/windows/patches_coq/coq_new.nsi b/dev/build/windows/patches_coq/coq_new.nsi index b88aa066..9947965c 100644 --- a/dev/build/windows/patches_coq/coq_new.nsi +++ b/dev/build/windows/patches_coq/coq_new.nsi @@ -9,13 +9,14 @@ ; ARCH The target architecture, either x86_64 or i686 ; COQ_SRC_PATH path of Coq installation in Windows or MinGW format (either \\ or /, but with drive letter) ; COQ_ICON path of Coq icon file in Windows or MinGW format +; COQ_ADDONS list of addons that are shipped ; Enable compression after debugging. ; SetCompress off SetCompressor lzma !define MY_PRODUCT "Coq" ;Define your own software name here -!define OUTFILE "coq-installer-${VERSION}-${ARCH}.exe" +!define OUTFILE "coq-${VERSION}-installer-windows-${ARCH}.exe" !include "MUI2.nsh" !include "FileAssociation.nsh" @@ -37,42 +38,20 @@ Var INSTDIR_DBS ; INSTDIR with \\ instead of \ ;Folder selection page InstallDir "C:\${MY_PRODUCT}" - + ;Remember install folder InstallDirRegKey HKCU "Software\${MY_PRODUCT}" "" ;-------------------------------- -;Modern UI Configuration - - !define MUI_ICON "${COQ_ICON}" - - !insertmacro MUI_PAGE_WELCOME - !insertmacro MUI_PAGE_LICENSE "${COQ_SRC_PATH}/license_readme/coq/License.txt" - !insertmacro MUI_PAGE_COMPONENTS - !define MUI_DIRECTORYPAGE_TEXT_TOP "Select where to install Coq. The path MUST NOT include spaces." - !insertmacro MUI_PAGE_DIRECTORY - !insertmacro MUI_PAGE_INSTFILES - !insertmacro MUI_PAGE_FINISH - - !insertmacro MUI_UNPAGE_WELCOME - !insertmacro MUI_UNPAGE_CONFIRM - !insertmacro MUI_UNPAGE_INSTFILES - !insertmacro MUI_UNPAGE_FINISH - -;-------------------------------- -;Languages - - !insertmacro MUI_LANGUAGE "English" - -;-------------------------------- -;Language Strings +;Extra license pages - ;Description - LangString DESC_1 ${LANG_ENGLISH} "This package contains Coq and CoqIDE." - LangString DESC_2 ${LANG_ENGLISH} "This package contains an OCaml compiler for Coq native compute and plugin development." - LangString DESC_3 ${LANG_ENGLISH} "This package contains the development files needed in order to build a plugin for Coq." - LangString DESC_4 ${LANG_ENGLISH} "Set the OCAMLLIB environment variable for the current user." - LangString DESC_5 ${LANG_ENGLISH} "Set the OCAMLLIB environment variable for all users." +!macro MUI_PAGE_LICENSE_EXTRA Licensefile Header Subheader Bottom SelFunc + !define MUI_PAGE_HEADER_TEXT "${Header}" + !define MUI_PAGE_HEADER_SUBTEXT "${Subheader}" + !define MUI_LICENSEPAGE_TEXT_BOTTOM "${Bottom}" + !define MUI_PAGE_CUSTOMFUNCTION_PRE ${SelFunc} + !insertmacro MUI_PAGE_LICENSE "${Licensefile}" +!macroend ;-------------------------------- ; Check for white spaces @@ -93,7 +72,6 @@ FunctionEnd ;-------------------------------- ;Installer Sections - Section "Coq" Sec1 SetOutPath "$INSTDIR\" @@ -103,7 +81,7 @@ Section "Coq" Sec1 ;Store install folder WriteRegStr HKCU "Software\${MY_PRODUCT}" "" $INSTDIR - + ;Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Coq" \ @@ -121,7 +99,7 @@ Section "Coq" Sec1 ; Create start menu entries ; SetOutPath is required for the path in the .lnk files - SetOutPath "$INSTDIR" + SetOutPath "$INSTDIR" CreateDirectory "$SMPROGRAMS\Coq" ; The first shortcut set here is treated as main application by Windows 7/8. ; Use CoqIDE as main application @@ -136,20 +114,24 @@ SectionEnd ;OCAML Section "Ocaml for native compute and plugin development" Sec2 ;OCAML SetOutPath "$INSTDIR\" ;OCAML !include "..\..\..\filelists\ocaml.nsh" -;OCAML +;OCAML ;OCAML ; Create a few slash / backslash variants of the source and install path ;OCAML ; Note: NSIS has variables, written as $VAR and defines, written as ${VAR} ;OCAML !insertmacro StrRep $COQ_SRC_PATH_BS ${COQ_SRC_PATH} "/" "\" ;OCAML !insertmacro StrRep $COQ_SRC_PATH_DBS ${COQ_SRC_PATH} "/" "\\" ;OCAML !insertmacro StrRep $INSTDIR_DBS $INSTDIR "\" "\\" -;OCAML +;OCAML ;OCAML ; Replace absolute paths in some OCaml config files ;OCAML ; These are not all, see ReadMe.txt ;OCAML !insertmacro ReplaceInFile "$INSTDIR\libocaml\ld.conf" "/" "\" ;OCAML !insertmacro ReplaceInFile "$INSTDIR\libocaml\ld.conf" "$COQ_SRC_PATH_BS" "$INSTDIR" ;OCAML !insertmacro ReplaceInFile "$INSTDIR\etc\findlib.conf" "$COQ_SRC_PATH_DBS" "$INSTDIR_DBS" ;OCAML SectionEnd - + +SectionGroup "Coq addons" Sec2 + !include "..\..\..\filelists\addon_sections.nsh" +SectionGroupEnd + Section "Coq files for plugin developers" Sec3 SetOutPath "$INSTDIR\" !include "..\..\..\filelists\coq_plugindev.nsh" @@ -171,24 +153,149 @@ SectionEnd ;OCAML SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=1000 ;OCAML SectionEnd +;-------------------------------- +;Section dependencies + +; Parameters on the stack: +; top-0 : section B on which section A dependencies +; top-1 : section A, which depends on section B +; top-2 : name of section B +; top-3 : name of section A + +Function CheckSectionDependency + ; stack=nameB nameA secB secA rest + Exch $R3 ; stack=$R3 nameA secB secA rest; $R3=nameB + Exch ; stack=nameA $R3 secB secA rest + Exch $R2 ; stack=$R2 $R3 secB secA rest; $R2=nameA + Exch 2 ; stack=secB $R3 $R2 secA rest + Exch $R1 ; stack=$R1 $R3 $R2 secA rest; $R1=secB + Exch 3 ; stack=secA $R3 $R2 $R1 rest; + Exch $R0 ; stack=$R0 $R3 $R2 $R1 rest; $R0=secA + ; Take care of save order when popping the stack! + Push $R4 + Push $R5 + + SectionGetFlags $R0 $R0 + IntOp $R0 $R0 & ${SF_SELECTED} + + SectionGetFlags $R1 $R4 + IntOp $R5 $R4 & ${SF_SELECTED} + + ${If} $R0 == ${SF_SELECTED} + ${AndIf} $R5 != ${SF_SELECTED} + + IntOp $R5 $R4 | ${SF_SELECTED} + SectionSetFlags $R1 $R5 + MessageBox MB_OK '"$R3" has been selected, because "$R2" depends on it' + + ${EndIf} + + Pop $R5 + Pop $R4 + Pop $R0 + Pop $R3 + Pop $R2 + Pop $R1 +FunctionEnd + +!macro CheckSectionDependency secA secB nameA nameB + Push "${secA}" + Push "${secB}" + Push "${nameA}" + Push "${nameB}" + Call CheckSectionDependency +!macroend + +!define CheckSectionDependency "!insertmacro CheckSectionDependency" + +Function .onSelChange + !include "..\..\..\filelists\addon_dependencies.nsh" +FunctionEnd + +;-------------------------------- +;Modern UI Configuration + +; Note: this must be placed after the sections, because below we need to check at compile time +; if sections exist (by !ifdef ) to decide if the license page must be included. +; The section index variables are only defined after the section definitions. + + !define MUI_ICON "${COQ_ICON}" + + !insertmacro MUI_PAGE_WELCOME + !insertmacro MUI_PAGE_LICENSE "${COQ_SRC_PATH}/license_readme/coq/License.txt" + !insertmacro MUI_PAGE_COMPONENTS + + !ifdef Sec_compcert + !define LicCompCert_Title "CompCert License Agreement" + !define LicCompCert_SubTitle "You selected the CompCert addon. CompCert is not open source. Please review the license terms before installing CompCert!" + !define LicCompCert_Bottom "If you accept the terms of the agreement, click I Agree to continue. Otherwise go back and unselect the CompCert addon." + !insertmacro MUI_PAGE_LICENSE_EXTRA "${COQ_SRC_PATH}/lib/coq/user-contrib/compcert/LICENSE" "${LicCompCert_Title}" "${LicCompCert_SubTitle}" "${LicCompCert_Bottom}" SelFuncCompCert + + Function SelFuncCompCert + ${Unless} ${SectionIsSelected} ${Sec_compcert} + Abort + ${EndUnless} + FunctionEnd + !endif + + !ifdef Sec_vst + !define LicVST_Title "Princeton VST License Agreement" + !define LicVST_SubTitle "You selected the VST addon. VST contains parts of CompCert which are not open source. Please review the license terms before installing VST!" + !define LicVST_Bottom "If you accept the terms of the agreement, click I Agree to continue. Otherwise go back and unselect the VST addon." + !insertmacro MUI_PAGE_LICENSE_EXTRA "${COQ_SRC_PATH}/lib/coq/user-contrib/VST/LICENSE" "${LicVST_Title}" "${LicVST_SubTitle}" "${LicVST_Bottom}" SelFuncVST + + Function SelFuncVST + ${Unless} ${SectionIsSelected} ${Sec_vst} + Abort + ${EndUnless} + FunctionEnd + !endif + + !define MUI_DIRECTORYPAGE_TEXT_TOP "Select where to install Coq. The path MUST NOT include spaces." + !insertmacro MUI_PAGE_DIRECTORY + !insertmacro MUI_PAGE_INSTFILES + !insertmacro MUI_PAGE_FINISH + + !insertmacro MUI_UNPAGE_WELCOME + !insertmacro MUI_UNPAGE_CONFIRM + !insertmacro MUI_UNPAGE_INSTFILES + !insertmacro MUI_UNPAGE_FINISH + +;-------------------------------- +;Languages + + !insertmacro MUI_LANGUAGE "English" + +;-------------------------------- +;Language Strings + + ;Description + LangString DESC_1 ${LANG_ENGLISH} "This package contains Coq and CoqIDE." + LangString DESC_2 ${LANG_ENGLISH} "This package contains the following extra Coq packages: ${COQ_ADDONS}" + LangString DESC_3 ${LANG_ENGLISH} "This package contains the development files needed in order to build a plugin for Coq." + ; LangString DESC_4 ${LANG_ENGLISH} "Set the OCAMLLIB environment variable for the current user." + ; LangString DESC_5 ${LANG_ENGLISH} "Set the OCAMLLIB environment variable for all users." + !include "..\..\..\filelists\addon_strings.nsh" + ;-------------------------------- ;Descriptions !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${Sec1} $(DESC_1) - ;OCAML !insertmacro MUI_DESCRIPTION_TEXT ${Sec2} $(DESC_2) + !insertmacro MUI_DESCRIPTION_TEXT ${Sec2} $(DESC_2) !insertmacro MUI_DESCRIPTION_TEXT ${Sec3} $(DESC_3) ;OCAML !insertmacro MUI_DESCRIPTION_TEXT ${Sec4} $(DESC_4) ;OCAML !insertmacro MUI_DESCRIPTION_TEXT ${Sec5} $(DESC_5) + !include "..\..\..\filelists\addon_descriptions.nsh" !insertmacro MUI_FUNCTION_DESCRIPTION_END - + ;-------------------------------- ;Uninstaller Section Section "Uninstall" ; Files and folders RMDir /r "$INSTDIR\bin" - RMDir /r "$INSTDIR\dev" + RMDir /r "$INSTDIR\doc" RMDir /r "$INSTDIR\etc" RMDir /r "$INSTDIR\lib" RMDir /r "$INSTDIR\libocaml" @@ -207,7 +314,7 @@ Section "Uninstall" Delete "$SMPROGRAMS\Coq\The Coq HomePage.url" Delete "$SMPROGRAMS\Coq\The Coq Standard Library.url" Delete "$INSTDIR\Uninstall.exe" - + ; Registry keys DeleteRegKey HKCU "Software\${MY_PRODUCT}" DeleteRegKey HKLM "SOFTWARE\Coq" diff --git a/dev/build/windows/patches_coq/lablgtk-2.18.3.patch b/dev/build/windows/patches_coq/lablgtk-2.18.3.patch index 0691c1fc..23c30313 100644 --- a/dev/build/windows/patches_coq/lablgtk-2.18.3.patch +++ b/dev/build/windows/patches_coq/lablgtk-2.18.3.patch @@ -1,6 +1,12 @@ -diff -u -r lablgtk-2.18.3/configure lablgtk-2.18.3.patched/configure ---- lablgtk-2.18.3/configure 2014-10-29 08:51:05.000000000 +0100 -+++ lablgtk-2.18.3.patched/configure 2015-10-29 08:58:08.543985500 +0100 +diff/patch file created on Wed, Apr 25, 2018 11:08:05 AM with: +difftar-folder.sh ../coq-msoegtrop/dev/build/windows/source_cache/lablgtk-2.18.3.tar.gz lablgtk-2.18.3 1 +TARFILE= ../coq-msoegtrop/dev/build/windows/source_cache/lablgtk-2.18.3.tar.gz +FOLDER= lablgtk-2.18.3 +TARSTRIP= 1 +TARPREFIX= lablgtk-2.18.3/ +ORIGFOLDER= lablgtk-2.18.3.orig +--- lablgtk-2.18.3.orig/configure 2014-10-29 08:51:05.000000000 +0100 ++++ lablgtk-2.18.3/configure 2018-04-25 10:58:54.454501600 +0200 @@ -2667,7 +2667,7 @@ fi @@ -10,10 +16,8 @@ diff -u -r lablgtk-2.18.3/configure lablgtk-2.18.3.patched/configure { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring ocamlfind" >&5 $as_echo "$as_me: WARNING: Ignoring ocamlfind" >&2;} OCAMLFIND=no - -diff -u -r lablgtk-2.18.3/src/glib.mli lablgtk-2.18.3.patched/src/glib.mli ---- lablgtk-2.18.3/src/glib.mli 2014-10-29 08:51:06.000000000 +0100 -+++ lablgtk-2.18.3.patched/src/glib.mli 2016-01-25 09:50:59.884715200 +0100 +--- lablgtk-2.18.3.orig/src/glib.mli 2014-10-29 08:51:06.000000000 +0100 ++++ lablgtk-2.18.3/src/glib.mli 2018-04-25 10:58:54.493555500 +0200 @@ -75,6 +75,7 @@ type condition = [ `ERR | `HUP | `IN | `NVAL | `OUT | `PRI] type id @@ -22,10 +26,8 @@ diff -u -r lablgtk-2.18.3/src/glib.mli lablgtk-2.18.3.patched/src/glib.mli val add_watch : cond:condition list -> callback:(condition list -> bool) -> ?prio:int -> channel -> id val remove : id -> unit - -diff -u -r lablgtk-2.18.3/src/glib.ml lablgtk-2.18.3.patched/src/glib.ml ---- lablgtk-2.18.3/src/glib.ml 2014-10-29 08:51:06.000000000 +0100 -+++ lablgtk-2.18.3.patched/src/glib.ml 2016-01-25 09:50:59.891715900 +0100 +--- lablgtk-2.18.3.orig/src/glib.ml 2014-10-29 08:51:06.000000000 +0100 ++++ lablgtk-2.18.3/src/glib.ml 2018-04-25 10:58:54.479543500 +0200 @@ -72,6 +72,8 @@ type id external channel_of_descr : Unix.file_descr -> channel @@ -35,10 +37,22 @@ diff -u -r lablgtk-2.18.3/src/glib.ml lablgtk-2.18.3.patched/src/glib.ml external remove : id -> unit = "ml_g_source_remove" external add_watch : cond:condition list -> callback:(condition list -> bool) -> ?prio:int -> channel -> id - -diff -u -r lablgtk-2.18.3/src/ml_glib.c lablgtk-2.18.3.patched/src/ml_glib.c ---- lablgtk-2.18.3/src/ml_glib.c 2014-10-29 08:51:06.000000000 +0100 -+++ lablgtk-2.18.3.patched/src/ml_glib.c 2016-01-25 09:50:59.898716600 +0100 +--- lablgtk-2.18.3.orig/src/Makefile 2014-10-29 08:51:06.000000000 +0100 ++++ lablgtk-2.18.3/src/Makefile 2018-04-25 10:58:54.506522500 +0200 +@@ -461,9 +461,9 @@ + do rm -f "$(BINDIR)"/$$f; done + + lablgtk.cma liblablgtk2$(XA): $(COBJS) $(MLOBJS) +- $(LIBRARIAN) -o lablgtk -oc lablgtk2 $^ $(GTKLIBS) ++ $(LIBRARIAN) -ldopt "-link -Wl,-s" -o lablgtk -oc lablgtk2 $^ $(GTKLIBS) + lablgtk.cmxa: $(COBJS) $(MLOBJS:.cmo=.cmx) +- $(LIBRARIAN) -o lablgtk -oc lablgtk2 $^ $(GTKLIBS) ++ $(LIBRARIAN) -ldopt "-link -Wl,-s" -o lablgtk -oc lablgtk2 $^ $(GTKLIBS) + lablgtk.cmxs: DYNLINKLIBS=$(GTK_LIBS) + + lablgtkgl.cma liblablgtkgl2$(XA): $(GLCOBJS) $(GLMLOBJS) +--- lablgtk-2.18.3.orig/src/ml_glib.c 2014-10-29 08:51:06.000000000 +0100 ++++ lablgtk-2.18.3/src/ml_glib.c 2018-04-25 10:58:54.539535600 +0200 @@ -25,6 +25,8 @@ #include #include diff --git a/dev/build/windows/patches_coq/lablgtk-2.18.6.patch b/dev/build/windows/patches_coq/lablgtk-2.18.6.patch new file mode 100644 index 00000000..23c30313 --- /dev/null +++ b/dev/build/windows/patches_coq/lablgtk-2.18.6.patch @@ -0,0 +1,101 @@ +diff/patch file created on Wed, Apr 25, 2018 11:08:05 AM with: +difftar-folder.sh ../coq-msoegtrop/dev/build/windows/source_cache/lablgtk-2.18.3.tar.gz lablgtk-2.18.3 1 +TARFILE= ../coq-msoegtrop/dev/build/windows/source_cache/lablgtk-2.18.3.tar.gz +FOLDER= lablgtk-2.18.3 +TARSTRIP= 1 +TARPREFIX= lablgtk-2.18.3/ +ORIGFOLDER= lablgtk-2.18.3.orig +--- lablgtk-2.18.3.orig/configure 2014-10-29 08:51:05.000000000 +0100 ++++ lablgtk-2.18.3/configure 2018-04-25 10:58:54.454501600 +0200 +@@ -2667,7 +2667,7 @@ + fi + + +-if test "`$OCAMLFIND printconf stdlib`" != "`$CAMLC -where`"; then ++if test "`$OCAMLFIND printconf stdlib | tr '\\' '/'`" != "`$CAMLC -where | tr '\\' '/'`"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring ocamlfind" >&5 + $as_echo "$as_me: WARNING: Ignoring ocamlfind" >&2;} + OCAMLFIND=no +--- lablgtk-2.18.3.orig/src/glib.mli 2014-10-29 08:51:06.000000000 +0100 ++++ lablgtk-2.18.3/src/glib.mli 2018-04-25 10:58:54.493555500 +0200 +@@ -75,6 +75,7 @@ + type condition = [ `ERR | `HUP | `IN | `NVAL | `OUT | `PRI] + type id + val channel_of_descr : Unix.file_descr -> channel ++ val channel_of_descr_socket : Unix.file_descr -> channel + val add_watch : + cond:condition list -> callback:(condition list -> bool) -> ?prio:int -> channel -> id + val remove : id -> unit +--- lablgtk-2.18.3.orig/src/glib.ml 2014-10-29 08:51:06.000000000 +0100 ++++ lablgtk-2.18.3/src/glib.ml 2018-04-25 10:58:54.479543500 +0200 +@@ -72,6 +72,8 @@ + type id + external channel_of_descr : Unix.file_descr -> channel + = "ml_g_io_channel_unix_new" ++ external channel_of_descr_socket : Unix.file_descr -> channel ++ = "ml_g_io_channel_unix_new_socket" + external remove : id -> unit = "ml_g_source_remove" + external add_watch : + cond:condition list -> callback:(condition list -> bool) -> ?prio:int -> channel -> id +--- lablgtk-2.18.3.orig/src/Makefile 2014-10-29 08:51:06.000000000 +0100 ++++ lablgtk-2.18.3/src/Makefile 2018-04-25 10:58:54.506522500 +0200 +@@ -461,9 +461,9 @@ + do rm -f "$(BINDIR)"/$$f; done + + lablgtk.cma liblablgtk2$(XA): $(COBJS) $(MLOBJS) +- $(LIBRARIAN) -o lablgtk -oc lablgtk2 $^ $(GTKLIBS) ++ $(LIBRARIAN) -ldopt "-link -Wl,-s" -o lablgtk -oc lablgtk2 $^ $(GTKLIBS) + lablgtk.cmxa: $(COBJS) $(MLOBJS:.cmo=.cmx) +- $(LIBRARIAN) -o lablgtk -oc lablgtk2 $^ $(GTKLIBS) ++ $(LIBRARIAN) -ldopt "-link -Wl,-s" -o lablgtk -oc lablgtk2 $^ $(GTKLIBS) + lablgtk.cmxs: DYNLINKLIBS=$(GTK_LIBS) + + lablgtkgl.cma liblablgtkgl2$(XA): $(GLCOBJS) $(GLMLOBJS) +--- lablgtk-2.18.3.orig/src/ml_glib.c 2014-10-29 08:51:06.000000000 +0100 ++++ lablgtk-2.18.3/src/ml_glib.c 2018-04-25 10:58:54.539535600 +0200 +@@ -25,6 +25,8 @@ + #include + #include + #ifdef _WIN32 ++/* to kill a #warning: include winsock2.h before windows.h */ ++#include + #include "win32.h" + #include + #include +@@ -38,6 +40,11 @@ + #include + #include + ++#ifdef _WIN32 ++/* for Socket_val */ ++#include ++#endif ++ + #include "wrappers.h" + #include "ml_glib.h" + #include "glib_tags.h" +@@ -325,14 +332,23 @@ + + #ifndef _WIN32 + ML_1 (g_io_channel_unix_new, Int_val, Val_GIOChannel_noref) ++CAMLprim value ml_g_io_channel_unix_new_socket (value arg1) { ++ return Val_GIOChannel_noref (g_io_channel_unix_new (Int_val (arg1))); ++} + + #else + CAMLprim value ml_g_io_channel_unix_new(value wh) + { + return Val_GIOChannel_noref +- (g_io_channel_unix_new ++ (g_io_channel_win32_new_fd + (_open_osfhandle((long)*(HANDLE*)Data_custom_val(wh), O_BINARY))); + } ++ ++CAMLprim value ml_g_io_channel_unix_new_socket(value wh) ++{ ++ return Val_GIOChannel_noref ++ (g_io_channel_win32_new_socket(Socket_val(wh))); ++} + #endif + + static gboolean ml_g_io_channel_watch(GIOChannel *s, GIOCondition c, diff --git a/dev/build/windows/patches_coq/ln.c b/dev/build/windows/patches_coq/ln.c index 5e02c72b..41f64f98 100644 --- a/dev/build/windows/patches_coq/ln.c +++ b/dev/build/windows/patches_coq/ln.c @@ -134,4 +134,4 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin // Everything is fine return 0; -} \ No newline at end of file +} diff --git a/dev/build/windows/patches_coq/quickchick-v1.0.2.patch b/dev/build/windows/patches_coq/quickchick-v1.0.2.patch new file mode 100644 index 00000000..d03749ba --- /dev/null +++ b/dev/build/windows/patches_coq/quickchick-v1.0.2.patch @@ -0,0 +1,38 @@ +diff/patch file created on Mon, Aug 27, 2018 9:21:52 AM with: +difftar-folder.sh tarballs/quickchick-v1.0.2.tar.gz quickchick-v1.0.2 1 +TARFILE= tarballs/quickchick-v1.0.2.tar.gz +FOLDER= quickchick-v1.0.2 +TARSTRIP= 1 +TARPREFIX= QuickChick-1.0.2/ +ORIGFOLDER= quickchick-v1.0.2.orig +--- quickchick-v1.0.2.orig/Makefile 2018-08-22 18:21:39.000000000 +0200 ++++ quickchick-v1.0.2/Makefile 2018-08-27 09:21:04.710461100 +0200 +@@ -2,7 +2,7 @@ + .PHONY: plugin install install-plugin clean quickChickTool + + QCTOOL_DIR=quickChickTool +-QCTOOL_EXE=quickChickTool.byte ++QCTOOL_EXE=quickChickTool.native + QCTOOL_SRC=$(QCTOOL_DIR)/quickChickTool.ml \ + $(QCTOOL_DIR)/quickChickToolTypes.ml \ + $(QCTOOL_DIR)/quickChickToolLexer.mll \ +@@ -32,7 +32,7 @@ + install: all + $(V)$(MAKE) -f Makefile.coq install > $(TEMPFILE) + # Manually copying the remaining files +- $(V)cp $(QCTOOL_EXE) $(shell opam config var bin)/quickChick ++ $(V)cp $(QCTOOL_EXE) "$(COQBIN)/quickChick" + # $(V)cp src/quickChickLib.cmx $(COQLIB)/user-contrib/QuickChick + # $(V)cp src/quickChickLib.o $(COQLIB)/user-contrib/QuickChick + +--- quickchick-v1.0.2.orig/src/Show.v 2018-08-22 18:21:39.000000000 +0200 ++++ quickchick-v1.0.2/src/Show.v 2018-08-27 09:21:35.893961900 +0200 +@@ -228,7 +228,7 @@ + match s with + | EmptyString => (if b then ")" else "", b) + | String a s => +- let (s', b) := aux s (orb b (nat_of_ascii a =? 32)) in ++ let (s', b) := aux s (orb b (nat_of_ascii a =? 32)%nat) in + (String a s', b) + end in + let (s', b) := aux s false in diff --git a/dev/build/windows/patches_coq/sed-4.2.2-3.src.patch b/dev/build/windows/patches_coq/sed-4.2.2-3.src.patch new file mode 100755 index 00000000..d210a041 --- /dev/null +++ b/dev/build/windows/patches_coq/sed-4.2.2-3.src.patch @@ -0,0 +1,1301 @@ +--- origsrc/sed-4.2.2/doc/sed.1 2012-12-22 15:27:13.000000000 +0100 ++++ src/sed-4.2.2/doc/sed.1 2013-06-27 18:10:47.974060492 +0200 +@@ -1,5 +1,5 @@ + .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.28. +-.TH SED "1" "December 2012" "sed 4.2.2" "User Commands" ++.TH SED "1" "June 2013" "sed 4.2.2" "User Commands" + .SH NAME + sed \- stream editor for filtering and transforming text + .SH SYNOPSIS +@@ -40,6 +40,10 @@ follow symlinks when processing in place + .IP + edit files in place (makes backup if SUFFIX supplied) + .HP ++\fB\-b\fR, \fB\-\-binary\fR ++.IP ++open files in binary mode (CR+LFs are not processed specially) ++.HP + \fB\-l\fR N, \fB\-\-line\-length\fR=\fIN\fR + .IP + specify the desired line-wrap length for the `l' command +--- origsrc/sed-4.2.2/lib/regcomp.c 2012-12-22 14:21:52.000000000 +0100 ++++ src/sed-4.2.2/lib/regcomp.c 2013-06-27 18:05:27.044448044 +0200 +@@ -1,22 +1,21 @@ +-/* -*- buffer-read-only: t -*- vi: set ro: */ +-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ + /* Extended regular expression matching and search library. +- Copyright (C) 2002-2012 Free Software Foundation, Inc. ++ Copyright (C) 2002-2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Isamu Hasegawa . + +- This program is free software; you can redistribute it and/or modify +- it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 3, or (at your option) +- any later version. ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. + +- This program is distributed in the hope that it will be useful, ++ The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, see . */ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ + + static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern, + size_t length, reg_syntax_t syntax); +@@ -95,20 +94,20 @@ static reg_errcode_t build_charclass (RE + bitset_t sbcset, + re_charset_t *mbcset, + Idx *char_class_alloc, +- const unsigned char *class_name, ++ const char *class_name, + reg_syntax_t syntax); + #else /* not RE_ENABLE_I18N */ + static reg_errcode_t build_equiv_class (bitset_t sbcset, + const unsigned char *name); + static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans, + bitset_t sbcset, +- const unsigned char *class_name, ++ const char *class_name, + reg_syntax_t syntax); + #endif /* not RE_ENABLE_I18N */ + static bin_tree_t *build_charclass_op (re_dfa_t *dfa, + RE_TRANSLATE_TYPE trans, +- const unsigned char *class_name, +- const unsigned char *extra, ++ const char *class_name, ++ const char *extra, + bool non_match, reg_errcode_t *err); + static bin_tree_t *create_tree (re_dfa_t *dfa, + bin_tree_t *left, bin_tree_t *right, +@@ -293,7 +292,7 @@ weak_alias (__re_compile_fastmap, re_com + #endif + + static inline void +-__attribute ((always_inline)) ++__attribute__ ((always_inline)) + re_set_fastmap (char *fastmap, bool icase, int ch) + { + fastmap[ch] = 1; +@@ -587,7 +586,7 @@ weak_alias (__regerror, regerror) + static const bitset_t utf8_sb_map = + { + /* Set the first 128 bits. */ +-# ifdef __GNUC__ ++# if defined __GNUC__ && !defined __STRICT_ANSI__ + [0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX + # else + # if 4 * BITSET_WORD_BITS < ASCII_CHARS +@@ -664,7 +663,10 @@ regfree (preg) + { + re_dfa_t *dfa = preg->buffer; + if (BE (dfa != NULL, 1)) +- free_dfa_content (dfa); ++ { ++ lock_fini (dfa->lock); ++ free_dfa_content (dfa); ++ } + preg->buffer = NULL; + preg->allocated = 0; + +@@ -785,6 +787,8 @@ re_compile_internal (regex_t *preg, cons + preg->used = sizeof (re_dfa_t); + + err = init_dfa (dfa, length); ++ if (BE (err == REG_NOERROR && lock_init (dfa->lock) != 0, 0)) ++ err = REG_ESPACE; + if (BE (err != REG_NOERROR, 0)) + { + free_dfa_content (dfa); +@@ -798,8 +802,6 @@ re_compile_internal (regex_t *preg, cons + strncpy (dfa->re_str, pattern, length + 1); + #endif + +- __libc_lock_init (dfa->lock); +- + err = re_string_construct (®exp, pattern, length, preg->translate, + (syntax & RE_ICASE) != 0, dfa); + if (BE (err != REG_NOERROR, 0)) +@@ -807,6 +809,7 @@ re_compile_internal (regex_t *preg, cons + re_compile_internal_free_return: + free_workarea_compile (preg); + re_string_destruct (®exp); ++ lock_fini (dfa->lock); + free_dfa_content (dfa); + preg->buffer = NULL; + preg->allocated = 0; +@@ -839,6 +842,7 @@ re_compile_internal (regex_t *preg, cons + + if (BE (err != REG_NOERROR, 0)) + { ++ lock_fini (dfa->lock); + free_dfa_content (dfa); + preg->buffer = NULL; + preg->allocated = 0; +@@ -954,10 +958,10 @@ static void + internal_function + init_word_char (re_dfa_t *dfa) + { +- dfa->word_ops_used = 1; + int i = 0; + int j; + int ch = 0; ++ dfa->word_ops_used = 1; + if (BE (dfa->map_notascii == 0, 1)) + { + bitset_word_t bits0 = 0x00000000; +@@ -2423,8 +2427,8 @@ parse_expression (re_string_t *regexp, r + case OP_WORD: + case OP_NOTWORD: + tree = build_charclass_op (dfa, regexp->trans, +- (const unsigned char *) "alnum", +- (const unsigned char *) "_", ++ "alnum", ++ "_", + token->type == OP_NOTWORD, err); + if (BE (*err != REG_NOERROR && tree == NULL, 0)) + return NULL; +@@ -2432,8 +2436,8 @@ parse_expression (re_string_t *regexp, r + case OP_SPACE: + case OP_NOTSPACE: + tree = build_charclass_op (dfa, regexp->trans, +- (const unsigned char *) "space", +- (const unsigned char *) "", ++ "space", ++ "", + token->type == OP_NOTSPACE, err); + if (BE (*err != REG_NOERROR && tree == NULL, 0)) + return NULL; +@@ -2713,7 +2717,6 @@ build_range_exp (const reg_syntax_t synt + wchar_t wc; + wint_t start_wc; + wint_t end_wc; +- wchar_t cmp_buf[6] = {L'\0', L'\0', L'\0', L'\0', L'\0', L'\0'}; + + start_ch = ((start_elem->type == SB_CHAR) ? start_elem->opr.ch + : ((start_elem->type == COLL_SYM) ? start_elem->opr.name[0] +@@ -2727,11 +2730,7 @@ build_range_exp (const reg_syntax_t synt + ? __btowc (end_ch) : end_elem->opr.wch); + if (start_wc == WEOF || end_wc == WEOF) + return REG_ECOLLATE; +- cmp_buf[0] = start_wc; +- cmp_buf[4] = end_wc; +- +- if (BE ((syntax & RE_NO_EMPTY_RANGES) +- && wcscoll (cmp_buf, cmp_buf + 4) > 0, 0)) ++ else if (BE ((syntax & RE_NO_EMPTY_RANGES) && start_wc > end_wc, 0)) + return REG_ERANGE; + + /* Got valid collation sequence values, add them as a new entry. +@@ -2772,9 +2771,7 @@ build_range_exp (const reg_syntax_t synt + /* Build the table for single byte characters. */ + for (wc = 0; wc < SBC_MAX; ++wc) + { +- cmp_buf[2] = wc; +- if (wcscoll (cmp_buf, cmp_buf + 2) <= 0 +- && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0) ++ if (start_wc <= wc && wc <= end_wc) + bitset_set (sbcset, wc); + } + } +@@ -2843,40 +2840,29 @@ parse_bracket_exp (re_string_t *regexp, + + /* Local function for parse_bracket_exp used in _LIBC environment. + Seek the collating symbol entry corresponding to NAME. +- Return the index of the symbol in the SYMB_TABLE. */ ++ Return the index of the symbol in the SYMB_TABLE, ++ or -1 if not found. */ + + auto inline int32_t +- __attribute ((always_inline)) +- seek_collating_symbol_entry (name, name_len) +- const unsigned char *name; +- size_t name_len; +- { +- int32_t hash = elem_hash ((const char *) name, name_len); +- int32_t elem = hash % table_size; +- if (symb_table[2 * elem] != 0) +- { +- int32_t second = hash % (table_size - 2) + 1; +- +- do +- { +- /* First compare the hashing value. */ +- if (symb_table[2 * elem] == hash +- /* Compare the length of the name. */ +- && name_len == extra[symb_table[2 * elem + 1]] +- /* Compare the name. */ +- && memcmp (name, &extra[symb_table[2 * elem + 1] + 1], +- name_len) == 0) +- { +- /* Yep, this is the entry. */ +- break; +- } ++ __attribute__ ((always_inline)) ++ seek_collating_symbol_entry (const unsigned char *name, size_t name_len) ++ { ++ int32_t elem; + +- /* Next entry. */ +- elem += second; +- } +- while (symb_table[2 * elem] != 0); +- } +- return elem; ++ for (elem = 0; elem < table_size; elem++) ++ if (symb_table[2 * elem] != 0) ++ { ++ int32_t idx = symb_table[2 * elem + 1]; ++ /* Skip the name of collating element name. */ ++ idx += 1 + extra[idx]; ++ if (/* Compare the length of the name. */ ++ name_len == extra[idx] ++ /* Compare the name. */ ++ && memcmp (name, &extra[idx + 1], name_len) == 0) ++ /* Yep, this is the entry. */ ++ return elem; ++ } ++ return -1; + } + + /* Local function for parse_bracket_exp used in _LIBC environment. +@@ -2884,9 +2870,8 @@ parse_bracket_exp (re_string_t *regexp, + Return the value if succeeded, UINT_MAX otherwise. */ + + auto inline unsigned int +- __attribute ((always_inline)) +- lookup_collation_sequence_value (br_elem) +- bracket_elem_t *br_elem; ++ __attribute__ ((always_inline)) ++ lookup_collation_sequence_value (bracket_elem_t *br_elem) + { + if (br_elem->type == SB_CHAR) + { +@@ -2914,7 +2899,7 @@ parse_bracket_exp (re_string_t *regexp, + int32_t elem, idx; + elem = seek_collating_symbol_entry (br_elem->opr.name, + sym_name_len); +- if (symb_table[2 * elem] != 0) ++ if (elem != -1) + { + /* We found the entry. */ + idx = symb_table[2 * elem + 1]; +@@ -2932,7 +2917,7 @@ parse_bracket_exp (re_string_t *regexp, + /* Return the collation sequence value. */ + return *(unsigned int *) (extra + idx); + } +- else if (symb_table[2 * elem] == 0 && sym_name_len == 1) ++ else if (sym_name_len == 1) + { + /* No valid character. Match it as a single byte + character. */ +@@ -2953,12 +2938,9 @@ parse_bracket_exp (re_string_t *regexp, + update it. */ + + auto inline reg_errcode_t +- __attribute ((always_inline)) +- build_range_exp (sbcset, mbcset, range_alloc, start_elem, end_elem) +- re_charset_t *mbcset; +- Idx *range_alloc; +- bitset_t sbcset; +- bracket_elem_t *start_elem, *end_elem; ++ __attribute__ ((always_inline)) ++ build_range_exp (bitset_t sbcset, re_charset_t *mbcset, int *range_alloc, ++ bracket_elem_t *start_elem, bracket_elem_t *end_elem) + { + unsigned int ch; + uint32_t start_collseq; +@@ -2971,6 +2953,7 @@ parse_bracket_exp (re_string_t *regexp, + 0)) + return REG_ERANGE; + ++ /* FIXME: Implement rational ranges here, too. */ + start_collseq = lookup_collation_sequence_value (start_elem); + end_collseq = lookup_collation_sequence_value (end_elem); + /* Check start/end collation sequence values. */ +@@ -3036,26 +3019,23 @@ parse_bracket_exp (re_string_t *regexp, + pointer argument since we may update it. */ + + auto inline reg_errcode_t +- __attribute ((always_inline)) +- build_collating_symbol (sbcset, mbcset, coll_sym_alloc, name) +- re_charset_t *mbcset; +- Idx *coll_sym_alloc; +- bitset_t sbcset; +- const unsigned char *name; ++ __attribute__ ((always_inline)) ++ build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset, ++ Idx *coll_sym_alloc, const unsigned char *name) + { + int32_t elem, idx; + size_t name_len = strlen ((const char *) name); + if (nrules != 0) + { + elem = seek_collating_symbol_entry (name, name_len); +- if (symb_table[2 * elem] != 0) ++ if (elem != -1) + { + /* We found the entry. */ + idx = symb_table[2 * elem + 1]; + /* Skip the name of collating element name. */ + idx += 1 + extra[idx]; + } +- else if (symb_table[2 * elem] == 0 && name_len == 1) ++ else if (name_len == 1) + { + /* No valid character, treat it as a normal + character. */ +@@ -3298,7 +3278,8 @@ parse_bracket_exp (re_string_t *regexp, + #ifdef RE_ENABLE_I18N + mbcset, &char_class_alloc, + #endif /* RE_ENABLE_I18N */ +- start_elem.opr.name, syntax); ++ (const char *) start_elem.opr.name, ++ syntax); + if (BE (*err != REG_NOERROR, 0)) + goto parse_bracket_exp_free_return; + break; +@@ -3578,14 +3559,14 @@ static reg_errcode_t + #ifdef RE_ENABLE_I18N + build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset, + re_charset_t *mbcset, Idx *char_class_alloc, +- const unsigned char *class_name, reg_syntax_t syntax) ++ const char *class_name, reg_syntax_t syntax) + #else /* not RE_ENABLE_I18N */ + build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset, +- const unsigned char *class_name, reg_syntax_t syntax) ++ const char *class_name, reg_syntax_t syntax) + #endif /* not RE_ENABLE_I18N */ + { + int i; +- const char *name = (const char *) class_name; ++ const char *name = class_name; + + /* In case of REG_ICASE "upper" and "lower" match the both of + upper and lower cases. */ +@@ -3659,8 +3640,8 @@ build_charclass (RE_TRANSLATE_TYPE trans + + static bin_tree_t * + build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, +- const unsigned char *class_name, +- const unsigned char *extra, bool non_match, ++ const char *class_name, ++ const char *extra, bool non_match, + reg_errcode_t *err) + { + re_bitset_ptr_t sbcset; +--- origsrc/sed-4.2.2/lib/regex-quote.c 1970-01-01 01:00:00.000000000 +0100 ++++ src/sed-4.2.2/lib/regex-quote.c 2013-06-27 18:05:27.081447884 +0200 +@@ -0,0 +1,216 @@ ++/* Construct a regular expression from a literal string. ++ Copyright (C) 1995, 2010-2013 Free Software Foundation, Inc. ++ Written by Bruno Haible , 2010. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#include ++ ++/* Specification. */ ++#include "regex-quote.h" ++ ++#include ++ ++#include "mbuiter.h" ++#include "xalloc.h" ++ ++/* Characters that are special in a BRE. */ ++static const char bre_special[] = "$^.*[]\\"; ++ ++/* Characters that are special in an ERE. */ ++static const char ere_special[] = "$^.*[]\\+?{}()|"; ++ ++struct regex_quote_spec ++regex_quote_spec_posix (int cflags, bool anchored) ++{ ++ struct regex_quote_spec result; ++ ++ strcpy (result.special, cflags != 0 ? ere_special : bre_special); ++ result.multibyte = true; ++ result.anchored = anchored; ++ ++ return result; ++} ++ ++/* Syntax bit values, defined in GNU . We don't include it here, ++ otherwise this module would need to depend on gnulib module 'regex'. */ ++#define RE_BK_PLUS_QM 0x00000002 ++#define RE_INTERVALS 0x00000200 ++#define RE_LIMITED_OPS 0x00000400 ++#define RE_NEWLINE_ALT 0x00000800 ++#define RE_NO_BK_BRACES 0x00001000 ++#define RE_NO_BK_PARENS 0x00002000 ++#define RE_NO_BK_VBAR 0x00008000 ++ ++struct regex_quote_spec ++regex_quote_spec_gnu (unsigned long /*reg_syntax_t*/ syntax, bool anchored) ++{ ++ struct regex_quote_spec result; ++ char *p; ++ ++ p = result.special; ++ memcpy (p, bre_special, sizeof (bre_special) - 1); ++ p += sizeof (bre_special) - 1; ++ if ((syntax & RE_LIMITED_OPS) == 0 && (syntax & RE_BK_PLUS_QM) == 0) ++ { ++ *p++ = '+'; ++ *p++ = '?'; ++ } ++ if ((syntax & RE_INTERVALS) != 0 && (syntax & RE_NO_BK_BRACES) != 0) ++ { ++ *p++ = '{'; ++ *p++ = '}'; ++ } ++ if ((syntax & RE_NO_BK_PARENS) != 0) ++ { ++ *p++ = '('; ++ *p++ = ')'; ++ } ++ if ((syntax & RE_LIMITED_OPS) == 0 && (syntax & RE_NO_BK_VBAR) != 0) ++ *p++ = '|'; ++ if ((syntax & RE_NEWLINE_ALT) != 0) ++ *p++ = '\n'; ++ *p = '\0'; ++ ++ result.multibyte = true; ++ result.anchored = anchored; ++ ++ return result; ++} ++ ++/* Characters that are special in a PCRE. */ ++static const char pcre_special[] = "$^.*[]\\+?{}()|"; ++ ++/* Options bit values, defined in . We don't include it here, because ++ it is not a standard header. */ ++#define PCRE_ANCHORED 0x00000010 ++#define PCRE_EXTENDED 0x00000008 ++ ++struct regex_quote_spec ++regex_quote_spec_pcre (int options, bool anchored) ++{ ++ struct regex_quote_spec result; ++ char *p; ++ ++ p = result.special; ++ memcpy (p, bre_special, sizeof (pcre_special) - 1); ++ p += sizeof (pcre_special) - 1; ++ if (options & PCRE_EXTENDED) ++ { ++ *p++ = ' '; ++ *p++ = '\t'; ++ *p++ = '\n'; ++ *p++ = '\v'; ++ *p++ = '\f'; ++ *p++ = '\r'; ++ *p++ = '#'; ++ } ++ *p = '\0'; ++ ++ /* PCRE regular expressions consist of UTF-8 characters of options contains ++ PCRE_UTF8 and of single bytes otherwise. */ ++ result.multibyte = false; ++ /* If options contains PCRE_ANCHORED, the anchoring is implicit. */ ++ result.anchored = (options & PCRE_ANCHORED ? 0 : anchored); ++ ++ return result; ++} ++ ++size_t ++regex_quote_length (const char *string, const struct regex_quote_spec *spec) ++{ ++ const char *special = spec->special; ++ size_t length; ++ ++ length = 0; ++ if (spec->anchored) ++ length += 2; /* for '^' at the beginning and '$' at the end */ ++ if (spec->multibyte) ++ { ++ mbui_iterator_t iter; ++ ++ for (mbui_init (iter, string); mbui_avail (iter); mbui_advance (iter)) ++ { ++ /* We know that special contains only ASCII characters. */ ++ if (mb_len (mbui_cur (iter)) == 1 ++ && strchr (special, * mbui_cur_ptr (iter))) ++ length += 1; ++ length += mb_len (mbui_cur (iter)); ++ } ++ } ++ else ++ { ++ const char *iter; ++ ++ for (iter = string; *iter != '\0'; iter++) ++ { ++ if (strchr (special, *iter)) ++ length += 1; ++ length += 1; ++ } ++ } ++ ++ return length; ++} ++ ++char * ++regex_quote_copy (char *p, const char *string, const struct regex_quote_spec *spec) ++{ ++ const char *special = spec->special; ++ ++ if (spec->anchored) ++ *p++ = '^'; ++ if (spec->multibyte) ++ { ++ mbui_iterator_t iter; ++ ++ for (mbui_init (iter, string); mbui_avail (iter); mbui_advance (iter)) ++ { ++ /* We know that special contains only ASCII characters. */ ++ if (mb_len (mbui_cur (iter)) == 1 ++ && strchr (special, * mbui_cur_ptr (iter))) ++ *p++ = '\\'; ++ memcpy (p, mbui_cur_ptr (iter), mb_len (mbui_cur (iter))); ++ p += mb_len (mbui_cur (iter)); ++ } ++ } ++ else ++ { ++ const char *iter; ++ ++ for (iter = string; *iter != '\0'; iter++) ++ { ++ if (strchr (special, *iter)) ++ *p++ = '\\'; ++ *p++ = *iter++; ++ } ++ } ++ if (spec->anchored) ++ *p++ = '$'; ++ ++ return p; ++} ++ ++char * ++regex_quote (const char *string, const struct regex_quote_spec *spec) ++{ ++ size_t length = regex_quote_length (string, spec); ++ char *result = XNMALLOC (length + 1, char); ++ char *p; ++ ++ p = result; ++ p = regex_quote_copy (p, string, spec); ++ *p = '\0'; ++ return result; ++} +--- origsrc/sed-4.2.2/lib/regex-quote.h 1970-01-01 01:00:00.000000000 +0100 ++++ src/sed-4.2.2/lib/regex-quote.h 2013-06-27 18:05:27.112447751 +0200 +@@ -0,0 +1,88 @@ ++/* Construct a regular expression from a literal string. ++ Copyright (C) 1995, 2010-2013 Free Software Foundation, Inc. ++ Written by Bruno Haible , 2010. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#ifndef _REGEX_QUOTE_H ++#define _REGEX_QUOTE_H ++ ++#include ++#include ++ ++ ++/* Specifies a quotation task for converting a fixed string to a regular ++ expression pattern. */ ++struct regex_quote_spec ++{ ++ /* True if the regular expression pattern consists of multibyte characters ++ (in the encoding given by the LC_CTYPE category of the locale), ++ false if it consists of single bytes or UTF-8 characters. */ ++ unsigned int /*bool*/ multibyte : 1; ++ /* True if the regular expression pattern shall match only entire lines. */ ++ unsigned int /*bool*/ anchored : 1; ++ /* Set of characters that need to be escaped (all ASCII), as a ++ NUL-terminated string. */ ++ char special[30 + 1]; ++}; ++ ++ ++/* Creates a quotation task that produces a POSIX regular expression, that is, ++ a pattern that can be compiled with regcomp(). ++ CFLAGS can be 0 or REG_EXTENDED. ++ If it is 0, the result is a Basic Regular Expression (BRE) ++ . ++ If it is REG_EXTENDED, the result is an Extended Regular Expression (ERE) ++ . ++ If ANCHORED is false, the regular expression will match substrings of lines. ++ If ANCHORED is true, it will match only complete lines, */ ++extern struct regex_quote_spec ++ regex_quote_spec_posix (int cflags, bool anchored); ++ ++/* Creates a quotation task that produces a regular expression that can be ++ compiled with the GNU API function re_compile_pattern(). ++ SYNTAX describes the syntax of the regular expression (such as ++ RE_SYNTAX_POSIX_BASIC, RE_SYNTAX_POSIX_EXTENDED, RE_SYNTAX_EMACS, all ++ defined in ). It must be the same value as 're_syntax_options' ++ at the moment of the re_compile_pattern() call. ++ If ANCHORED is false, the regular expression will match substrings of lines. ++ If ANCHORED is true, it will match only complete lines, */ ++extern struct regex_quote_spec ++ regex_quote_spec_gnu (unsigned long /*reg_syntax_t*/ syntax, bool anchored); ++ ++/* Creates a quotation task that produces a PCRE regular expression, that is, ++ a pattern that can be compiled with pcre_compile(). ++ OPTIONS is the same value as the second argument passed to pcre_compile(). ++ If ANCHORED is false, the regular expression will match substrings of lines. ++ If ANCHORED is true, it will match only complete lines, */ ++extern struct regex_quote_spec ++ regex_quote_spec_pcre (int options, bool anchored); ++ ++ ++/* Returns the number of bytes needed for the quoted string. */ ++extern size_t ++ regex_quote_length (const char *string, const struct regex_quote_spec *spec); ++ ++/* Copies the quoted string to p and returns the incremented p. ++ There must be room for regex_quote_length (string, spec) + 1 bytes at p. */ ++extern char * ++ regex_quote_copy (char *p, ++ const char *string, const struct regex_quote_spec *spec); ++ ++/* Returns the freshly allocated quoted string. */ ++extern char * ++ regex_quote (const char *string, const struct regex_quote_spec *spec); ++ ++ ++#endif /* _REGEX_QUOTE_H */ +--- origsrc/sed-4.2.2/lib/regex.c 2012-12-22 14:21:52.000000000 +0100 ++++ src/sed-4.2.2/lib/regex.c 2013-06-27 18:05:27.138447639 +0200 +@@ -1,22 +1,21 @@ +-/* -*- buffer-read-only: t -*- vi: set ro: */ +-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ + /* Extended regular expression matching and search library. +- Copyright (C) 2002-2003, 2005-2006, 2009-2012 Free Software Foundation, Inc. ++ Copyright (C) 2002-2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Isamu Hasegawa . + +- This program is free software; you can redistribute it and/or modify +- it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 3, or (at your option) +- any later version. ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. + +- This program is distributed in the hope that it will be useful, ++ The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, see . */ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ + + #ifndef _LIBC + # include +@@ -25,6 +24,7 @@ + # pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" + # endif + # if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__ ++# pragma GCC diagnostic ignored "-Wold-style-definition" + # pragma GCC diagnostic ignored "-Wtype-limits" + # endif + #endif +--- origsrc/sed-4.2.2/lib/regex.h 2012-12-22 14:21:52.000000000 +0100 ++++ src/sed-4.2.2/lib/regex.h 2013-06-27 18:05:27.168447509 +0200 +@@ -1,23 +1,22 @@ +-/* -*- buffer-read-only: t -*- vi: set ro: */ +-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ + /* Definitions for data structures and routines for the regular + expression library. +- Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2012 +- Free Software Foundation, Inc. ++ Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2013 Free Software ++ Foundation, Inc. + This file is part of the GNU C Library. + +- This program is free software; you can redistribute it and/or modify +- it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 3, or (at your option) +- any later version. ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. + +- This program is distributed in the hope that it will be useful, ++ The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, see . */ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ + + #ifndef _REGEX_H + #define _REGEX_H 1 +--- origsrc/sed-4.2.2/lib/regex_internal.c 2012-12-22 14:21:52.000000000 +0100 ++++ src/sed-4.2.2/lib/regex_internal.c 2013-06-27 18:05:27.199447375 +0200 +@@ -1,22 +1,21 @@ +-/* -*- buffer-read-only: t -*- vi: set ro: */ +-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ + /* Extended regular expression matching and search library. +- Copyright (C) 2002-2012 Free Software Foundation, Inc. ++ Copyright (C) 2002-2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Isamu Hasegawa . + +- This program is free software; you can redistribute it and/or modify +- it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 3, or (at your option) +- any later version. ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. + +- This program is distributed in the hope that it will be useful, ++ The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, see . */ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ + + static void re_string_construct_common (const char *str, Idx len, + re_string_t *pstr, +@@ -835,7 +834,7 @@ re_string_reconstruct (re_string_t *pstr + } + + static unsigned char +-internal_function __attribute ((pure)) ++internal_function __attribute__ ((pure)) + re_string_peek_byte_case (const re_string_t *pstr, Idx idx) + { + int ch; +@@ -975,7 +974,7 @@ re_node_set_alloc (re_node_set *set, Idx + set->alloc = size; + set->nelem = 0; + set->elems = re_malloc (Idx, size); +- if (BE (set->elems == NULL, 0)) ++ if (BE (set->elems == NULL, 0) && (MALLOC_0_IS_NONNULL || size != 0)) + return REG_ESPACE; + return REG_NOERROR; + } +@@ -1355,7 +1354,7 @@ re_node_set_insert_last (re_node_set *se + Return true if SET1 and SET2 are equivalent. */ + + static bool +-internal_function __attribute ((pure)) ++internal_function __attribute__ ((pure)) + re_node_set_compare (const re_node_set *set1, const re_node_set *set2) + { + Idx i; +@@ -1370,7 +1369,7 @@ re_node_set_compare (const re_node_set * + /* Return (idx + 1) if SET contains the element ELEM, return 0 otherwise. */ + + static Idx +-internal_function __attribute ((pure)) ++internal_function __attribute__ ((pure)) + re_node_set_contains (const re_node_set *set, Idx elem) + { + __re_size_t idx, right, mid; +@@ -1444,11 +1443,9 @@ re_dfa_add_node (re_dfa_t *dfa, re_token + dfa->nodes[dfa->nodes_len] = token; + dfa->nodes[dfa->nodes_len].constraint = 0; + #ifdef RE_ENABLE_I18N +- { +- int type = token.type; + dfa->nodes[dfa->nodes_len].accept_mb = +- (type == OP_PERIOD && dfa->mb_cur_max > 1) || type == COMPLEX_BRACKET; +- } ++ ((token.type == OP_PERIOD && dfa->mb_cur_max > 1) ++ || token.type == COMPLEX_BRACKET); + #endif + dfa->nexts[dfa->nodes_len] = REG_MISSING; + re_node_set_init_empty (dfa->edests + dfa->nodes_len); +--- origsrc/sed-4.2.2/lib/regex_internal.h 2012-12-22 14:21:52.000000000 +0100 ++++ src/sed-4.2.2/lib/regex_internal.h 2013-06-27 18:05:27.230447242 +0200 +@@ -1,22 +1,21 @@ +-/* -*- buffer-read-only: t -*- vi: set ro: */ +-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ + /* Extended regular expression matching and search library. +- Copyright (C) 2002-2012 Free Software Foundation, Inc. ++ Copyright (C) 2002-2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Isamu Hasegawa . + +- This program is free software; you can redistribute it and/or modify +- it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 3, or (at your option) +- any later version. ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. + +- This program is distributed in the hope that it will be useful, ++ The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, see . */ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ + + #ifndef _REGEX_INTERNAL_H + #define _REGEX_INTERNAL_H 1 +@@ -28,21 +27,54 @@ + #include + + #include +-#ifndef _LIBC +-# include "localcharset.h" +-#endif + #include + #include + #include + #include + #include +-#if defined _LIBC ++ ++#ifdef _LIBC + # include ++# define lock_define(name) __libc_lock_define (, name) ++# define lock_init(lock) (__libc_lock_init (lock), 0) ++# define lock_fini(lock) 0 ++# define lock_lock(lock) __libc_lock_lock (lock) ++# define lock_unlock(lock) __libc_lock_unlock (lock) ++#elif defined GNULIB_LOCK ++# include "glthread/lock.h" ++ /* Use gl_lock_define if empty macro arguments are known to work. ++ Otherwise, fall back on less-portable substitutes. */ ++# if ((defined __GNUC__ && !defined __STRICT_ANSI__) \ ++ || (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__)) ++# define lock_define(name) gl_lock_define (, name) ++# elif USE_POSIX_THREADS ++# define lock_define(name) pthread_mutex_t name; ++# elif USE_PTH_THREADS ++# define lock_define(name) pth_mutex_t name; ++# elif USE_SOLARIS_THREADS ++# define lock_define(name) mutex_t name; ++# elif USE_WINDOWS_THREADS ++# define lock_define(name) gl_lock_t name; ++# else ++# define lock_define(name) ++# endif ++# define lock_init(lock) glthread_lock_init (&(lock)) ++# define lock_fini(lock) glthread_lock_destroy (&(lock)) ++# define lock_lock(lock) glthread_lock_lock (&(lock)) ++# define lock_unlock(lock) glthread_lock_unlock (&(lock)) ++#elif defined GNULIB_PTHREAD ++# include ++# define lock_define(name) pthread_mutex_t name; ++# define lock_init(lock) pthread_mutex_init (&(lock), 0) ++# define lock_fini(lock) pthread_mutex_destroy (&(lock)) ++# define lock_lock(lock) pthread_mutex_lock (&(lock)) ++# define lock_unlock(lock) pthread_mutex_unlock (&(lock)) + #else +-# define __libc_lock_define(CLASS,NAME) +-# define __libc_lock_init(NAME) do { } while (0) +-# define __libc_lock_lock(NAME) do { } while (0) +-# define __libc_lock_unlock(NAME) do { } while (0) ++# define lock_define(name) ++# define lock_init(lock) 0 ++# define lock_fini(lock) 0 ++# define lock_lock(lock) ((void) 0) ++# define lock_unlock(lock) ((void) 0) + #endif + + /* In case that the system doesn't have isblank(). */ +@@ -65,7 +97,7 @@ + # ifdef _LIBC + # undef gettext + # define gettext(msgid) \ +- INTUSE(__dcgettext) (_libc_intl_domainname, msgid, LC_MESSAGES) ++ __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES) + # endif + #else + # define gettext(msgid) (msgid) +@@ -101,6 +133,8 @@ + + /* Rename to standard API for using out of glibc. */ + #ifndef _LIBC ++# undef __wctype ++# undef __iswctype + # define __wctype wctype + # define __iswctype iswctype + # define __btowc btowc +@@ -110,10 +144,8 @@ + # define attribute_hidden + #endif /* not _LIBC */ + +-#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) +-# define __attribute(arg) __attribute__ (arg) +-#else +-# define __attribute(arg) ++#if __GNUC__ < 3 + (__GNUC_MINOR__ < 1) ++# define __attribute__(arg) + #endif + + typedef __re_idx_t Idx; +@@ -429,7 +461,7 @@ static void build_upper_buffer (re_strin + static void re_string_translate_buffer (re_string_t *pstr) internal_function; + static unsigned int re_string_context_at (const re_string_t *input, Idx idx, + int eflags) +- internal_function __attribute ((pure)); ++ internal_function __attribute__ ((pure)); + #endif + #define re_string_peek_byte(pstr, offset) \ + ((pstr)->mbs[(pstr)->cur_idx + offset]) +@@ -448,7 +480,9 @@ static unsigned int re_string_context_at + #define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx)) + #define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx)) + +-#include ++#if defined _LIBC || HAVE_ALLOCA ++# include ++#endif + + #ifndef _LIBC + # if HAVE_ALLOCA +@@ -465,6 +499,12 @@ static unsigned int re_string_context_at + # endif + #endif + ++#ifdef _LIBC ++# define MALLOC_0_IS_NONNULL 1 ++#elif !defined MALLOC_0_IS_NONNULL ++# define MALLOC_0_IS_NONNULL 0 ++#endif ++ + #ifndef MAX + # define MAX(a,b) ((a) < (b) ? (b) : (a)) + #endif +@@ -695,7 +735,7 @@ struct re_dfa_t + #ifdef DEBUG + char* re_str; + #endif +- __libc_lock_define (, lock) ++ lock_define (lock) + }; + + #define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set)) +@@ -767,7 +807,7 @@ bitset_copy (bitset_t dest, const bitset + memcpy (dest, src, sizeof (bitset_t)); + } + +-static void ++static void __attribute__ ((unused)) + bitset_not (bitset_t set) + { + int bitset_i; +@@ -779,7 +819,7 @@ bitset_not (bitset_t set) + & ~set[BITSET_WORDS - 1]); + } + +-static void ++static void __attribute__ ((unused)) + bitset_merge (bitset_t dest, const bitset_t src) + { + int bitset_i; +@@ -787,7 +827,7 @@ bitset_merge (bitset_t dest, const bitse + dest[bitset_i] |= src[bitset_i]; + } + +-static void ++static void __attribute__ ((unused)) + bitset_mask (bitset_t dest, const bitset_t src) + { + int bitset_i; +@@ -798,7 +838,7 @@ bitset_mask (bitset_t dest, const bitset + #ifdef RE_ENABLE_I18N + /* Functions for re_string. */ + static int +-internal_function __attribute ((pure)) ++internal_function __attribute__ ((pure, unused)) + re_string_char_size_at (const re_string_t *pstr, Idx idx) + { + int byte_idx; +@@ -811,7 +851,7 @@ re_string_char_size_at (const re_string_ + } + + static wint_t +-internal_function __attribute ((pure)) ++internal_function __attribute__ ((pure, unused)) + re_string_wchar_at (const re_string_t *pstr, Idx idx) + { + if (pstr->mb_cur_max == 1) +@@ -821,7 +861,7 @@ re_string_wchar_at (const re_string_t *p + + # ifndef NOT_IN_libc + static int +-internal_function __attribute ((pure)) ++internal_function __attribute__ ((pure, unused)) + re_string_elem_size_at (const re_string_t *pstr, Idx idx) + { + # ifdef _LIBC +--- origsrc/sed-4.2.2/lib/regexec.c 2012-12-22 14:21:52.000000000 +0100 ++++ src/sed-4.2.2/lib/regexec.c 2013-06-27 18:05:27.268447078 +0200 +@@ -1,22 +1,21 @@ +-/* -*- buffer-read-only: t -*- vi: set ro: */ +-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ + /* Extended regular expression matching and search library. +- Copyright (C) 2002-2012 Free Software Foundation, Inc. ++ Copyright (C) 2002-2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Isamu Hasegawa . + +- This program is free software; you can redistribute it and/or modify +- it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 3, or (at your option) +- any later version. ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. + +- This program is distributed in the hope that it will be useful, ++ The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, see . */ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ + + static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags, + Idx n) internal_function; +@@ -200,7 +199,7 @@ static Idx group_nodes_into_DFAstates (c + static bool check_node_accept (const re_match_context_t *mctx, + const re_token_t *node, Idx idx) + internal_function; +-static reg_errcode_t extend_buffers (re_match_context_t *mctx) ++static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len) + internal_function; + + /* Entry point for POSIX code. */ +@@ -229,9 +228,7 @@ regexec (preg, string, nmatch, pmatch, e + { + reg_errcode_t err; + Idx start, length; +-#ifdef _LIBC + re_dfa_t *dfa = preg->buffer; +-#endif + + if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND)) + return REG_BADPAT; +@@ -247,14 +244,14 @@ regexec (preg, string, nmatch, pmatch, e + length = strlen (string); + } + +- __libc_lock_lock (dfa->lock); ++ lock_lock (dfa->lock); + if (preg->no_sub) + err = re_search_internal (preg, string, length, start, length, + length, 0, NULL, eflags); + else + err = re_search_internal (preg, string, length, start, length, + length, nmatch, pmatch, eflags); +- __libc_lock_unlock (dfa->lock); ++ lock_unlock (dfa->lock); + return err != REG_NOERROR; + } + +@@ -422,9 +419,7 @@ re_search_stub (struct re_pattern_buffer + Idx nregs; + regoff_t rval; + int eflags = 0; +-#ifdef _LIBC + re_dfa_t *dfa = bufp->buffer; +-#endif + Idx last_start = start + range; + + /* Check for out-of-range. */ +@@ -435,7 +430,7 @@ re_search_stub (struct re_pattern_buffer + else if (BE (last_start < 0 || (range < 0 && start <= last_start), 0)) + last_start = 0; + +- __libc_lock_lock (dfa->lock); ++ lock_lock (dfa->lock); + + eflags |= (bufp->not_bol) ? REG_NOTBOL : 0; + eflags |= (bufp->not_eol) ? REG_NOTEOL : 0; +@@ -499,7 +494,7 @@ re_search_stub (struct re_pattern_buffer + } + re_free (pmatch); + out: +- __libc_lock_unlock (dfa->lock); ++ lock_unlock (dfa->lock); + return rval; + } + +@@ -1065,7 +1060,7 @@ prune_impossible_nodes (re_match_context + since initial states may have constraints like "\<", "^", etc.. */ + + static inline re_dfastate_t * +-__attribute ((always_inline)) internal_function ++__attribute__ ((always_inline)) internal_function + acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx, + Idx idx) + { +@@ -1177,7 +1172,7 @@ check_matching (re_match_context_t *mctx + || (BE (next_char_idx >= mctx->input.valid_len, 0) + && mctx->input.valid_len < mctx->input.len)) + { +- err = extend_buffers (mctx); ++ err = extend_buffers (mctx, next_char_idx + 1); + if (BE (err != REG_NOERROR, 0)) + { + assert (err == REG_ESPACE); +@@ -1757,7 +1752,7 @@ clean_state_log_if_needed (re_match_cont + && mctx->input.valid_len < mctx->input.len)) + { + reg_errcode_t err; +- err = extend_buffers (mctx); ++ err = extend_buffers (mctx, next_state_log_idx + 1); + if (BE (err != REG_NOERROR, 0)) + return err; + } +@@ -2814,7 +2809,7 @@ get_subexp (re_match_context_t *mctx, Id + if (bkref_str_off >= mctx->input.len) + break; + +- err = extend_buffers (mctx); ++ err = extend_buffers (mctx, bkref_str_off + 1); + if (BE (err != REG_NOERROR, 0)) + return err; + +@@ -3937,6 +3932,7 @@ check_node_accept_bytes (const re_dfa_t + in_collseq = find_collation_sequence_value (pin, elem_len); + } + /* match with range expression? */ ++ /* FIXME: Implement rational ranges here, too. */ + for (i = 0; i < cset->nranges; ++i) + if (cset->range_starts[i] <= in_collseq + && in_collseq <= cset->range_ends[i]) +@@ -3988,18 +3984,9 @@ check_node_accept_bytes (const re_dfa_t + # endif /* _LIBC */ + { + /* match with range expression? */ +-#if __GNUC__ >= 2 && ! (__STDC_VERSION__ < 199901L && defined __STRICT_ANSI__) +- wchar_t cmp_buf[] = {L'\0', L'\0', wc, L'\0', L'\0', L'\0'}; +-#else +- wchar_t cmp_buf[] = {L'\0', L'\0', L'\0', L'\0', L'\0', L'\0'}; +- cmp_buf[2] = wc; +-#endif + for (i = 0; i < cset->nranges; ++i) + { +- cmp_buf[0] = cset->range_starts[i]; +- cmp_buf[4] = cset->range_ends[i]; +- if (wcscoll (cmp_buf, cmp_buf + 2) <= 0 +- && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0) ++ if (cset->range_starts[i] <= wc && wc <= cset->range_ends[i]) + { + match_len = char_len; + goto check_node_accept_bytes_match; +@@ -4137,7 +4124,7 @@ check_node_accept (const re_match_contex + + static reg_errcode_t + internal_function __attribute_warn_unused_result__ +-extend_buffers (re_match_context_t *mctx) ++extend_buffers (re_match_context_t *mctx, int min_len) + { + reg_errcode_t ret; + re_string_t *pstr = &mctx->input; +@@ -4147,8 +4134,10 @@ extend_buffers (re_match_context_t *mctx + <= pstr->bufs_len, 0)) + return REG_ESPACE; + +- /* Double the lengths of the buffers. */ +- ret = re_string_realloc_buffers (pstr, MIN (pstr->len, pstr->bufs_len * 2)); ++ /* Double the lengths of the buffers, but allocate at least MIN_LEN. */ ++ ret = re_string_realloc_buffers (pstr, ++ MAX (min_len, ++ MIN (pstr->len, pstr->bufs_len * 2))); + if (BE (ret != REG_NOERROR, 0)) + return ret; + +--- origsrc/sed-4.2.2/sed/sed.c 2012-03-16 10:13:31.000000000 +0100 ++++ src/sed-4.2.2/sed/sed.c 2013-06-27 18:06:25.592195456 +0200 +@@ -57,7 +57,11 @@ bool follow_symlinks = false; + char *in_place_extension = NULL; + + /* The mode to use to read/write files, either "r"/"w" or "rb"/"wb". */ ++#ifdef HAVE_FOPEN_RT ++char *read_mode = "rt"; ++#else + char *read_mode = "r"; ++#endif + char *write_mode = "w"; + + /* Do we need to be pedantically POSIX compliant? */ diff --git a/dev/build/windows/patches_coq/sed-4.2.2.patch b/dev/build/windows/patches_coq/sed-4.2.2.patch new file mode 100755 index 00000000..c7ccd53c --- /dev/null +++ b/dev/build/windows/patches_coq/sed-4.2.2.patch @@ -0,0 +1,1301 @@ +--- origsrc/doc/sed.1 2012-12-22 15:27:13.000000000 +0100 ++++ src/doc/sed.1 2013-06-27 18:10:47.974060492 +0200 +@@ -1,5 +1,5 @@ + .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.28. +-.TH SED "1" "December 2012" "sed 4.2.2" "User Commands" ++.TH SED "1" "June 2013" "sed 4.2.2" "User Commands" + .SH NAME + sed \- stream editor for filtering and transforming text + .SH SYNOPSIS +@@ -40,6 +40,10 @@ follow symlinks when processing in place + .IP + edit files in place (makes backup if SUFFIX supplied) + .HP ++\fB\-b\fR, \fB\-\-binary\fR ++.IP ++open files in binary mode (CR+LFs are not processed specially) ++.HP + \fB\-l\fR N, \fB\-\-line\-length\fR=\fIN\fR + .IP + specify the desired line-wrap length for the `l' command +--- origsrc/lib/regcomp.c 2012-12-22 14:21:52.000000000 +0100 ++++ src/lib/regcomp.c 2013-06-27 18:05:27.044448044 +0200 +@@ -1,22 +1,21 @@ +-/* -*- buffer-read-only: t -*- vi: set ro: */ +-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ + /* Extended regular expression matching and search library. +- Copyright (C) 2002-2012 Free Software Foundation, Inc. ++ Copyright (C) 2002-2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Isamu Hasegawa . + +- This program is free software; you can redistribute it and/or modify +- it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 3, or (at your option) +- any later version. ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. + +- This program is distributed in the hope that it will be useful, ++ The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, see . */ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ + + static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern, + size_t length, reg_syntax_t syntax); +@@ -95,20 +94,20 @@ static reg_errcode_t build_charclass (RE + bitset_t sbcset, + re_charset_t *mbcset, + Idx *char_class_alloc, +- const unsigned char *class_name, ++ const char *class_name, + reg_syntax_t syntax); + #else /* not RE_ENABLE_I18N */ + static reg_errcode_t build_equiv_class (bitset_t sbcset, + const unsigned char *name); + static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans, + bitset_t sbcset, +- const unsigned char *class_name, ++ const char *class_name, + reg_syntax_t syntax); + #endif /* not RE_ENABLE_I18N */ + static bin_tree_t *build_charclass_op (re_dfa_t *dfa, + RE_TRANSLATE_TYPE trans, +- const unsigned char *class_name, +- const unsigned char *extra, ++ const char *class_name, ++ const char *extra, + bool non_match, reg_errcode_t *err); + static bin_tree_t *create_tree (re_dfa_t *dfa, + bin_tree_t *left, bin_tree_t *right, +@@ -293,7 +292,7 @@ weak_alias (__re_compile_fastmap, re_com + #endif + + static inline void +-__attribute ((always_inline)) ++__attribute__ ((always_inline)) + re_set_fastmap (char *fastmap, bool icase, int ch) + { + fastmap[ch] = 1; +@@ -587,7 +586,7 @@ weak_alias (__regerror, regerror) + static const bitset_t utf8_sb_map = + { + /* Set the first 128 bits. */ +-# ifdef __GNUC__ ++# if defined __GNUC__ && !defined __STRICT_ANSI__ + [0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX + # else + # if 4 * BITSET_WORD_BITS < ASCII_CHARS +@@ -664,7 +663,10 @@ regfree (preg) + { + re_dfa_t *dfa = preg->buffer; + if (BE (dfa != NULL, 1)) +- free_dfa_content (dfa); ++ { ++ lock_fini (dfa->lock); ++ free_dfa_content (dfa); ++ } + preg->buffer = NULL; + preg->allocated = 0; + +@@ -785,6 +787,8 @@ re_compile_internal (regex_t *preg, cons + preg->used = sizeof (re_dfa_t); + + err = init_dfa (dfa, length); ++ if (BE (err == REG_NOERROR && lock_init (dfa->lock) != 0, 0)) ++ err = REG_ESPACE; + if (BE (err != REG_NOERROR, 0)) + { + free_dfa_content (dfa); +@@ -798,8 +802,6 @@ re_compile_internal (regex_t *preg, cons + strncpy (dfa->re_str, pattern, length + 1); + #endif + +- __libc_lock_init (dfa->lock); +- + err = re_string_construct (®exp, pattern, length, preg->translate, + (syntax & RE_ICASE) != 0, dfa); + if (BE (err != REG_NOERROR, 0)) +@@ -807,6 +809,7 @@ re_compile_internal (regex_t *preg, cons + re_compile_internal_free_return: + free_workarea_compile (preg); + re_string_destruct (®exp); ++ lock_fini (dfa->lock); + free_dfa_content (dfa); + preg->buffer = NULL; + preg->allocated = 0; +@@ -839,6 +842,7 @@ re_compile_internal (regex_t *preg, cons + + if (BE (err != REG_NOERROR, 0)) + { ++ lock_fini (dfa->lock); + free_dfa_content (dfa); + preg->buffer = NULL; + preg->allocated = 0; +@@ -954,10 +958,10 @@ static void + internal_function + init_word_char (re_dfa_t *dfa) + { +- dfa->word_ops_used = 1; + int i = 0; + int j; + int ch = 0; ++ dfa->word_ops_used = 1; + if (BE (dfa->map_notascii == 0, 1)) + { + bitset_word_t bits0 = 0x00000000; +@@ -2423,8 +2427,8 @@ parse_expression (re_string_t *regexp, r + case OP_WORD: + case OP_NOTWORD: + tree = build_charclass_op (dfa, regexp->trans, +- (const unsigned char *) "alnum", +- (const unsigned char *) "_", ++ "alnum", ++ "_", + token->type == OP_NOTWORD, err); + if (BE (*err != REG_NOERROR && tree == NULL, 0)) + return NULL; +@@ -2432,8 +2436,8 @@ parse_expression (re_string_t *regexp, r + case OP_SPACE: + case OP_NOTSPACE: + tree = build_charclass_op (dfa, regexp->trans, +- (const unsigned char *) "space", +- (const unsigned char *) "", ++ "space", ++ "", + token->type == OP_NOTSPACE, err); + if (BE (*err != REG_NOERROR && tree == NULL, 0)) + return NULL; +@@ -2713,7 +2717,6 @@ build_range_exp (const reg_syntax_t synt + wchar_t wc; + wint_t start_wc; + wint_t end_wc; +- wchar_t cmp_buf[6] = {L'\0', L'\0', L'\0', L'\0', L'\0', L'\0'}; + + start_ch = ((start_elem->type == SB_CHAR) ? start_elem->opr.ch + : ((start_elem->type == COLL_SYM) ? start_elem->opr.name[0] +@@ -2727,11 +2730,7 @@ build_range_exp (const reg_syntax_t synt + ? __btowc (end_ch) : end_elem->opr.wch); + if (start_wc == WEOF || end_wc == WEOF) + return REG_ECOLLATE; +- cmp_buf[0] = start_wc; +- cmp_buf[4] = end_wc; +- +- if (BE ((syntax & RE_NO_EMPTY_RANGES) +- && wcscoll (cmp_buf, cmp_buf + 4) > 0, 0)) ++ else if (BE ((syntax & RE_NO_EMPTY_RANGES) && start_wc > end_wc, 0)) + return REG_ERANGE; + + /* Got valid collation sequence values, add them as a new entry. +@@ -2772,9 +2771,7 @@ build_range_exp (const reg_syntax_t synt + /* Build the table for single byte characters. */ + for (wc = 0; wc < SBC_MAX; ++wc) + { +- cmp_buf[2] = wc; +- if (wcscoll (cmp_buf, cmp_buf + 2) <= 0 +- && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0) ++ if (start_wc <= wc && wc <= end_wc) + bitset_set (sbcset, wc); + } + } +@@ -2843,40 +2840,29 @@ parse_bracket_exp (re_string_t *regexp, + + /* Local function for parse_bracket_exp used in _LIBC environment. + Seek the collating symbol entry corresponding to NAME. +- Return the index of the symbol in the SYMB_TABLE. */ ++ Return the index of the symbol in the SYMB_TABLE, ++ or -1 if not found. */ + + auto inline int32_t +- __attribute ((always_inline)) +- seek_collating_symbol_entry (name, name_len) +- const unsigned char *name; +- size_t name_len; +- { +- int32_t hash = elem_hash ((const char *) name, name_len); +- int32_t elem = hash % table_size; +- if (symb_table[2 * elem] != 0) +- { +- int32_t second = hash % (table_size - 2) + 1; +- +- do +- { +- /* First compare the hashing value. */ +- if (symb_table[2 * elem] == hash +- /* Compare the length of the name. */ +- && name_len == extra[symb_table[2 * elem + 1]] +- /* Compare the name. */ +- && memcmp (name, &extra[symb_table[2 * elem + 1] + 1], +- name_len) == 0) +- { +- /* Yep, this is the entry. */ +- break; +- } ++ __attribute__ ((always_inline)) ++ seek_collating_symbol_entry (const unsigned char *name, size_t name_len) ++ { ++ int32_t elem; + +- /* Next entry. */ +- elem += second; +- } +- while (symb_table[2 * elem] != 0); +- } +- return elem; ++ for (elem = 0; elem < table_size; elem++) ++ if (symb_table[2 * elem] != 0) ++ { ++ int32_t idx = symb_table[2 * elem + 1]; ++ /* Skip the name of collating element name. */ ++ idx += 1 + extra[idx]; ++ if (/* Compare the length of the name. */ ++ name_len == extra[idx] ++ /* Compare the name. */ ++ && memcmp (name, &extra[idx + 1], name_len) == 0) ++ /* Yep, this is the entry. */ ++ return elem; ++ } ++ return -1; + } + + /* Local function for parse_bracket_exp used in _LIBC environment. +@@ -2884,9 +2870,8 @@ parse_bracket_exp (re_string_t *regexp, + Return the value if succeeded, UINT_MAX otherwise. */ + + auto inline unsigned int +- __attribute ((always_inline)) +- lookup_collation_sequence_value (br_elem) +- bracket_elem_t *br_elem; ++ __attribute__ ((always_inline)) ++ lookup_collation_sequence_value (bracket_elem_t *br_elem) + { + if (br_elem->type == SB_CHAR) + { +@@ -2914,7 +2899,7 @@ parse_bracket_exp (re_string_t *regexp, + int32_t elem, idx; + elem = seek_collating_symbol_entry (br_elem->opr.name, + sym_name_len); +- if (symb_table[2 * elem] != 0) ++ if (elem != -1) + { + /* We found the entry. */ + idx = symb_table[2 * elem + 1]; +@@ -2932,7 +2917,7 @@ parse_bracket_exp (re_string_t *regexp, + /* Return the collation sequence value. */ + return *(unsigned int *) (extra + idx); + } +- else if (symb_table[2 * elem] == 0 && sym_name_len == 1) ++ else if (sym_name_len == 1) + { + /* No valid character. Match it as a single byte + character. */ +@@ -2953,12 +2938,9 @@ parse_bracket_exp (re_string_t *regexp, + update it. */ + + auto inline reg_errcode_t +- __attribute ((always_inline)) +- build_range_exp (sbcset, mbcset, range_alloc, start_elem, end_elem) +- re_charset_t *mbcset; +- Idx *range_alloc; +- bitset_t sbcset; +- bracket_elem_t *start_elem, *end_elem; ++ __attribute__ ((always_inline)) ++ build_range_exp (bitset_t sbcset, re_charset_t *mbcset, int *range_alloc, ++ bracket_elem_t *start_elem, bracket_elem_t *end_elem) + { + unsigned int ch; + uint32_t start_collseq; +@@ -2971,6 +2953,7 @@ parse_bracket_exp (re_string_t *regexp, + 0)) + return REG_ERANGE; + ++ /* FIXME: Implement rational ranges here, too. */ + start_collseq = lookup_collation_sequence_value (start_elem); + end_collseq = lookup_collation_sequence_value (end_elem); + /* Check start/end collation sequence values. */ +@@ -3036,26 +3019,23 @@ parse_bracket_exp (re_string_t *regexp, + pointer argument since we may update it. */ + + auto inline reg_errcode_t +- __attribute ((always_inline)) +- build_collating_symbol (sbcset, mbcset, coll_sym_alloc, name) +- re_charset_t *mbcset; +- Idx *coll_sym_alloc; +- bitset_t sbcset; +- const unsigned char *name; ++ __attribute__ ((always_inline)) ++ build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset, ++ Idx *coll_sym_alloc, const unsigned char *name) + { + int32_t elem, idx; + size_t name_len = strlen ((const char *) name); + if (nrules != 0) + { + elem = seek_collating_symbol_entry (name, name_len); +- if (symb_table[2 * elem] != 0) ++ if (elem != -1) + { + /* We found the entry. */ + idx = symb_table[2 * elem + 1]; + /* Skip the name of collating element name. */ + idx += 1 + extra[idx]; + } +- else if (symb_table[2 * elem] == 0 && name_len == 1) ++ else if (name_len == 1) + { + /* No valid character, treat it as a normal + character. */ +@@ -3298,7 +3278,8 @@ parse_bracket_exp (re_string_t *regexp, + #ifdef RE_ENABLE_I18N + mbcset, &char_class_alloc, + #endif /* RE_ENABLE_I18N */ +- start_elem.opr.name, syntax); ++ (const char *) start_elem.opr.name, ++ syntax); + if (BE (*err != REG_NOERROR, 0)) + goto parse_bracket_exp_free_return; + break; +@@ -3578,14 +3559,14 @@ static reg_errcode_t + #ifdef RE_ENABLE_I18N + build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset, + re_charset_t *mbcset, Idx *char_class_alloc, +- const unsigned char *class_name, reg_syntax_t syntax) ++ const char *class_name, reg_syntax_t syntax) + #else /* not RE_ENABLE_I18N */ + build_charclass (RE_TRANSLATE_TYPE trans, bitset_t sbcset, +- const unsigned char *class_name, reg_syntax_t syntax) ++ const char *class_name, reg_syntax_t syntax) + #endif /* not RE_ENABLE_I18N */ + { + int i; +- const char *name = (const char *) class_name; ++ const char *name = class_name; + + /* In case of REG_ICASE "upper" and "lower" match the both of + upper and lower cases. */ +@@ -3659,8 +3640,8 @@ build_charclass (RE_TRANSLATE_TYPE trans + + static bin_tree_t * + build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, +- const unsigned char *class_name, +- const unsigned char *extra, bool non_match, ++ const char *class_name, ++ const char *extra, bool non_match, + reg_errcode_t *err) + { + re_bitset_ptr_t sbcset; +--- origsrc/lib/regex-quote.c 1970-01-01 01:00:00.000000000 +0100 ++++ src/lib/regex-quote.c 2013-06-27 18:05:27.081447884 +0200 +@@ -0,0 +1,216 @@ ++/* Construct a regular expression from a literal string. ++ Copyright (C) 1995, 2010-2013 Free Software Foundation, Inc. ++ Written by Bruno Haible , 2010. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#include ++ ++/* Specification. */ ++#include "regex-quote.h" ++ ++#include ++ ++#include "mbuiter.h" ++#include "xalloc.h" ++ ++/* Characters that are special in a BRE. */ ++static const char bre_special[] = "$^.*[]\\"; ++ ++/* Characters that are special in an ERE. */ ++static const char ere_special[] = "$^.*[]\\+?{}()|"; ++ ++struct regex_quote_spec ++regex_quote_spec_posix (int cflags, bool anchored) ++{ ++ struct regex_quote_spec result; ++ ++ strcpy (result.special, cflags != 0 ? ere_special : bre_special); ++ result.multibyte = true; ++ result.anchored = anchored; ++ ++ return result; ++} ++ ++/* Syntax bit values, defined in GNU . We don't include it here, ++ otherwise this module would need to depend on gnulib module 'regex'. */ ++#define RE_BK_PLUS_QM 0x00000002 ++#define RE_INTERVALS 0x00000200 ++#define RE_LIMITED_OPS 0x00000400 ++#define RE_NEWLINE_ALT 0x00000800 ++#define RE_NO_BK_BRACES 0x00001000 ++#define RE_NO_BK_PARENS 0x00002000 ++#define RE_NO_BK_VBAR 0x00008000 ++ ++struct regex_quote_spec ++regex_quote_spec_gnu (unsigned long /*reg_syntax_t*/ syntax, bool anchored) ++{ ++ struct regex_quote_spec result; ++ char *p; ++ ++ p = result.special; ++ memcpy (p, bre_special, sizeof (bre_special) - 1); ++ p += sizeof (bre_special) - 1; ++ if ((syntax & RE_LIMITED_OPS) == 0 && (syntax & RE_BK_PLUS_QM) == 0) ++ { ++ *p++ = '+'; ++ *p++ = '?'; ++ } ++ if ((syntax & RE_INTERVALS) != 0 && (syntax & RE_NO_BK_BRACES) != 0) ++ { ++ *p++ = '{'; ++ *p++ = '}'; ++ } ++ if ((syntax & RE_NO_BK_PARENS) != 0) ++ { ++ *p++ = '('; ++ *p++ = ')'; ++ } ++ if ((syntax & RE_LIMITED_OPS) == 0 && (syntax & RE_NO_BK_VBAR) != 0) ++ *p++ = '|'; ++ if ((syntax & RE_NEWLINE_ALT) != 0) ++ *p++ = '\n'; ++ *p = '\0'; ++ ++ result.multibyte = true; ++ result.anchored = anchored; ++ ++ return result; ++} ++ ++/* Characters that are special in a PCRE. */ ++static const char pcre_special[] = "$^.*[]\\+?{}()|"; ++ ++/* Options bit values, defined in . We don't include it here, because ++ it is not a standard header. */ ++#define PCRE_ANCHORED 0x00000010 ++#define PCRE_EXTENDED 0x00000008 ++ ++struct regex_quote_spec ++regex_quote_spec_pcre (int options, bool anchored) ++{ ++ struct regex_quote_spec result; ++ char *p; ++ ++ p = result.special; ++ memcpy (p, bre_special, sizeof (pcre_special) - 1); ++ p += sizeof (pcre_special) - 1; ++ if (options & PCRE_EXTENDED) ++ { ++ *p++ = ' '; ++ *p++ = '\t'; ++ *p++ = '\n'; ++ *p++ = '\v'; ++ *p++ = '\f'; ++ *p++ = '\r'; ++ *p++ = '#'; ++ } ++ *p = '\0'; ++ ++ /* PCRE regular expressions consist of UTF-8 characters of options contains ++ PCRE_UTF8 and of single bytes otherwise. */ ++ result.multibyte = false; ++ /* If options contains PCRE_ANCHORED, the anchoring is implicit. */ ++ result.anchored = (options & PCRE_ANCHORED ? 0 : anchored); ++ ++ return result; ++} ++ ++size_t ++regex_quote_length (const char *string, const struct regex_quote_spec *spec) ++{ ++ const char *special = spec->special; ++ size_t length; ++ ++ length = 0; ++ if (spec->anchored) ++ length += 2; /* for '^' at the beginning and '$' at the end */ ++ if (spec->multibyte) ++ { ++ mbui_iterator_t iter; ++ ++ for (mbui_init (iter, string); mbui_avail (iter); mbui_advance (iter)) ++ { ++ /* We know that special contains only ASCII characters. */ ++ if (mb_len (mbui_cur (iter)) == 1 ++ && strchr (special, * mbui_cur_ptr (iter))) ++ length += 1; ++ length += mb_len (mbui_cur (iter)); ++ } ++ } ++ else ++ { ++ const char *iter; ++ ++ for (iter = string; *iter != '\0'; iter++) ++ { ++ if (strchr (special, *iter)) ++ length += 1; ++ length += 1; ++ } ++ } ++ ++ return length; ++} ++ ++char * ++regex_quote_copy (char *p, const char *string, const struct regex_quote_spec *spec) ++{ ++ const char *special = spec->special; ++ ++ if (spec->anchored) ++ *p++ = '^'; ++ if (spec->multibyte) ++ { ++ mbui_iterator_t iter; ++ ++ for (mbui_init (iter, string); mbui_avail (iter); mbui_advance (iter)) ++ { ++ /* We know that special contains only ASCII characters. */ ++ if (mb_len (mbui_cur (iter)) == 1 ++ && strchr (special, * mbui_cur_ptr (iter))) ++ *p++ = '\\'; ++ memcpy (p, mbui_cur_ptr (iter), mb_len (mbui_cur (iter))); ++ p += mb_len (mbui_cur (iter)); ++ } ++ } ++ else ++ { ++ const char *iter; ++ ++ for (iter = string; *iter != '\0'; iter++) ++ { ++ if (strchr (special, *iter)) ++ *p++ = '\\'; ++ *p++ = *iter++; ++ } ++ } ++ if (spec->anchored) ++ *p++ = '$'; ++ ++ return p; ++} ++ ++char * ++regex_quote (const char *string, const struct regex_quote_spec *spec) ++{ ++ size_t length = regex_quote_length (string, spec); ++ char *result = XNMALLOC (length + 1, char); ++ char *p; ++ ++ p = result; ++ p = regex_quote_copy (p, string, spec); ++ *p = '\0'; ++ return result; ++} +--- origsrc/lib/regex-quote.h 1970-01-01 01:00:00.000000000 +0100 ++++ src/lib/regex-quote.h 2013-06-27 18:05:27.112447751 +0200 +@@ -0,0 +1,88 @@ ++/* Construct a regular expression from a literal string. ++ Copyright (C) 1995, 2010-2013 Free Software Foundation, Inc. ++ Written by Bruno Haible , 2010. ++ ++ This program is free software: you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 3 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program. If not, see . */ ++ ++#ifndef _REGEX_QUOTE_H ++#define _REGEX_QUOTE_H ++ ++#include ++#include ++ ++ ++/* Specifies a quotation task for converting a fixed string to a regular ++ expression pattern. */ ++struct regex_quote_spec ++{ ++ /* True if the regular expression pattern consists of multibyte characters ++ (in the encoding given by the LC_CTYPE category of the locale), ++ false if it consists of single bytes or UTF-8 characters. */ ++ unsigned int /*bool*/ multibyte : 1; ++ /* True if the regular expression pattern shall match only entire lines. */ ++ unsigned int /*bool*/ anchored : 1; ++ /* Set of characters that need to be escaped (all ASCII), as a ++ NUL-terminated string. */ ++ char special[30 + 1]; ++}; ++ ++ ++/* Creates a quotation task that produces a POSIX regular expression, that is, ++ a pattern that can be compiled with regcomp(). ++ CFLAGS can be 0 or REG_EXTENDED. ++ If it is 0, the result is a Basic Regular Expression (BRE) ++ . ++ If it is REG_EXTENDED, the result is an Extended Regular Expression (ERE) ++ . ++ If ANCHORED is false, the regular expression will match substrings of lines. ++ If ANCHORED is true, it will match only complete lines, */ ++extern struct regex_quote_spec ++ regex_quote_spec_posix (int cflags, bool anchored); ++ ++/* Creates a quotation task that produces a regular expression that can be ++ compiled with the GNU API function re_compile_pattern(). ++ SYNTAX describes the syntax of the regular expression (such as ++ RE_SYNTAX_POSIX_BASIC, RE_SYNTAX_POSIX_EXTENDED, RE_SYNTAX_EMACS, all ++ defined in ). It must be the same value as 're_syntax_options' ++ at the moment of the re_compile_pattern() call. ++ If ANCHORED is false, the regular expression will match substrings of lines. ++ If ANCHORED is true, it will match only complete lines, */ ++extern struct regex_quote_spec ++ regex_quote_spec_gnu (unsigned long /*reg_syntax_t*/ syntax, bool anchored); ++ ++/* Creates a quotation task that produces a PCRE regular expression, that is, ++ a pattern that can be compiled with pcre_compile(). ++ OPTIONS is the same value as the second argument passed to pcre_compile(). ++ If ANCHORED is false, the regular expression will match substrings of lines. ++ If ANCHORED is true, it will match only complete lines, */ ++extern struct regex_quote_spec ++ regex_quote_spec_pcre (int options, bool anchored); ++ ++ ++/* Returns the number of bytes needed for the quoted string. */ ++extern size_t ++ regex_quote_length (const char *string, const struct regex_quote_spec *spec); ++ ++/* Copies the quoted string to p and returns the incremented p. ++ There must be room for regex_quote_length (string, spec) + 1 bytes at p. */ ++extern char * ++ regex_quote_copy (char *p, ++ const char *string, const struct regex_quote_spec *spec); ++ ++/* Returns the freshly allocated quoted string. */ ++extern char * ++ regex_quote (const char *string, const struct regex_quote_spec *spec); ++ ++ ++#endif /* _REGEX_QUOTE_H */ +--- origsrc/lib/regex.c 2012-12-22 14:21:52.000000000 +0100 ++++ src/lib/regex.c 2013-06-27 18:05:27.138447639 +0200 +@@ -1,22 +1,21 @@ +-/* -*- buffer-read-only: t -*- vi: set ro: */ +-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ + /* Extended regular expression matching and search library. +- Copyright (C) 2002-2003, 2005-2006, 2009-2012 Free Software Foundation, Inc. ++ Copyright (C) 2002-2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Isamu Hasegawa . + +- This program is free software; you can redistribute it and/or modify +- it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 3, or (at your option) +- any later version. ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. + +- This program is distributed in the hope that it will be useful, ++ The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, see . */ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ + + #ifndef _LIBC + # include +@@ -25,6 +24,7 @@ + # pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" + # endif + # if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__ ++# pragma GCC diagnostic ignored "-Wold-style-definition" + # pragma GCC diagnostic ignored "-Wtype-limits" + # endif + #endif +--- origsrc/lib/regex.h 2012-12-22 14:21:52.000000000 +0100 ++++ src/lib/regex.h 2013-06-27 18:05:27.168447509 +0200 +@@ -1,23 +1,22 @@ +-/* -*- buffer-read-only: t -*- vi: set ro: */ +-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ + /* Definitions for data structures and routines for the regular + expression library. +- Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2012 +- Free Software Foundation, Inc. ++ Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2013 Free Software ++ Foundation, Inc. + This file is part of the GNU C Library. + +- This program is free software; you can redistribute it and/or modify +- it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 3, or (at your option) +- any later version. ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. + +- This program is distributed in the hope that it will be useful, ++ The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, see . */ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ + + #ifndef _REGEX_H + #define _REGEX_H 1 +--- origsrc/lib/regex_internal.c 2012-12-22 14:21:52.000000000 +0100 ++++ src/lib/regex_internal.c 2013-06-27 18:05:27.199447375 +0200 +@@ -1,22 +1,21 @@ +-/* -*- buffer-read-only: t -*- vi: set ro: */ +-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ + /* Extended regular expression matching and search library. +- Copyright (C) 2002-2012 Free Software Foundation, Inc. ++ Copyright (C) 2002-2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Isamu Hasegawa . + +- This program is free software; you can redistribute it and/or modify +- it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 3, or (at your option) +- any later version. ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. + +- This program is distributed in the hope that it will be useful, ++ The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, see . */ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ + + static void re_string_construct_common (const char *str, Idx len, + re_string_t *pstr, +@@ -835,7 +834,7 @@ re_string_reconstruct (re_string_t *pstr + } + + static unsigned char +-internal_function __attribute ((pure)) ++internal_function __attribute__ ((pure)) + re_string_peek_byte_case (const re_string_t *pstr, Idx idx) + { + int ch; +@@ -975,7 +974,7 @@ re_node_set_alloc (re_node_set *set, Idx + set->alloc = size; + set->nelem = 0; + set->elems = re_malloc (Idx, size); +- if (BE (set->elems == NULL, 0)) ++ if (BE (set->elems == NULL, 0) && (MALLOC_0_IS_NONNULL || size != 0)) + return REG_ESPACE; + return REG_NOERROR; + } +@@ -1355,7 +1354,7 @@ re_node_set_insert_last (re_node_set *se + Return true if SET1 and SET2 are equivalent. */ + + static bool +-internal_function __attribute ((pure)) ++internal_function __attribute__ ((pure)) + re_node_set_compare (const re_node_set *set1, const re_node_set *set2) + { + Idx i; +@@ -1370,7 +1369,7 @@ re_node_set_compare (const re_node_set * + /* Return (idx + 1) if SET contains the element ELEM, return 0 otherwise. */ + + static Idx +-internal_function __attribute ((pure)) ++internal_function __attribute__ ((pure)) + re_node_set_contains (const re_node_set *set, Idx elem) + { + __re_size_t idx, right, mid; +@@ -1444,11 +1443,9 @@ re_dfa_add_node (re_dfa_t *dfa, re_token + dfa->nodes[dfa->nodes_len] = token; + dfa->nodes[dfa->nodes_len].constraint = 0; + #ifdef RE_ENABLE_I18N +- { +- int type = token.type; + dfa->nodes[dfa->nodes_len].accept_mb = +- (type == OP_PERIOD && dfa->mb_cur_max > 1) || type == COMPLEX_BRACKET; +- } ++ ((token.type == OP_PERIOD && dfa->mb_cur_max > 1) ++ || token.type == COMPLEX_BRACKET); + #endif + dfa->nexts[dfa->nodes_len] = REG_MISSING; + re_node_set_init_empty (dfa->edests + dfa->nodes_len); +--- origsrc/lib/regex_internal.h 2012-12-22 14:21:52.000000000 +0100 ++++ src/lib/regex_internal.h 2013-06-27 18:05:27.230447242 +0200 +@@ -1,22 +1,21 @@ +-/* -*- buffer-read-only: t -*- vi: set ro: */ +-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ + /* Extended regular expression matching and search library. +- Copyright (C) 2002-2012 Free Software Foundation, Inc. ++ Copyright (C) 2002-2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Isamu Hasegawa . + +- This program is free software; you can redistribute it and/or modify +- it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 3, or (at your option) +- any later version. ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. + +- This program is distributed in the hope that it will be useful, ++ The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, see . */ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ + + #ifndef _REGEX_INTERNAL_H + #define _REGEX_INTERNAL_H 1 +@@ -28,21 +27,54 @@ + #include + + #include +-#ifndef _LIBC +-# include "localcharset.h" +-#endif + #include + #include + #include + #include + #include +-#if defined _LIBC ++ ++#ifdef _LIBC + # include ++# define lock_define(name) __libc_lock_define (, name) ++# define lock_init(lock) (__libc_lock_init (lock), 0) ++# define lock_fini(lock) 0 ++# define lock_lock(lock) __libc_lock_lock (lock) ++# define lock_unlock(lock) __libc_lock_unlock (lock) ++#elif defined GNULIB_LOCK ++# include "glthread/lock.h" ++ /* Use gl_lock_define if empty macro arguments are known to work. ++ Otherwise, fall back on less-portable substitutes. */ ++# if ((defined __GNUC__ && !defined __STRICT_ANSI__) \ ++ || (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__)) ++# define lock_define(name) gl_lock_define (, name) ++# elif USE_POSIX_THREADS ++# define lock_define(name) pthread_mutex_t name; ++# elif USE_PTH_THREADS ++# define lock_define(name) pth_mutex_t name; ++# elif USE_SOLARIS_THREADS ++# define lock_define(name) mutex_t name; ++# elif USE_WINDOWS_THREADS ++# define lock_define(name) gl_lock_t name; ++# else ++# define lock_define(name) ++# endif ++# define lock_init(lock) glthread_lock_init (&(lock)) ++# define lock_fini(lock) glthread_lock_destroy (&(lock)) ++# define lock_lock(lock) glthread_lock_lock (&(lock)) ++# define lock_unlock(lock) glthread_lock_unlock (&(lock)) ++#elif defined GNULIB_PTHREAD ++# include ++# define lock_define(name) pthread_mutex_t name; ++# define lock_init(lock) pthread_mutex_init (&(lock), 0) ++# define lock_fini(lock) pthread_mutex_destroy (&(lock)) ++# define lock_lock(lock) pthread_mutex_lock (&(lock)) ++# define lock_unlock(lock) pthread_mutex_unlock (&(lock)) + #else +-# define __libc_lock_define(CLASS,NAME) +-# define __libc_lock_init(NAME) do { } while (0) +-# define __libc_lock_lock(NAME) do { } while (0) +-# define __libc_lock_unlock(NAME) do { } while (0) ++# define lock_define(name) ++# define lock_init(lock) 0 ++# define lock_fini(lock) 0 ++# define lock_lock(lock) ((void) 0) ++# define lock_unlock(lock) ((void) 0) + #endif + + /* In case that the system doesn't have isblank(). */ +@@ -65,7 +97,7 @@ + # ifdef _LIBC + # undef gettext + # define gettext(msgid) \ +- INTUSE(__dcgettext) (_libc_intl_domainname, msgid, LC_MESSAGES) ++ __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES) + # endif + #else + # define gettext(msgid) (msgid) +@@ -101,6 +133,8 @@ + + /* Rename to standard API for using out of glibc. */ + #ifndef _LIBC ++# undef __wctype ++# undef __iswctype + # define __wctype wctype + # define __iswctype iswctype + # define __btowc btowc +@@ -110,10 +144,8 @@ + # define attribute_hidden + #endif /* not _LIBC */ + +-#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) +-# define __attribute(arg) __attribute__ (arg) +-#else +-# define __attribute(arg) ++#if __GNUC__ < 3 + (__GNUC_MINOR__ < 1) ++# define __attribute__(arg) + #endif + + typedef __re_idx_t Idx; +@@ -429,7 +461,7 @@ static void build_upper_buffer (re_strin + static void re_string_translate_buffer (re_string_t *pstr) internal_function; + static unsigned int re_string_context_at (const re_string_t *input, Idx idx, + int eflags) +- internal_function __attribute ((pure)); ++ internal_function __attribute__ ((pure)); + #endif + #define re_string_peek_byte(pstr, offset) \ + ((pstr)->mbs[(pstr)->cur_idx + offset]) +@@ -448,7 +480,9 @@ static unsigned int re_string_context_at + #define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx)) + #define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx)) + +-#include ++#if defined _LIBC || HAVE_ALLOCA ++# include ++#endif + + #ifndef _LIBC + # if HAVE_ALLOCA +@@ -465,6 +499,12 @@ static unsigned int re_string_context_at + # endif + #endif + ++#ifdef _LIBC ++# define MALLOC_0_IS_NONNULL 1 ++#elif !defined MALLOC_0_IS_NONNULL ++# define MALLOC_0_IS_NONNULL 0 ++#endif ++ + #ifndef MAX + # define MAX(a,b) ((a) < (b) ? (b) : (a)) + #endif +@@ -695,7 +735,7 @@ struct re_dfa_t + #ifdef DEBUG + char* re_str; + #endif +- __libc_lock_define (, lock) ++ lock_define (lock) + }; + + #define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set)) +@@ -767,7 +807,7 @@ bitset_copy (bitset_t dest, const bitset + memcpy (dest, src, sizeof (bitset_t)); + } + +-static void ++static void __attribute__ ((unused)) + bitset_not (bitset_t set) + { + int bitset_i; +@@ -779,7 +819,7 @@ bitset_not (bitset_t set) + & ~set[BITSET_WORDS - 1]); + } + +-static void ++static void __attribute__ ((unused)) + bitset_merge (bitset_t dest, const bitset_t src) + { + int bitset_i; +@@ -787,7 +827,7 @@ bitset_merge (bitset_t dest, const bitse + dest[bitset_i] |= src[bitset_i]; + } + +-static void ++static void __attribute__ ((unused)) + bitset_mask (bitset_t dest, const bitset_t src) + { + int bitset_i; +@@ -798,7 +838,7 @@ bitset_mask (bitset_t dest, const bitset + #ifdef RE_ENABLE_I18N + /* Functions for re_string. */ + static int +-internal_function __attribute ((pure)) ++internal_function __attribute__ ((pure, unused)) + re_string_char_size_at (const re_string_t *pstr, Idx idx) + { + int byte_idx; +@@ -811,7 +851,7 @@ re_string_char_size_at (const re_string_ + } + + static wint_t +-internal_function __attribute ((pure)) ++internal_function __attribute__ ((pure, unused)) + re_string_wchar_at (const re_string_t *pstr, Idx idx) + { + if (pstr->mb_cur_max == 1) +@@ -821,7 +861,7 @@ re_string_wchar_at (const re_string_t *p + + # ifndef NOT_IN_libc + static int +-internal_function __attribute ((pure)) ++internal_function __attribute__ ((pure, unused)) + re_string_elem_size_at (const re_string_t *pstr, Idx idx) + { + # ifdef _LIBC +--- origsrc/lib/regexec.c 2012-12-22 14:21:52.000000000 +0100 ++++ src/lib/regexec.c 2013-06-27 18:05:27.268447078 +0200 +@@ -1,22 +1,21 @@ +-/* -*- buffer-read-only: t -*- vi: set ro: */ +-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ + /* Extended regular expression matching and search library. +- Copyright (C) 2002-2012 Free Software Foundation, Inc. ++ Copyright (C) 2002-2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Isamu Hasegawa . + +- This program is free software; you can redistribute it and/or modify +- it under the terms of the GNU General Public License as published by +- the Free Software Foundation; either version 3, or (at your option) +- any later version. ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. + +- This program is distributed in the hope that it will be useful, ++ The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- GNU General Public License for more details. ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. + +- You should have received a copy of the GNU General Public License along +- with this program; if not, see . */ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, see ++ . */ + + static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags, + Idx n) internal_function; +@@ -200,7 +199,7 @@ static Idx group_nodes_into_DFAstates (c + static bool check_node_accept (const re_match_context_t *mctx, + const re_token_t *node, Idx idx) + internal_function; +-static reg_errcode_t extend_buffers (re_match_context_t *mctx) ++static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len) + internal_function; + + /* Entry point for POSIX code. */ +@@ -229,9 +228,7 @@ regexec (preg, string, nmatch, pmatch, e + { + reg_errcode_t err; + Idx start, length; +-#ifdef _LIBC + re_dfa_t *dfa = preg->buffer; +-#endif + + if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND)) + return REG_BADPAT; +@@ -247,14 +244,14 @@ regexec (preg, string, nmatch, pmatch, e + length = strlen (string); + } + +- __libc_lock_lock (dfa->lock); ++ lock_lock (dfa->lock); + if (preg->no_sub) + err = re_search_internal (preg, string, length, start, length, + length, 0, NULL, eflags); + else + err = re_search_internal (preg, string, length, start, length, + length, nmatch, pmatch, eflags); +- __libc_lock_unlock (dfa->lock); ++ lock_unlock (dfa->lock); + return err != REG_NOERROR; + } + +@@ -422,9 +419,7 @@ re_search_stub (struct re_pattern_buffer + Idx nregs; + regoff_t rval; + int eflags = 0; +-#ifdef _LIBC + re_dfa_t *dfa = bufp->buffer; +-#endif + Idx last_start = start + range; + + /* Check for out-of-range. */ +@@ -435,7 +430,7 @@ re_search_stub (struct re_pattern_buffer + else if (BE (last_start < 0 || (range < 0 && start <= last_start), 0)) + last_start = 0; + +- __libc_lock_lock (dfa->lock); ++ lock_lock (dfa->lock); + + eflags |= (bufp->not_bol) ? REG_NOTBOL : 0; + eflags |= (bufp->not_eol) ? REG_NOTEOL : 0; +@@ -499,7 +494,7 @@ re_search_stub (struct re_pattern_buffer + } + re_free (pmatch); + out: +- __libc_lock_unlock (dfa->lock); ++ lock_unlock (dfa->lock); + return rval; + } + +@@ -1065,7 +1060,7 @@ prune_impossible_nodes (re_match_context + since initial states may have constraints like "\<", "^", etc.. */ + + static inline re_dfastate_t * +-__attribute ((always_inline)) internal_function ++__attribute__ ((always_inline)) internal_function + acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx, + Idx idx) + { +@@ -1177,7 +1172,7 @@ check_matching (re_match_context_t *mctx + || (BE (next_char_idx >= mctx->input.valid_len, 0) + && mctx->input.valid_len < mctx->input.len)) + { +- err = extend_buffers (mctx); ++ err = extend_buffers (mctx, next_char_idx + 1); + if (BE (err != REG_NOERROR, 0)) + { + assert (err == REG_ESPACE); +@@ -1757,7 +1752,7 @@ clean_state_log_if_needed (re_match_cont + && mctx->input.valid_len < mctx->input.len)) + { + reg_errcode_t err; +- err = extend_buffers (mctx); ++ err = extend_buffers (mctx, next_state_log_idx + 1); + if (BE (err != REG_NOERROR, 0)) + return err; + } +@@ -2814,7 +2809,7 @@ get_subexp (re_match_context_t *mctx, Id + if (bkref_str_off >= mctx->input.len) + break; + +- err = extend_buffers (mctx); ++ err = extend_buffers (mctx, bkref_str_off + 1); + if (BE (err != REG_NOERROR, 0)) + return err; + +@@ -3937,6 +3932,7 @@ check_node_accept_bytes (const re_dfa_t + in_collseq = find_collation_sequence_value (pin, elem_len); + } + /* match with range expression? */ ++ /* FIXME: Implement rational ranges here, too. */ + for (i = 0; i < cset->nranges; ++i) + if (cset->range_starts[i] <= in_collseq + && in_collseq <= cset->range_ends[i]) +@@ -3988,18 +3984,9 @@ check_node_accept_bytes (const re_dfa_t + # endif /* _LIBC */ + { + /* match with range expression? */ +-#if __GNUC__ >= 2 && ! (__STDC_VERSION__ < 199901L && defined __STRICT_ANSI__) +- wchar_t cmp_buf[] = {L'\0', L'\0', wc, L'\0', L'\0', L'\0'}; +-#else +- wchar_t cmp_buf[] = {L'\0', L'\0', L'\0', L'\0', L'\0', L'\0'}; +- cmp_buf[2] = wc; +-#endif + for (i = 0; i < cset->nranges; ++i) + { +- cmp_buf[0] = cset->range_starts[i]; +- cmp_buf[4] = cset->range_ends[i]; +- if (wcscoll (cmp_buf, cmp_buf + 2) <= 0 +- && wcscoll (cmp_buf + 2, cmp_buf + 4) <= 0) ++ if (cset->range_starts[i] <= wc && wc <= cset->range_ends[i]) + { + match_len = char_len; + goto check_node_accept_bytes_match; +@@ -4137,7 +4124,7 @@ check_node_accept (const re_match_contex + + static reg_errcode_t + internal_function __attribute_warn_unused_result__ +-extend_buffers (re_match_context_t *mctx) ++extend_buffers (re_match_context_t *mctx, int min_len) + { + reg_errcode_t ret; + re_string_t *pstr = &mctx->input; +@@ -4147,8 +4134,10 @@ extend_buffers (re_match_context_t *mctx + <= pstr->bufs_len, 0)) + return REG_ESPACE; + +- /* Double the lengths of the buffers. */ +- ret = re_string_realloc_buffers (pstr, MIN (pstr->len, pstr->bufs_len * 2)); ++ /* Double the lengths of the buffers, but allocate at least MIN_LEN. */ ++ ret = re_string_realloc_buffers (pstr, ++ MAX (min_len, ++ MIN (pstr->len, pstr->bufs_len * 2))); + if (BE (ret != REG_NOERROR, 0)) + return ret; + +--- origsrc/sed/sed.c 2012-03-16 10:13:31.000000000 +0100 ++++ src/sed/sed.c 2013-06-27 18:06:25.592195456 +0200 +@@ -57,7 +57,11 @@ bool follow_symlinks = false; + char *in_place_extension = NULL; + + /* The mode to use to read/write files, either "r"/"w" or "rb"/"wb". */ ++#ifdef HAVE_FOPEN_RT ++char *read_mode = "rt"; ++#else + char *read_mode = "r"; ++#endif + char *write_mode = "w"; + + /* Do we need to be pedantically POSIX compliant? */ diff --git a/dev/ci/README.md b/dev/ci/README.md new file mode 100644 index 00000000..43d680af --- /dev/null +++ b/dev/ci/README.md @@ -0,0 +1,176 @@ +Continuous Integration for the Coq Proof Assistant +================================================== + +Changes to Coq are systematically tested for regression and compatibility +breakage on our Continuous Integration (CI) platforms *before* integration, +so as to ensure better robustness and catch problems as early as possible. +These tests include the compilation of several external libraries / plugins. + +This document contains information for both external library / plugin authors, +who might be interested in having their development tested, and for Coq +developers / contributors, who must ensure that they don't break these +external developments accidentally. + +*Remark:* the CI policy outlined in this document is susceptible to evolve and +specific accommodations are of course possible. + +Information for external library / plugin authors +------------------------------------------------- + +You are encouraged to consider submitting your development for addition to +our CI. This means that: + +- Any time that a proposed change is breaking your development, Coq developers + will send you patches to adapt it or, at the very least, will work with you + to see how to adapt it. + +On the condition that: + +- At the time of the submission, your development works with Coq master branch. + +- Your development is publicly available in a git repository and we can easily + send patches to you (e.g. through pull / merge requests). + +- You react in a timely manner to discuss / integrate those patches. + +- You do not push, to the branches that we test, commits that haven't been + first tested to compile with the corresponding branch(es) of Coq. + +- You maintain a reasonable build time for your development, or you provide + a "lite" target that we can use. + +In case you forget to comply with these last three conditions, we would reach +out to you and give you a 30-day grace period during which your development +would be moved into our "allow failure" category. At the end of the grace +period, in the absence of progress, the development would be removed from our +CI. + +### Add your development by submitting a pull request + +Add a new `ci-mydev.sh` script to [`dev/ci`](.); set the corresponding +variables in [`ci-basic-overlay.sh`](ci-basic-overlay.sh); add the +corresponding target to [`Makefile.ci`](../../Makefile.ci) and a new job to +[`.gitlab-ci.yml`](../../.gitlab-ci.yml) so that this new target is run. +Have a look at [#7656](https://github.com/coq/coq/pull/7656/files) for an +example. **Do not hesitate to submit an incomplete pull request if you need +help to finish it.** + +You may also be interested in having your development tested in our +performance benchmark. Currently this is done by providing an OPAM package +in https://github.com/coq/opam-coq-archive and opening an issue at +https://github.com/coq/coq-bench/issues. + + +Information for developers +-------------------------- + +When you submit a pull request (PR) on Coq GitHub repository, this will +automatically launch a battery of CI tests. The PR will not be integrated +unless these tests pass. + +We are currently running tests on the following platforms: + +- GitLab CI is the main CI platform. It tests the compilation of Coq, of the + documentation, and of CoqIDE on Linux with several versions of OCaml / + camlp5, and with warnings as errors; it runs the test-suite and tests the + compilation of several external developments. + +- Travis CI is used to test the compilation of Coq and run the test-suite on + macOS. It also runs a linter that checks whitespace discipline. A + [pre-commit hook](../tools/pre-commit) is automatically installed by + `./configure`. It should allow complying with this discipline without pain. + +- AppVeyor is used to test the compilation of Coq and run the test-suite on + Windows. + +You can anticipate the results of most of these tests prior to submitting your +PR by running GitLab CI on your private branches. To do so follow these steps: + +1. Log into GitLab CI (the easiest way is to sign in with your GitHub account). +2. Click on "New Project". +3. Choose "CI / CD for external repository" then click on "GitHub". +4. Find your fork of the Coq repository and click on "Connect". +5. If GitLab did not do so automatically, [enable the Container Registry](https://docs.gitlab.com/ee/user/project/container_registry.html#enable-the-container-registry-for-your-project). +6. You are encouraged to go to the CI / CD general settings and increase the + timeout from 1h to 2h for better reliability. + +Now everytime you push (including force-push unless you changed the default +GitLab setting) to your fork on GitHub, it will be synchronized on GitLab and +CI will be run. You will receive an e-mail with a report of the failures if +there are some. + +You can also run one CI target locally (using `make ci-somedev`). + +See also [`test-suite/README.md`](../../test-suite/README.md) for information about adding new tests to the test-suite. + +### Breaking changes + +When your PR breaks an external project we test in our CI, you must prepare a +patch (or ask someone to prepare a patch) to fix the project: + +1. Fork the external project, create a new branch, push a commit adapting + the project to your changes. +2. Test your pull request with your adapted version of the external project by + adding an overlay file to your pull request (cf. + [`dev/ci/user-overlays/README.md`](user-overlays/README.md)). +3. Fixes to external libraries (pure Coq projects) *must* be backward + compatible (i.e. they should also work with the development version of Coq, + and the latest stable version). This will allow you to open a PR on the + external project repository to have your changes merged *before* your PR on + Coq can be integrated. + + On the other hand, patches to plugins (projects linking to the Coq ML API) + can very rarely be made backward compatible and plugins we test will + generally have a dedicated branch per Coq version. + You can still open a pull request but the merging will be requested by the + developer who merges the PR on Coq. There are plans to improve this, cf. + [#6724](https://github.com/coq/coq/issues/6724). + +Moreover your PR must absolutely update the [`CHANGES`](../../CHANGES) file. + +Advanced GitLab CI information +------------------------------ + +GitLab CI is set up to use the "build artifact" feature to avoid +rebuilding Coq. In one job, Coq is built with `./configure -prefix _install_ci` +and `make install` is run, then the `_install_ci` directory +persists to and is used by the next jobs. + +Artifacts can also be downloaded from the GitLab repository. +Currently, available artifacts are: +- the Coq executables and stdlib, in three copies varying in + architecture and OCaml version used to build Coq. +- the Coq documentation, built only in the `build:base` job. When submitting + a documentation PR, this can help reviewers checking the rendered result. + +As an exception to the above, jobs testing that compilation triggers +no OCaml warnings build Coq in parallel with other tests. + +### GitLab and Windows + +If your repository has access to runners tagged `windows`, setting the +secret variable `WINDOWS` to `enabled` will add jobs building Windows +versions of Coq (32bit and 64bit). + +The Windows jobs are enabled on Coq's repository, where pipelines for +pull requests run. + +### GitLab and Docker + +System and opam packages are installed in a Docker image. The image is +automatically built and uploaded to your GitLab registry, and is +loaded by subsequent jobs. + +**IMPORTANT**: When updating Coq's CI docker image, you must modify +the `CACHEKEY` variable in [`.gitlab-ci.yml`](../../.gitlab-ci.yml) +and [`Dockerfile`](docker/bionic_coq/Dockerfile) + +The Docker building job reuses the uploaded image if it is available, +but if you wish to save more time you can skip the job by setting +`SKIP_DOCKER` to `true`. + +This means you will need to change its value when the Docker image +needs to be updated. You can do so for a single pipeline by starting +it through the web interface.. + +See also [`docker/README.md`](docker/README.md). diff --git a/dev/ci/appveyor.bat b/dev/ci/appveyor.bat new file mode 100644 index 00000000..85a71baf --- /dev/null +++ b/dev/ci/appveyor.bat @@ -0,0 +1,42 @@ +REM This script either runs the test suite with OPAM (if USEOPAM is true) or +REM builds the Coq binary packages for windows (if USEOPAM is false). + +if %ARCH% == 32 ( + SET ARCHLONG=i686 + SET CYGROOT=C:\cygwin + SET SETUP=setup-x86.exe +) + +if %ARCH% == 64 ( + SET ARCHLONG=x86_64 + SET CYGROOT=C:\cygwin64 + SET SETUP=setup-x86_64.exe +) + +SET CYGCACHE=%CYGROOT%\var\cache\setup +SET APPVEYOR_BUILD_FOLDER_MFMT=%APPVEYOR_BUILD_FOLDER:\=/% +SET APPVEYOR_BUILD_FOLDER_CFMT=%APPVEYOR_BUILD_FOLDER_MFMT:C:/=/cygdrive/c/% +SET DESTCOQ=C:\coq%ARCH%_inst +SET COQREGTESTING=Y + +if %USEOPAM% == false ( + call %APPVEYOR_BUILD_FOLDER%\dev\build\windows\MakeCoq_MinGW.bat -threads=1 ^ + -arch=%ARCH% -installer=Y -coqver=%APPVEYOR_BUILD_FOLDER_CFMT% ^ + -destcyg=%CYGROOT% -destcoq=%DESTCOQ% -cygcache=%CYGCACHE% ^ + -addon=bignums -make=N ^ + -setup %CYGROOT%\%SETUP% || GOTO ErrorExit + copy "%CYGROOT%\build\coq-local\dev\nsis\*.exe" dev\nsis || GOTO ErrorExit + 7z a coq-opensource-archive-windows-%ARCHLONG%.zip %CYGROOT%\build\tarballs\* || GOTO ErrorExit +) + +if %USEOPAM% == true ( + %CYGROOT%\%SETUP% -qnNdO -R %CYGROOT% -l %CYGCACHE% -s %CYGMIRROR% ^ + -P rsync -P patch -P diffutils -P make -P unzip -P m4 -P findutils -P time + %CYGROOT%/bin/bash -l %APPVEYOR_BUILD_FOLDER%/dev/ci/appveyor.sh || GOTO ErrorExit +) + +GOTO :EOF + +:ErrorExit + ECHO ERROR %0 failed + EXIT /b 1 diff --git a/dev/ci/appveyor.sh b/dev/ci/appveyor.sh new file mode 100644 index 00000000..8f53877f --- /dev/null +++ b/dev/ci/appveyor.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e -x + +APPVEYOR_OPAM_SWITCH=4.07.0+mingw64c + +wget https://github.com/fdopen/opam-repository-mingw/releases/download/0.0.0.1/opam64.tar.xz +tar -xf opam64.tar.xz +bash opam64/install.sh + +opam init -a mingw https://github.com/fdopen/opam-repository-mingw.git --comp $APPVEYOR_OPAM_SWITCH --switch $APPVEYOR_OPAM_SWITCH +eval "$(opam config env)" +opam install -y num ocamlfind camlp5 + +cd "$APPVEYOR_BUILD_FOLDER" && ./configure -local && make && make byte && make -C test-suite all INTERACTIVE= && make validate diff --git a/dev/ci/ci-basic-overlay.sh b/dev/ci/ci-basic-overlay.sh new file mode 100755 index 00000000..13367794 --- /dev/null +++ b/dev/ci/ci-basic-overlay.sh @@ -0,0 +1,236 @@ +#!/usr/bin/env bash + +# This is the basic overlay set for repositories in the CI. + +# Maybe we should just use Ruby to have real objects... + +# : "${foo:=bar}" sets foo to "bar" if it is unset or null + +######################################################################## +# MathComp +######################################################################## +: "${mathcomp_CI_REF:=mathcomp-1.7.0}" +: "${mathcomp_CI_GITURL:=https://github.com/math-comp/math-comp}" +: "${mathcomp_CI_ARCHIVEURL:=${mathcomp_CI_GITURL}/archive}" + +: "${oddorder_CI_REF:=master}" +: "${oddorder_CI_GITURL:=https://github.com/math-comp/odd-order}" +: "${oddorder_CI_ARCHIVEURL:=${oddorder_CI_GITURL}/archive}" + +######################################################################## +# UniMath +######################################################################## +: "${UniMath_CI_REF:=master}" +: "${UniMath_CI_GITURL:=https://github.com/UniMath/UniMath}" +: "${UniMath_CI_ARCHIVEURL:=${UniMath_CI_GITURL}/archive}" + +######################################################################## +# Unicoq + Mtac2 +######################################################################## +: "${unicoq_CI_REF:=v1.3-8.8}" +: "${unicoq_CI_GITURL:=https://github.com/unicoq/unicoq}" +: "${unicoq_CI_ARCHIVEURL:=${unicoq_CI_GITURL}/archive}" + +: "${mtac2_CI_REF:=v1.0.1-coq8.8}" +: "${mtac2_CI_GITURL:=https://github.com/Mtac2/Mtac2}" +: "${mtac2_CI_ARCHIVEURL:=${mtac2_CI_GITURL}/archive}" + +######################################################################## +# Mathclasses + Corn +######################################################################## +: "${math_classes_CI_REF:=master}" +: "${math_classes_CI_GITURL:=https://github.com/coq-community/math-classes}" +: "${math_classes_CI_ARCHIVEURL:=${math_classes_CI_GITURL}/archive}" + +: "${Corn_CI_REF:=master}" +: "${Corn_CI_GITURL:=https://github.com/coq-community/corn}" +: "${Corn_CI_ARCHIVEURL:=${Corn_CI_GITURL}/archive}" + +######################################################################## +# Iris +######################################################################## +: "${stdpp_CI_REF:=master}" +: "${stdpp_CI_GITURL:=https://gitlab.mpi-sws.org/robbertkrebbers/coq-stdpp}" +: "${stdpp_CI_ARCHIVEURL:=${stdpp_CI_GITURL}/-/archive}" + +: "${Iris_CI_REF:=master}" +: "${Iris_CI_GITURL:=https://gitlab.mpi-sws.org/FP/iris-coq}" +: "${Iris_CI_ARCHIVEURL:=${Iris_CI_GITURL}/-/archive}" + +: "${lambdaRust_CI_REF:=master}" +: "${lambdaRust_CI_GITURL:=https://gitlab.mpi-sws.org/FP/LambdaRust-coq}" +: "${lambdaRust_CI_ARCHIVEURL:=${lambdaRust_CI_GITURL}/-/archive}" + +######################################################################## +# HoTT +######################################################################## +: "${HoTT_CI_REF:=V8.8}" +: "${HoTT_CI_GITURL:=https://github.com/HoTT/HoTT}" +: "${HoTT_CI_ARCHIVEURL:=${HoTT_CI_GITURL}/archive}" + +######################################################################## +# Ltac2 +######################################################################## +: "${ltac2_CI_REF:=0.1}" +: "${ltac2_CI_GITURL:=https://github.com/ppedrot/ltac2}" +: "${ltac2_CI_ARCHIVEURL:=${ltac2_CI_GITURL}/archive}" + +######################################################################## +# GeoCoq +######################################################################## +: "${GeoCoq_CI_REF:=master}" +: "${GeoCoq_CI_GITURL:=https://github.com/GeoCoq/GeoCoq}" +: "${GeoCoq_CI_ARCHIVEURL:=${GeoCoq_CI_GITURL}/archive}" + +######################################################################## +# Flocq +######################################################################## +: "${Flocq_CI_REF:=master}" +: "${Flocq_CI_GITURL:=https://gitlab.inria.fr/flocq/flocq}" +: "${Flocq_CI_ARCHIVEURL:=${Flocq_CI_GITURL}/-/archive}" + +######################################################################## +# Coquelicot +######################################################################## +# ATTENTION: The archive URL might depend on the version +: "${Coquelicot_CI_REF:=coquelicot-3.0.2}" +: "${Coquelicot_CI_GITURL:=https://scm.gforge.inria.fr/anonscm/git/coquelicot/coquelicot}" +: "${Coquelicot_CI_ARCHIVEURL:=https://gforge.inria.fr/frs/download.php/file/37523}" + +######################################################################## +# CompCert +######################################################################## +# Note: The latest release version of CompCert (3.3) does not compile with Coq 8.8.1 +# This is caused by a compatibility issue with OCaml 4.0.7 +: "${CompCert_CI_REF:=17f9d839df12511a7e327f2840855e70af5ede47}" +: "${CompCert_CI_GITURL:=https://github.com/AbsInt/CompCert}" +: "${CompCert_CI_ARCHIVEURL:=${CompCert_CI_GITURL}/archive}" + +######################################################################## +# VST +######################################################################## +# Note: The latest release version of VST (2.2) does not compile with Coq 8.8.1 +# Note: newer versions of VST have issues with buildability and licensing +: "${VST_CI_REF:=e49605cf1f1e5ae3bbec3d6554122427a94ae986}" +: "${VST_CI_GITURL:=https://github.com/PrincetonUniversity/VST}" +: "${VST_CI_ARCHIVEURL:=${VST_CI_GITURL}/archive}" + +######################################################################## +# fiat_parsers +######################################################################## +: "${fiat_parsers_CI_REF:=master}" +: "${fiat_parsers_CI_GITURL:=https://github.com/mit-plv/fiat}" +: "${fiat_parsers_CI_ARCHIVEURL:=${fiat_parsers_CI_GITURL}/archive}" + +######################################################################## +# fiat_crypto +######################################################################## +: "${fiat_crypto_CI_REF:=master}" +: "${fiat_crypto_CI_GITURL:=https://github.com/mit-plv/fiat-crypto}" +: "${fiat_crypto_CI_ARCHIVEURL:=${fiat_crypto_CI_GITURL}/archive}" + +######################################################################## +# formal-topology +######################################################################## +: "${formal_topology_CI_REF:=ci}" +: "${formal_topology_CI_GITURL:=https://github.com/bmsherman/topology}" +: "${formal_topology_CI_ARCHIVEURL:=${formal_topology_CI_GITURL}/archive}" + +######################################################################## +# coq-dpdgraph +######################################################################## +: "${coq_dpdgraph_CI_REF:=coq-v8.8}" +: "${coq_dpdgraph_CI_GITURL:=https://github.com/Karmaki/coq-dpdgraph}" +: "${coq_dpdgraph_CI_ARCHIVEURL:=${coq_dpdgraph_CI_GITURL}/archive}" + +######################################################################## +# CoLoR +######################################################################## +: "${CoLoR_CI_REF:=master}" +: "${CoLoR_CI_GITURL:=https://github.com/fblanqui/color}" +: "${CoLoR_CI_ARCHIVEURL:=${CoLoR_CI_GITURL}/archive}" + +######################################################################## +# SF +######################################################################## +: "${sf_lf_CI_TARURL:=https://www.cis.upenn.edu/~bcpierce/sf/lf-current/lf.tgz}" +: "${sf_plf_CI_TARURL:=https://www.cis.upenn.edu/~bcpierce/sf/plf-current/plf.tgz}" +: "${sf_vfa_CI_TARURL:=https://www.cis.upenn.edu/~bcpierce/sf/vfa-current/vfa.tgz}" + +######################################################################## +# TLC +######################################################################## +: "${tlc_CI_REF:=master}" +: "${tlc_CI_GITURL:=https://gforge.inria.fr/git/tlc/tlc}" + +######################################################################## +# Bignums +######################################################################## +: "${bignums_CI_REF:=V8.8.0}" +: "${bignums_CI_GITURL:=https://github.com/coq/bignums}" +: "${bignums_CI_ARCHIVEURL:=${bignums_CI_GITURL}/archive}" + +######################################################################## +# bedrock2 +######################################################################## +: "${bedrock2_CI_REF:=master}" +: "${bedrock2_CI_GITURL:=https://github.com/mit-plv/bedrock2}" +: "${bedrock2_CI_ARCHIVEURL:=${bedrock2_CI_GITURL}/archive}" + +######################################################################## +# Equations +######################################################################## +: "${Equations_CI_REF:=v1.1-8.8}" +: "${Equations_CI_GITURL:=https://github.com/mattam82/Coq-Equations}" +: "${Equations_CI_ARCHIVEURL:=${Equations_CI_GITURL}/archive}" + +######################################################################## +# Elpi +######################################################################## +: "${Elpi_CI_REF:=coq-v8.8}" +: "${Elpi_CI_GITURL:=https://github.com/LPCIC/coq-elpi}" +: "${Elpi_CI_ARCHIVEURL:=${Elpi_CI_GITURL}/archive}" + +######################################################################## +# fcsl-pcm +######################################################################## +: "${fcsl_pcm_CI_REF:=master}" +: "${fcsl_pcm_CI_GITURL:=https://github.com/imdea-software/fcsl-pcm}" +: "${fcsl_pcm_CI_ARCHIVEURL:=${fcsl_pcm_CI_GITURL}/archive}" + +######################################################################## +# ext-lib +######################################################################## +# Note: This is the latest commit of the v8.8 branch as of August 31st 2018 +: "${ext_lib_CI_REF:=5dd9cfa51f96fcb785c7c31d8c6bf55af5d93f27}" +: "${ext_lib_CI_GITURL:=https://github.com/coq-ext-lib/coq-ext-lib}" +: "${ext_lib_CI_ARCHIVEURL:=${ext_lib_CI_GITURL}/archive}" + +######################################################################## +# simple-io +######################################################################## +: "${simple_io_CI_REF:=0.2}" +: "${simple_io_CI_GITURL:=https://github.com/Lysxia/coq-simple-io}" +: "${simple_io_CI_ARCHIVEURL:=${simple_io_CI_GITURL}/archive}" + +######################################################################## +# quickchick +######################################################################## +: "${quickchick_CI_REF:=v1.0.2}" +: "${quickchick_CI_GITURL:=https://github.com/QuickChick/QuickChick}" +: "${quickchick_CI_ARCHIVEURL:=${quickchick_CI_GITURL}/archive}" + +######################################################################## +# menhirlib +######################################################################## +: "${menhirlib_CI_REF:=20180827}" +: "${menhirlib_CI_GITURL:=https://gitlab.inria.fr/fpottier/coq-menhirlib}" +: "${menhirlib_CI_ARCHIVEURL:=${menhirlib_CI_GITURL}/-/archive}" + +######################################################################## +# aac-tactics +######################################################################## +# Note: this is the latest commit of the v8.8 branch as of August 31st 2018 +: "${aactactis_CI_REF:=86ac28259030649ef51460e4de2441c8a1017751}" +: "${aactactis_CI_GITURL:=https://github.com/coq-community/aac-tactics}" +: "${aactactis_CI_ARCHIVEURL:=${aactactis_CI_GITURL}/archive}" diff --git a/dev/ci/ci-bedrock2.sh b/dev/ci/ci-bedrock2.sh new file mode 100755 index 00000000..52059462 --- /dev/null +++ b/dev/ci/ci-bedrock2.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +FORCE_GIT=1 +git_download bedrock2 + +( cd "${CI_BUILD_DIR}/bedrock2" && git submodule update --init --recursive && make ) diff --git a/dev/ci/ci-bignums.sh b/dev/ci/ci-bignums.sh new file mode 100755 index 00000000..756f54df --- /dev/null +++ b/dev/ci/ci-bignums.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +git_download bignums + +( cd "${CI_BUILD_DIR}/bignums" && make && make install) diff --git a/dev/ci/ci-color.sh b/dev/ci/ci-color.sh new file mode 100755 index 00000000..dc696f69 --- /dev/null +++ b/dev/ci/ci-color.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +git_download CoLoR + +( cd "${CI_BUILD_DIR}/CoLoR" && make ) diff --git a/dev/ci/ci-common.sh b/dev/ci/ci-common.sh new file mode 100644 index 00000000..6fc4293d --- /dev/null +++ b/dev/ci/ci-common.sh @@ -0,0 +1,123 @@ +#!/usr/bin/env bash + +set -xe + +# default value for NJOBS +: "${NJOBS:=1}" +export NJOBS + +if [ -n "${GITLAB_CI}" ]; +then + export OCAMLPATH="$PWD/_install_ci/lib:$OCAMLPATH" + export COQBIN="$PWD/_install_ci/bin" + export CI_BRANCH="$CI_COMMIT_REF_NAME" + if [[ ${CI_BRANCH#pr-} =~ ^[0-9]*$ ]] + then + export CI_PULL_REQUEST="${CI_BRANCH#pr-}" + fi +else + if [ -n "${TRAVIS}" ]; + then + export CI_PULL_REQUEST="$TRAVIS_PULL_REQUEST" + export CI_BRANCH="$TRAVIS_BRANCH" + else # assume local + CI_BRANCH="$(git rev-parse --abbrev-ref HEAD)" + export CI_BRANCH + fi + export OCAMLPATH="$PWD:$OCAMLPATH" + export COQBIN="$PWD/bin" +fi +export PATH="$COQBIN:$PATH" + +# Coq's tools need an ending slash :S, we should fix them. +export COQBIN="$COQBIN/" + +ls "$COQBIN" + +# Where we download and build external developments +CI_BUILD_DIR="$PWD/_build_ci" + +for overlay in "${ci_dir}"/user-overlays/*.sh; do + # shellcheck source=/dev/null + . "${overlay}" +done +# shellcheck source=ci-basic-overlay.sh +. "${ci_dir}/ci-basic-overlay.sh" + +# [git_download project] will download [project] and unpack it +# in [$CI_BUILD_DIR/project] if the folder does not exist already; +# if it does, it will do nothing except print a warning (this can be +# useful when building locally). +# Note: when $FORCE_GIT is set to 1 or when $CI is unset or empty +# (local build), it uses git clone to perform the download. +git_download() +{ + local PROJECT=$1 + local DEST="$CI_BUILD_DIR/$PROJECT" + + if [ -d "$DEST" ]; then + echo "Warning: download and unpacking of $PROJECT skipped because $DEST already exists." + elif [ "$FORCE_GIT" = "1" ] || [ "$CI" = "" ]; then + local GITURL_VAR="${PROJECT}_CI_GITURL" + local GITURL="${!GITURL_VAR}" + local REF_VAR="${PROJECT}_CI_REF" + local REF="${!REF_VAR}" + git clone "$GITURL" "$DEST" + cd "$DEST" + git checkout "$REF" + else # When possible, we download tarballs to reduce bandwidth and latency + local ARCHIVEURL_VAR="${PROJECT}_CI_ARCHIVEURL" + local ARCHIVEURL="${!ARCHIVEURL_VAR}" + local REF_VAR="${PROJECT}_CI_REF" + local REF="${!REF_VAR}" + mkdir -p "$DEST" + cd "$DEST" + wget "$ARCHIVEURL/$REF.tar.gz" + tar xvfz "$REF.tar.gz" --strip-components=1 + rm -f "$REF.tar.gz" + fi +} + +make() +{ + # +x: add x only if defined + if [ -z "${MAKEFLAGS+x}" ] && [ -n "${NJOBS}" ]; + then + # Not submake and parallel make requested + command make -j "$NJOBS" "$@" + else + command make "$@" + fi +} + +# this installs just the ssreflect library of math-comp +install_ssreflect() +{ + echo 'Installing ssreflect' && echo -en 'travis_fold:start:ssr.install\\r' + + git_download mathcomp + + ( cd "${CI_BUILD_DIR}/mathcomp/mathcomp" && \ + make Makefile.coq && \ + make -f Makefile.coq ssreflect/all_ssreflect.vo && \ + make -f Makefile.coq install ) + + echo -en 'travis_fold:end:ssr.install\\r' + +} + +# this installs just the ssreflect + algebra library of math-comp +install_ssralg() +{ + echo 'Installing ssralg' && echo -en 'travis_fold:start:ssralg.install\\r' + + git_download mathcomp + + ( cd "${CI_BUILD_DIR}/mathcomp/mathcomp" && \ + make Makefile.coq && \ + make -f Makefile.coq algebra/all_algebra.vo && \ + make -f Makefile.coq install ) + + echo -en 'travis_fold:end:ssralg.install\\r' + +} diff --git a/dev/ci/ci-compcert.sh b/dev/ci/ci-compcert.sh new file mode 100755 index 00000000..01c35ceb --- /dev/null +++ b/dev/ci/ci-compcert.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +git_download CompCert + +( cd "${CI_BUILD_DIR}/CompCert" && \ + ./configure -ignore-coq-version x86_32-linux && make && make check-proof ) diff --git a/dev/ci/ci-coq-dpdgraph.sh b/dev/ci/ci-coq-dpdgraph.sh new file mode 100755 index 00000000..2373ea6c --- /dev/null +++ b/dev/ci/ci-coq-dpdgraph.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +git_download coq_dpdgraph + +( cd "${CI_BUILD_DIR}/coq_dpdgraph" && autoconf && ./configure && make && make test-suite ) diff --git a/dev/ci/ci-coquelicot.sh b/dev/ci/ci-coquelicot.sh new file mode 100755 index 00000000..5d881749 --- /dev/null +++ b/dev/ci/ci-coquelicot.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +install_ssreflect + +FORCE_GIT=1 +git_download Coquelicot + +( cd "${CI_BUILD_DIR}/Coquelicot" && ./autogen.sh && ./configure && ./remake "-j${NJOBS}" ) diff --git a/dev/ci/ci-corn.sh b/dev/ci/ci-corn.sh new file mode 100755 index 00000000..7d5d70cf --- /dev/null +++ b/dev/ci/ci-corn.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +git_download Corn + +( cd "${CI_BUILD_DIR}/Corn" && make && make install ) diff --git a/dev/ci/ci-cpdt.sh b/dev/ci/ci-cpdt.sh new file mode 100755 index 00000000..ca759c7b --- /dev/null +++ b/dev/ci/ci-cpdt.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +wget http://adam.chlipala.net/cpdt/cpdt.tgz +tar xvfz cpdt.tgz + +( cd cpdt && make clean && make ) diff --git a/dev/ci/ci-elpi.sh b/dev/ci/ci-elpi.sh new file mode 100755 index 00000000..7f4ef77d --- /dev/null +++ b/dev/ci/ci-elpi.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +FORCE_GIT=1 +git_download Elpi + +( cd "${CI_BUILD_DIR}/Elpi" && make && make install ) diff --git a/dev/ci/ci-equations.sh b/dev/ci/ci-equations.sh new file mode 100755 index 00000000..998d50fa --- /dev/null +++ b/dev/ci/ci-equations.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +git_download Equations + +( cd "${CI_BUILD_DIR}/Equations" && coq_makefile -f _CoqProject -o Makefile && \ + make && make test-suite && make examples && make install) diff --git a/dev/ci/ci-ext-lib.sh b/dev/ci/ci-ext-lib.sh new file mode 100755 index 00000000..5eb167d9 --- /dev/null +++ b/dev/ci/ci-ext-lib.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +git_download ext_lib + +( cd "${CI_BUILD_DIR}/ext_lib" && make && make install) diff --git a/dev/ci/ci-fcsl-pcm.sh b/dev/ci/ci-fcsl-pcm.sh new file mode 100755 index 00000000..cb951630 --- /dev/null +++ b/dev/ci/ci-fcsl-pcm.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +install_ssreflect + +git_download fcsl_pcm + +( cd "${CI_BUILD_DIR}/fcsl_pcm" && make ) diff --git a/dev/ci/ci-fiat-crypto-legacy.sh b/dev/ci/ci-fiat-crypto-legacy.sh new file mode 100755 index 00000000..e0395754 --- /dev/null +++ b/dev/ci/ci-fiat-crypto-legacy.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +FORCE_GIT=1 +git_download fiat_crypto + +fiat_crypto_legacy_CI_TARGETS1="print-old-pipeline-lite old-pipeline-lite lite-display" +fiat_crypto_legacy_CI_TARGETS2="print-old-pipeline-nobigmem old-pipeline-nobigmem nonautogenerated-specific nonautogenerated-specific-display" + +( cd "${CI_BUILD_DIR}/fiat_crypto" && git submodule update --init --recursive && \ + make ${fiat_crypto_legacy_CI_TARGETS1} && make -j 1 ${fiat_crypto_legacy_CI_TARGETS2} ) diff --git a/dev/ci/ci-fiat-crypto.sh b/dev/ci/ci-fiat-crypto.sh new file mode 100755 index 00000000..7e8013be --- /dev/null +++ b/dev/ci/ci-fiat-crypto.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +FORCE_GIT=1 +git_download fiat_crypto + +# We need a larger stack size to not overflow ocamlopt+flambda when +# building the executables. +# c.f. https://github.com/coq/coq/pull/8313#issuecomment-416650241 + +( cd "${CI_BUILD_DIR}/fiat_crypto" && git submodule update --init --recursive && \ + ulimit -s 32768 && make new-pipeline c-files ) diff --git a/dev/ci/ci-fiat-parsers.sh b/dev/ci/ci-fiat-parsers.sh new file mode 100755 index 00000000..ac74ebf6 --- /dev/null +++ b/dev/ci/ci-fiat-parsers.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +FORCE_GIT=1 +git_download fiat_parsers + +( cd "${CI_BUILD_DIR}/fiat_parsers" && make parsers parsers-examples && make fiat-core ) diff --git a/dev/ci/ci-flocq.sh b/dev/ci/ci-flocq.sh new file mode 100755 index 00000000..e87483df --- /dev/null +++ b/dev/ci/ci-flocq.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +git_download Flocq + +( cd "${CI_BUILD_DIR}/Flocq" && ./autogen.sh && ./configure && ./remake "-j${NJOBS}" ) diff --git a/dev/ci/ci-formal-topology.sh b/dev/ci/ci-formal-topology.sh new file mode 100755 index 00000000..8be5a06e --- /dev/null +++ b/dev/ci/ci-formal-topology.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +git_download formal_topology + +( cd "${CI_BUILD_DIR}/formal_topology" && make ) diff --git a/dev/ci/ci-geocoq.sh b/dev/ci/ci-geocoq.sh new file mode 100755 index 00000000..8c573184 --- /dev/null +++ b/dev/ci/ci-geocoq.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +install_ssralg + +git_download GeoCoq + +( cd "${CI_BUILD_DIR}/GeoCoq" && ./configure.sh && make ) diff --git a/dev/ci/ci-hott.sh b/dev/ci/ci-hott.sh new file mode 100755 index 00000000..9a0726a1 --- /dev/null +++ b/dev/ci/ci-hott.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +git_download HoTT + +( cd "${CI_BUILD_DIR}/HoTT" && ./autogen.sh && ./configure && make ) diff --git a/dev/ci/ci-iris-lambda-rust.sh b/dev/ci/ci-iris-lambda-rust.sh new file mode 100755 index 00000000..6960a8b9 --- /dev/null +++ b/dev/ci/ci-iris-lambda-rust.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +install_ssreflect + +# Setup lambdaRust first +git_download lambdaRust + +# Extract required version of Iris +Iris_REF=$(grep -F coq-iris < "${CI_BUILD_DIR}/lambdaRust/opam" | sed 's/.*"dev\.[0-9.-]\+\.\([0-9a-z]\+\)".*/\1/') + +# Setup Iris +git_download Iris + +# Extract required version of std++ +stdpp_REF=$(grep -F coq-stdpp < "${CI_BUILD_DIR}/Iris/opam" | sed 's/.*"dev\.[0-9.-]\+\.\([0-9a-z]\+\)".*/\1/') + +# Setup std++ +git_download stdpp + +# Build std++ +( cd "${CI_BUILD_DIR}/stdpp" && make && make install ) + +# Build and validate Iris +( cd "${CI_BUILD_DIR}/Iris" && make && make validate && make install ) + +# Build lambdaRust +( cd "${CI_BUILD_DIR}/lambdaRust" && make && make install ) diff --git a/dev/ci/ci-ltac2.sh b/dev/ci/ci-ltac2.sh new file mode 100755 index 00000000..4df22bf2 --- /dev/null +++ b/dev/ci/ci-ltac2.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +git_download ltac2 + +( cd "${CI_BUILD_DIR}/ltac2" && make && make tests && make install ) diff --git a/dev/ci/ci-math-classes.sh b/dev/ci/ci-math-classes.sh new file mode 100755 index 00000000..ae31a8e7 --- /dev/null +++ b/dev/ci/ci-math-classes.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +git_download math_classes + +( cd "${CI_BUILD_DIR}/math_classes" && ./configure.sh && make && make install ) diff --git a/dev/ci/ci-math-comp.sh b/dev/ci/ci-math-comp.sh new file mode 100755 index 00000000..74f1a627 --- /dev/null +++ b/dev/ci/ci-math-comp.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +git_download mathcomp + +( cd "${CI_BUILD_DIR}/mathcomp/mathcomp" && make && make install ) + +git_download oddorder + +( cd "${CI_BUILD_DIR}/oddorder" && make ) diff --git a/dev/ci/ci-mtac2.sh b/dev/ci/ci-mtac2.sh new file mode 100755 index 00000000..7075d4d7 --- /dev/null +++ b/dev/ci/ci-mtac2.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +git_download unicoq + +( cd "${CI_BUILD_DIR}/unicoq" && coq_makefile -f Make -o Makefile && make && make install ) + +git_download mtac2 + +( cd "${CI_BUILD_DIR}/mtac2" && coq_makefile -f _CoqProject -o Makefile && make ) diff --git a/dev/ci/ci-quickchick.sh b/dev/ci/ci-quickchick.sh new file mode 100755 index 00000000..08686d7c --- /dev/null +++ b/dev/ci/ci-quickchick.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +install_ssreflect + +git_download quickchick + +( cd "${CI_BUILD_DIR}/quickchick" && make && make install) diff --git a/dev/ci/ci-sf.sh b/dev/ci/ci-sf.sh new file mode 100755 index 00000000..58bbb722 --- /dev/null +++ b/dev/ci/ci-sf.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +mkdir -p "${CI_BUILD_DIR}" && cd "${CI_BUILD_DIR}" || exit 1 +wget -qO- "${sf_lf_CI_TARURL}" | tar xvz +wget -qO- "${sf_plf_CI_TARURL}" | tar xvz +wget -qO- "${sf_vfa_CI_TARURL}" | tar xvz + +sed -i.bak '1i From Coq Require Extraction.' lf/Extraction.v +sed -i.bak '1i From Coq Require Extraction.' vfa/Extract.v + +( cd lf && make clean && make ) + +( cd plf && sed -i.bak 's/(K,N)/((K,N))/' LibTactics.v && make clean && make ) + +( cd vfa && make clean && make ) diff --git a/dev/ci/ci-simple-io.sh b/dev/ci/ci-simple-io.sh new file mode 100755 index 00000000..ddc1590d --- /dev/null +++ b/dev/ci/ci-simple-io.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" + +. "${ci_dir}/ci-common.sh" + +git_download simple_io + +( cd "${CI_BUILD_DIR}/simple_io" && make build && make install) diff --git a/dev/ci/ci-tlc.sh b/dev/ci/ci-tlc.sh new file mode 100755 index 00000000..a2f0bea5 --- /dev/null +++ b/dev/ci/ci-tlc.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +FORCE_GIT=1 +git_download tlc + +( cd "${CI_BUILD_DIR}/tlc" && make ) diff --git a/dev/ci/ci-unimath.sh b/dev/ci/ci-unimath.sh new file mode 100755 index 00000000..a7644fee --- /dev/null +++ b/dev/ci/ci-unimath.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +git_download UniMath + +( cd "${CI_BUILD_DIR}/UniMath" && make BUILD_COQ=no ) diff --git a/dev/ci/ci-vst.sh b/dev/ci/ci-vst.sh new file mode 100755 index 00000000..0fec1920 --- /dev/null +++ b/dev/ci/ci-vst.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +ci_dir="$(dirname "$0")" +. "${ci_dir}/ci-common.sh" + +git_download VST + +( cd "${CI_BUILD_DIR}/VST" && make IGNORECOQVERSION=true ) diff --git a/dev/ci/ci-wrapper.sh b/dev/ci/ci-wrapper.sh new file mode 100755 index 00000000..12a70176 --- /dev/null +++ b/dev/ci/ci-wrapper.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Use this script to preserve the exit code of $CI_SCRIPT when piping +# it to `tee time-of-build.log`. We have a separate script, because +# this only works in bash, which we don't require project-wide. + +set -eo pipefail + +function travis_fold { + if [ -n "${TRAVIS}" ]; + then + echo "travis_fold:$1:$2" + fi +} + +CI_NAME="$1" +CI_SCRIPT="ci-${CI_NAME}.sh" + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# assume this script is in dev/ci/, cd to the root Coq directory +cd "${DIR}/../.." + +export TIMED=1 +"${DIR}/${CI_SCRIPT}" 2>&1 | tee time-of-build.log +travis_fold 'start' 'coq.test.timing' && echo 'Aggregating timing log...' +python ./tools/make-one-time-file.py time-of-build.log +travis_fold 'end' 'coq.test.timing' diff --git a/dev/ci/docker/bionic_coq/Dockerfile b/dev/ci/docker/bionic_coq/Dockerfile new file mode 100644 index 00000000..da12f122 --- /dev/null +++ b/dev/ci/docker/bionic_coq/Dockerfile @@ -0,0 +1,59 @@ +# CACHEKEY: "bionic_coq-v8.8-V2018-09-20" +# ^^ Update when modifying this file. + +FROM ubuntu:bionic +LABEL maintainer="e@x80.org" + +ENV DEBIAN_FRONTEND="noninteractive" + +RUN apt-get update -qq && apt-get install --no-install-recommends -y -qq \ + # Dependencies of the image, the test-suite and external projects + m4 automake autoconf time wget rsync git gcc-multilib opam \ + # Dependencies of lablgtk (for CoqIDE) + libgtk2.0-dev libgtksourceview2.0-dev \ + texlive-latex-extra texlive-fonts-recommended texlive-xetex latexmk xindy texlive-science tipa hevea \ + python3-sphinx python3-pexpect python3-sphinx-rtd-theme python3-bs4 python3-sphinxcontrib.bibtex \ + python3-setuptools python3-wheel python3-pip + +RUN pip3 install antlr4-python3-runtime + +# Basic OPAM setup +ENV NJOBS="2" \ + OPAMROOT=/root/.opamcache \ + OPAMROOTISOK="true" + +# Base opam is the set of base packages required by Coq +ENV COMPILER="4.02.3" + +RUN opam init -a -y -j $NJOBS --compiler="$COMPILER" default https://opam.ocaml.org && eval $(opam config env) && opam update + +# Common OPAM packages. +# `num` does not have a version number as the right version to install varies +# with the compiler version. +ENV BASE_OPAM="num ocamlfind.1.8.0" \ + CI_OPAM="menhir.20180530 ppx_tools_versioned.5.2 ppx_deriving.4.1.5 ocaml-migrate-parsetree.1.0.11 ocamlgraph.1.8.8" + +# BASE switch; CI_OPAM contains Coq's CI dependencies. +ENV CAMLP5_VER="6.14" \ + COQIDE_OPAM="lablgtk.2.18.5 conf-gtksourceview.2" + +RUN opam switch -y -j $NJOBS "$COMPILER" && eval $(opam config env) && \ + opam install -j $NJOBS $BASE_OPAM && \ + opam install -j $NJOBS camlp5.$CAMLP5_VER $COQIDE_OPAM $CI_OPAM + +# base+32bit switch +RUN opam switch -y -j $NJOBS "${COMPILER}+32bit" && eval $(opam config env) && \ + opam install -j $NJOBS $BASE_OPAM camlp5.$CAMLP5_VER + +# EDGE switch +ENV COMPILER_EDGE="4.07.0" \ + CAMLP5_VER_EDGE="7.06" \ + COQIDE_OPAM_EDGE="lablgtk.2.18.6 conf-gtksourceview.2" + +RUN opam switch -y -j $NJOBS $COMPILER_EDGE && eval $(opam config env) && \ + opam install -j $NJOBS $BASE_OPAM camlp5.$CAMLP5_VER_EDGE $COQIDE_OPAM_EDGE + +# BE+flambda switch +RUN opam switch -y -j $NJOBS "${COMPILER_EDGE}+flambda" && eval $(opam config env) && \ + opam install -j $NJOBS $BASE_OPAM && \ + opam install -j $NJOBS camlp5.$CAMLP5_VER_EDGE $COQIDE_OPAM_EDGE $CI_OPAM diff --git a/dev/ci/gitlab.bat b/dev/ci/gitlab.bat new file mode 100755 index 00000000..ee1b17b6 --- /dev/null +++ b/dev/ci/gitlab.bat @@ -0,0 +1,131 @@ +@ECHO OFF + +REM This script builds and signs the Windows packages on Gitlab + +ECHO "Start Time" +TIME /T + +REM List currently used cygwin and target folders for debugging / maintenance purposes + +ECHO "Currently used cygwin folders" +DIR C:\cygwin* +ECHO "Currently used target folders" +DIR C:\coq* + +if %ARCH% == 32 ( + SET ARCHLONG=i686 + SET CYGROOT=C:\cygwin + SET SETUP=setup-x86.exe +) + +if %ARCH% == 64 ( + SET ARCHLONG=x86_64 + SET CYGROOT=C:\cygwin64 + SET SETUP=setup-x86_64.exe +) + +SET DESTCOQ=C:\coq%ARCH%_inst + +CALL :MakeUniqueFolder %CYGROOT% CYGROOT +CALL :MakeUniqueFolder %DESTCOQ% DESTCOQ + +powershell -Command "(New-Object Net.WebClient).DownloadFile('http://www.cygwin.com/%SETUP%', '%SETUP%')" +SET CYGCACHE=%CYGROOT%\var\cache\setup +SET CI_PROJECT_DIR_MFMT=%CI_PROJECT_DIR:\=/% +SET CI_PROJECT_DIR_CFMT=%CI_PROJECT_DIR_MFMT:C:/=/cygdrive/c/% +SET COQREGTESTING=Y +SET PATH=%PATH%;C:\Program Files\7-Zip\;C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin + +if exist %CYGROOT%\build\ rd /s /q %CYGROOT%\build +if exist %DESTCOQ%\ rd /s /q %DESTCOQ% + +call %CI_PROJECT_DIR%\dev\build\windows\MakeCoq_MinGW.bat -threads=1 ^ + -arch=%ARCH% -installer=Y -coqver=%CI_PROJECT_DIR_CFMT% ^ + -destcyg=%CYGROOT% -destcoq=%DESTCOQ% -cygcache=%CYGCACHE% ^ + -addon=bignums ^ + -addon=equations ^ + -addon=ltac2 ^ + -addon=mtac2 ^ + -addon=mathcomp ^ + -addon=menhir ^ + -addon=menhirlib ^ + -addon=compcert ^ + -addon=vst ^ + -addon=aactactics ^ + -addon=extlib ^ + -addon=quickchick ^ + -addon=coquelicot ^ + -make=N ^ + -setup %CI_PROJECT_DIR%\%SETUP% || GOTO ErrorCopyLogFilesAndExit + +ECHO "Start Artifact Creation" +TIME /T + +mkdir artifacts + +CALL :CopyLogFiles + +copy "%CYGROOT%\build\coq-local\dev\nsis\*.exe" artifacts || GOTO ErrorExit +REM The open source archive is only required for release builds +IF DEFINED WIN_CERTIFICATE_PATH ( + 7z a artifacts\coq-opensource-archive-windows-%ARCHLONG%.zip %CYGROOT%\build\tarballs\* || GOTO ErrorExit +) ELSE ( + REM In non release builds, create a dummy file + ECHO "This is not a release build - open source archive not created / uploaded" > artifacts\coq-opensource-info.txt +) + +REM DO NOT echo the signing command below, as this would leak secrets in the logs +IF DEFINED WIN_CERTIFICATE_PATH ( + IF DEFINED WIN_CERTIFICATE_PASSWORD ( + ECHO Signing package + @signtool sign /f %WIN_CERTIFICATE_PATH% /p %WIN_CERTIFICATE_PASSWORD% dev\nsis\*.exe + signtool verify /pa dev\nsis\*.exe + ) +) + +ECHO "Finished Artifact Creation" +TIME /T + +CALL :CleanupFolders + +ECHO "Finished Cleanup" +TIME /T + +GOTO :EOF + +:CopyLogFiles + ECHO Copy log files for artifact upload + MKDIR artifacts\buildlogs + COPY %CYGROOT%\build\buildlogs\* artifacts\buildlogs + MKDIR artifacts\filelists + COPY %CYGROOT%\build\filelists\* artifacts\filelists + MKDIR artifacts\flagfiles + COPY %CYGROOT%\build\flagfiles\* artifacts\flagfiles + GOTO :EOF + +:CleanupFolders + ECHO "Cleaning %CYGROOT%" + DEL /S /F /Q "%CYGROOT%" > NUL + ECHO "Cleaning %DESTCOQ%" + DEL /S /F /Q "%DESTCOQ%" > NUL + GOTO :EOF + +:MakeUniqueFolder + REM Create a uniquely named folder + REM This script is safe because folder creation is atomic - either we create it or fail + REM %1 = base path or directory (_%RANDOM%_%RANDOM% is appended to this) + REM %2 = name of the variable which receives the unique folder name + SET "UNIQUENAME=%1_%RANDOM%_%RANDOM%" + MKDIR "%UNIQUENAME%" + IF ERRORLEVEL 1 GOTO :MakeUniqueFolder + SET "%2=%UNIQUENAME%" + GOTO :EOF + +:ErrorCopyLogFilesAndExit + CALL :CopyLogFiles + REM fall through + +:ErrorExit + CALL :CleanupFolders + ECHO ERROR %0 failed + EXIT /b 1 diff --git a/dev/ci/user-overlays/00669-maximedenes-ssr-merge.sh b/dev/ci/user-overlays/00669-maximedenes-ssr-merge.sh new file mode 100644 index 00000000..be0058b6 --- /dev/null +++ b/dev/ci/user-overlays/00669-maximedenes-ssr-merge.sh @@ -0,0 +1,4 @@ +if [ "$CI_PULL_REQUEST" = "669" ] || [ "$CI_BRANCH" = "ssr-merge" ]; then + mathcomp_CI_REF=ssr-merge + mathcomp_CI_GITURL=https://github.com/maximedenes/math-comp +fi diff --git a/dev/ci/user-overlays/README.md b/dev/ci/user-overlays/README.md new file mode 100644 index 00000000..b8628979 --- /dev/null +++ b/dev/ci/user-overlays/README.md @@ -0,0 +1,31 @@ +# Add overlays for your pull requests in this directory + +An overlay is a file containing very simple logic to test whether we are currently building a specific pull request or git branch (useful so that overlays work on your own fork) and which changes some of the variables whose default can be found in [`ci-basic-overlay.sh`](/dev/ci/ci-basic-overlay.sh). + +An overlay is a file which defines where to look for the patched version so that +testing is possible. It redefines some variables from +[`ci-basic-overlay.sh`](../ci-basic-overlay.sh): +give the name of your branch / commit using a `_CI_REF` variable and the +location of your fork using a `_CI_GITURL` variable. +The `_CI_GITURL` variable should be the URL of the repository without a +trailing `.git`. +If the fork is not on the same platform (e.g. GitHub instead of GitLab), it is +necessary to redefine the `_CI_ARCHIVEURL` variable as well. + +Moreover, the file contains very simple logic to test the pull request number +or branch name and apply it only in this case. + +The name of your overlay file should start with a five-digit pull request +number, followed by a dash, anything (for instance your GitHub nickname +and the branch name), then a `.sh` extension (`[0-9]{5}-[a-zA-Z0-9-_]+.sh`). + +Example: `00669-maximedenes-ssr-merge.sh` containing + +``` +if [ "$CI_PULL_REQUEST" = "669" ] || [ "$CI_BRANCH" = "ssr-merge" ]; then + mathcomp_CI_REF=ssr-merge + mathcomp_CI_GITURL=https://github.com/maximedenes/math-comp +fi +``` + +(`CI_PULL_REQUEST` and `CI_BRANCH` are set in [`ci-common.sh`](/dev/ci/ci-common.sh)) diff --git a/dev/core.dbg b/dev/core.dbg new file mode 100644 index 00000000..57c13690 --- /dev/null +++ b/dev/core.dbg @@ -0,0 +1,20 @@ +source camlp5.dbg +load_printer threads.cma +load_printer str.cma +load_printer clib.cma +load_printer lib.cma +load_printer dynlink.cma +load_printer kernel.cma +load_printer library.cma +load_printer engine.cma +load_printer pretyping.cma +load_printer interp.cma +load_printer proofs.cma +load_printer parsing.cma +load_printer printing.cma +load_printer tactics.cma +load_printer vernac.cma +load_printer stm.cma +load_printer toplevel.cma +load_printer intf.cma +load_printer ltac_plugin.cmo diff --git a/dev/db b/dev/db index f226291d..2f8c1348 100644 --- a/dev/db +++ b/dev/db @@ -1,60 +1,88 @@ -load_printer "printers.cma" +source core.dbg +load_printer top_printers.cmo +install_printer Top_printers.pP install_printer Top_printers.ppfuture - install_printer Top_printers.ppid -install_printer Top_printers.ppidset -install_printer Top_printers.ppevar -install_printer Top_printers.ppevarsubst -install_printer Top_printers.ppexistentialfilter -install_printer Top_printers.ppexistentialset -install_printer Top_printers.ppintset install_printer Top_printers.pplab -install_printer Top_printers.ppdir install_printer Top_printers.ppmbid +install_printer Top_printers.ppdir install_printer Top_printers.ppmp -install_printer Top_printers.ppkn install_printer Top_printers.ppcon -install_printer Top_printers.ppwf_paths +install_printer Top_printers.ppproj +install_printer Top_printers.ppkn install_printer Top_printers.ppmind +install_printer Top_printers.ppind install_printer Top_printers.ppsp install_printer Top_printers.ppqualid install_printer Top_printers.ppclindex -install_printer Top_printers.ppbigint -install_printer Top_printers.pp_transparent_state - -install_printer Top_printers.pppattern -install_printer Top_printers.ppglob_constr - +install_printer Top_printers.ppscheme +install_printer Top_printers.ppwf_paths +install_printer Top_printers.ppevar install_printer Top_printers.ppconstr -install_printer Top_printers.ppuni -install_printer Top_printers.ppuniverses -install_printer Top_printers.ppconstraints -install_printer Top_printers.pptype +install_printer Top_printers.ppsconstr +install_printer Top_printers.ppeconstr +install_printer Top_printers.ppconstr_expr +install_printer Top_printers.ppglob_constr +install_printer Top_printers.pppattern +install_printer Top_printers.ppfconstr +install_printer Top_printers.ppbigint +install_printer Top_printers.ppintset +install_printer Top_printers.ppidset +install_printer Top_printers.ppidmapgen +install_printer Top_printers.ppididmap +install_printer Top_printers.ppconstrunderbindersidmap +install_printer Top_printers.ppevarsubst +install_printer Top_printers.ppunbound_ltac_var_map +install_printer Top_printers.ppclosure +install_printer Top_printers.ppclosedglobconstr +install_printer Top_printers.ppclosedglobconstridmap +install_printer Top_printers.ppglobal +install_printer Top_printers.ppconst +install_printer Top_printers.ppvar install_printer Top_printers.ppj -install_printer Top_printers.ppenv -install_printer Top_printers.ppnamedcontextval +install_printer Top_printers.ppsubst +install_printer Top_printers.ppdelta +install_printer Top_printers.pp_idpred +install_printer Top_printers.pp_cpred +install_printer Top_printers.pp_transparent_state install_printer Top_printers.pp_stack_t install_printer Top_printers.pp_cst_stack_t - +install_printer Top_printers.pp_state_t install_printer Top_printers.ppmetas install_printer Top_printers.ppevm +install_printer Top_printers.ppexistentialset +install_printer Top_printers.ppexistentialfilter +install_printer Top_printers.ppclenv install_printer Top_printers.ppgoalgoal install_printer Top_printers.ppgoal -install_printer Top_printers.ppproofview install_printer Top_printers.pphintdb - +install_printer Top_printers.ppproofview +install_printer Top_printers.ppopenconstr +install_printer Top_printers.pproof +install_printer Top_printers.ppuni +install_printer Top_printers.ppuni_level +install_printer Top_printers.ppuniverse_set +install_printer Top_printers.ppuniverse_instance +install_printer Top_printers.ppuniverse_context +install_printer Top_printers.ppuniverse_context_set +install_printer Top_printers.ppuniverse_subst +install_printer Top_printers.ppuniverse_opt_subst +install_printer Top_printers.ppuniverse_level_subst +install_printer Top_printers.ppevar_universe_context +install_printer Top_printers.ppconstraints +install_printer Top_printers.ppuniverseconstraints +install_printer Top_printers.ppuniverse_context_future +install_printer Top_printers.ppcumulativity_info +install_printer Top_printers.ppabstract_cumulativity_info +install_printer Top_printers.ppuniverses +install_printer Top_printers.ppnamedcontextval +install_printer Top_printers.ppenv install_printer Top_printers.pptac install_printer Top_printers.ppobj install_printer Top_printers.pploc -install_printer Top_printers.prsubst -install_printer Top_printers.prdelta -install_printer Top_printers.ppfconstr +install_printer Top_printers.pp_argument_type +install_printer Top_printers.pp_generic_argument install_printer Top_printers.ppgenarginfo install_printer Top_printers.ppgenargargt install_printer Top_printers.ppist -install_printer Top_printers.ppconstrunderbindersidmap -install_printer Top_printers.ppunbound_ltac_var_map -install_printer Top_printers.ppididmap -install_printer Top_printers.ppclosure -install_printer Top_printers.ppclosedglobconstr diff --git a/dev/db_printers.ml b/dev/db_printers.ml deleted file mode 100644 index 50059508..00000000 --- a/dev/db_printers.ml +++ /dev/null @@ -1,16 +0,0 @@ -(************************************************************************) -(* v * The Coq Proof Assistant / The Coq Development Team *) -(* list A]) or + [apply (list _)] will result in a polymorphic instance. + +- The type inference algorithm now takes opacity of constants into + account. This may have effects on tactics using type inference + (e.g. induction). Extra "Transparent" might have to be added to + revert opacity of constants. + +Type classes. + +- When writing an Instance foo : Class A := {| proj := t |} (note the + vertical bars), support for typechecking the projections using the + type information and switching to proof mode is no longer available. + Use { } (without the vertical bars) instead. + +Tactic abstract. + +- Auxiliary lemmas generated by the abstract tactic are removed from + the global environment and inlined in the proof term when a proof + is ended with Qed. The behavior of 8.4 can be obtained by ending + proofs with "Qed exporting" or "Qed exporting ident, .., ident". + +Potential sources of incompatibilities between Coq V8.3 and V8.4 +---------------------------------------------------------------- + +(see also file CHANGES) + +The main known incompatibilities between 8.3 and 8.4 are consequences +of the following changes: + +- The reorganization of the library of numbers: + + Several definitions have new names or are defined in modules of + different names, but a special care has been taken to have this + renaming transparent for the user thanks to compatibility notations. + + However some definitions have changed, what might require some + adaptations. The most noticeable examples are: + - The "?=" notation which now bind to Pos.compare rather than former + Pcompare (now Pos.compare_cont). + - Changes in names may induce different automatically generated + names in proof scripts (e.g. when issuing "destruct Z_le_gt_dec"). + - Z.add has a new definition, hence, applying "simpl" on subterms of + its body might give different results than before. + - BigN.shiftl and BigN.shiftr have reversed arguments order, the + power function in BigN now takes two BigN. + +- Other changes in libraries: + + - The definition of functions over "vectors" (list of fixed length) + have changed. + - TheoryList.v has been removed. + +- Slight changes in tactics: + + - Less unfolding of fixpoints when applying destruct or inversion on + a fixpoint hiding an inductive type (add an extra call to simpl to + preserve compatibility). + - Less unexpected local definitions when applying "destruct" + (incompatibilities solvable by adapting name hypotheses). + - Tactic "apply" might succeed more often, e.g. by now solving + pattern-matching of the form ?f x y = g(x,y) (compatibility + ensured by using "Unset Tactic Pattern Unification"), but also + because it supports (full) betaiota (using "simple apply" might + then help). + - Tactic autorewrite does no longer instantiate pre-existing + existential variables. + - Tactic "info" is now available only for auto, eauto and trivial. + +- Miscellaneous changes: + + - The command "Load" is now atomic for backtracking (use "Unset + Atomic Load" for compatibility). + + +Incompatibilities beyond 8.4... + +- Syntax: "x -> y" has now lower priority than "<->" "A -> B <-> C" is + now "A -> (B <-> C)" + +- Tactics: tauto and intuition no longer accidentally destruct binary + connectives or records other than and, or, prod, sum, iff. In most + of cases, dtauto or dintuition, though stronger than 8.3 tauto and + 8.3 intuition will provide compatibility. + +- "Solve Obligations using" is now "Solve Obligations with". diff --git a/dev/doc/build-system.dev.txt b/dev/doc/build-system.dev.txt index fefcb093..abba1342 100644 --- a/dev/doc/build-system.dev.txt +++ b/dev/doc/build-system.dev.txt @@ -46,7 +46,7 @@ see build-system.txt . .ml4 files ---------- -.ml4 are converted to .ml by camlp4. By default, they are produced +.ml4 are converted to .ml by camlp5. By default, they are produced in the binary ast format understood by ocamlc/ocamlopt/ocamldep. Pros: - faster than parsing clear-text source file. @@ -74,25 +74,25 @@ The Makefile is separated in several files : - Makefile.doc : specific rules for compiling the documentation. -FIND_VCS_CLAUSE +FIND_SKIP_DIRS --------------- -The recommended style of using FIND_VCS_CLAUSE is for example +The recommended style of using FIND_SKIP_DIRS is for example - find . $(FIND_VCS_CLAUSE) '(' -name '*.example' ')' -print - find . $(FIND_VCS_CLAUSE) '(' -name '*.example' -or -name '*.foo' ')' -print + find . $(FIND_SKIP_DIRS) '(' -name '*.example' ')' -print + find . $(FIND_SKIP_DIRS) '(' -name '*.example' -or -name '*.foo' ')' -print 1) The parentheses even in the one-criteria case is so that if one adds other conditions, e.g. change the first example to the second - find . $(FIND_VCS_CLAUSE) '(' -name '*.example' -and -not -name '*.bak.example' ')' -print + find . $(FIND_SKIP_DIRS) '(' -name '*.example' -and -not -name '*.bak.example' ')' -print one is not tempted to write - find . $(FIND_VCS_CLAUSE) -name '*.example' -and -not -name '*.bak.example' -print + find . $(FIND_SKIP_DIRS) -name '*.example' -and -not -name '*.bak.example' -print -because this will not necessarily work as expected; $(FIND_VCS_CLAUSE) +because this will not necessarily work as expected; $(FIND_SKIP_DIRS) ends with an -or, and how it combines with what comes later depends on operator precedence and all that. Much safer to override it with parentheses. @@ -105,13 +105,13 @@ As to the -print at the end, yes it is necessary. Here's why. You are used to write: find . -name '*.example' and it works fine. But the following will not: - find . $(FIND_VCS_CLAUSE) -name '*.example' -it will also list things directly matched by FIND_VCS_CLAUSE + find . $(FIND_SKIP_DIRS) -name '*.example' +it will also list things directly matched by FIND_SKIP_DIRS (directories we want to prune, in which we don't want to find anything). C'est subtil... Il y a effectivement un -print implicite à la fin, qui fait que la commande habituelle sans print fonctionne bien, mais dès que l'on introduit d'autres commandes dans le lot (le --prune de FIND_VCS_CLAUSE), ça se corse à cause d'histoires de +-prune de FIND_SKIP_DIRS), ça se corse à cause d'histoires de parenthèses du -print implicite par rapport au parenthésage dans la forme recommandée d'utilisation: diff --git a/dev/doc/build-system.txt b/dev/doc/build-system.txt index 873adc1b..fd310161 100644 --- a/dev/doc/build-system.txt +++ b/dev/doc/build-system.txt @@ -88,7 +88,7 @@ bootstrapped. The dependencies of a file FOO are in FOO.d . This enables partial recalculation of dependencies (only the dependencies of changed files are recomputed). -If you add a dependency to a Coq camlp4 extension (grammar.cma or +If you add a dependency to a Coq camlp5 extension (grammar.cma or q_constr.cmo), then see sections ".ml4 files" and "new files". Cleaning Targets @@ -127,7 +127,7 @@ of a grammar extension via a line of the form: The use of (*i camlp4use: ... i*) to mention uses of standard extension such as IFDEF has also been discontinued, the Makefile now -always calls camlp4 with pa_macros.cmo and a few others by default. +always calls camlp5 with pa_macros.cmo and a few others by default. For debugging a Coq grammar extension, it could be interesting to use the READABLE_ML4=1 option, otherwise the generated .ml are @@ -143,7 +143,9 @@ file list(s): These files are also used by the experimental ocamlbuild plugin, which is quite touchy about them : be careful with order, duplicated entries, whitespace errors, and do not mention .mli there. - - For .v, in the corresponding vo.itarget (e.g theories/Init/vo.itarget) + If module B depends on module A, then B should be after A in the .mllib + file. +- For .v, in the corresponding vo.itarget (e.g theories/Init/vo.itarget) - The definitions in Makefile.common might have to be adapted too. - If your file needs a specific rule, add it to Makefile.build diff --git a/dev/doc/changes.md b/dev/doc/changes.md new file mode 100644 index 00000000..ab78b095 --- /dev/null +++ b/dev/doc/changes.md @@ -0,0 +1,1316 @@ +## Changes between Coq 8.7 and Coq 8.8 + +### Bug tracker + +As of 18/10/2017, Coq uses [GitHub issues](https://github.com/coq/coq/issues) +as bug tracker. +Old bug reports were migrated from Bugzilla to GitHub issues using +[this migration script](https://gist.github.com/Zimmi48/d923e52f64fe17c72852d9c148bfcdc6#file-bugzilla2github) +as detailed in [this blog post](https://www.theozimmermann.net/2017/10/bugzilla-to-github/). + +All the bugs with a number below 1154 had to be renumbered, you can find +a correspondence table [here](/dev/bugzilla2github_stripped.csv). +All the other bugs kept their number. + +### ML API + +General deprecation + +- All functions marked [@@ocaml.deprecated] in 8.7 have been + removed. Please, make sure your plugin is warning-free in 8.7 before + trying to port it over 8.8. + +Proof engine + + Due to the introduction of `EConstr` in 8.7, it is not necessary to + track "goal evar normal form status" anymore, thus the type `'a + Proofview.Goal.t` loses its ghost argument. This may introduce some + minor incompatibilities at the typing level. Code-wise, things + should remain the same. + +We removed the following functions: + +- `Universes.unsafe_constr_of_global`: use `Global.constr_of_global_in_context` + instead. The returned term contains De Bruijn universe variables. If you don't + depend on universes being instantiated, simply drop the context. + +- `Universes.unsafe_type_of_global`: same as above with + `Global.type_of_global_in_context` + +We changed the type of the following functions: + +- `Global.body_of_constant_body`: now also returns the abstract universe context. + The returned term contains De Bruijn universe variables. + +- `Global.body_of_constant`: same as above. + +- `Constrinterp.*` generally, many functions that used to take an + `evar_map ref` have been now switched to functions that will work in + a functional way. The old style of passing `evar_map`s as references + is not supported anymore. + +Changes in the abstract syntax tree: + +- The practical totality of the AST has been nodified using + `CAst.t`. This means that all objects coming from parsing will be + indeed wrapped in a `CAst.t`. `Loc.located` is on its way to + deprecation. Some minor interfaces changes have resulted from + this. + +We have changed the representation of the following types: + +- `Lib.object_prefix` is now a record instead of a nested tuple. + +Some tactics and related functions now support static configurability, e.g.: + +- injectable, dEq, etc. takes an argument ~keep_proofs which, + - if None, tells to behave as told with the flag Keep Proof Equalities + - if Some b, tells to keep proof equalities iff b is true + +Declaration of printers for arguments used only in vernac command + +- It should now use "declare_extra_vernac_genarg_pprule" rather than + "declare_extra_genarg_pprule", otherwise, a failure at runtime might + happen. An alternative is to register the corresponding argument as + a value, using "Geninterp.register_val0 wit None". + +### STM API + +The STM API has seen a general overhaul. The main change is the +introduction of a "Coq document" type, which all operations now take +as a parameter. This effectively functionalize the STM API and will +allow in the future to handle several documents simultaneously. + +The main remarkable point is that key implicit global parameters such +as load-paths and required modules are now arguments to the document +creation function. This helps enforcing some key invariants. + +### XML IDE Protocol + +- Before 8.8, `Query` only executed the first command present in the + `query` string; starting with 8.8, the caller may include several + statements. This is useful for instance for temporarily setting an + option and then executing a command. + +## Changes between Coq 8.6 and Coq 8.7 + +### Ocaml + +Coq is compiled with `-safe-string` enabled and requires plugins to do +the same. This means that code using `String` in an imperative way +will fail to compile now. They should switch to `Bytes.t` + +Configure supports passing flambda options, use `-flambda-opts OPTS` +with a flambda-enabled Ocaml to tweak the compilation to your taste. + +### ML API + +- Added two functions for declaring hooks to be executed in reduction +functions when some given constants are traversed: + + * `declare_reduction_effect`: to declare a hook to be applied when some + constant are visited during the execution of some reduction functions + (primarily cbv). + + * `set_reduction_effect`: to declare a constant on which a given effect + hook should be called. + +- We renamed the following functions: + + ``` + Context.Rel.Declaration.fold -> Context.Rel.Declaration.fold_constr + Context.Named.Declaration.fold -> Context.Named.Declaration.fold_constr + Printer.pr_var_list_decl -> Printer.pr_compacted_decl + Printer.pr_var_decl -> Printer.pr_named_decl + Nameops.lift_subscript -> Nameops.increment_subscript + ``` + +- We removed the following functions: + + * `Termops.compact_named_context_reverse`: practical substitute is `Termops.compact_named_context`. + * `Namegen.to_avoid`: equivalent substitute is `Names.Id.List.mem`. + +- We renamed the following modules: + + * `Context.ListNamed` -> `Context.Compacted` + +- The following type aliases where removed + + * `Context.section_context`: it was just an alias for `Context.Named.t` which is still available. + +- The module `Constrarg` was merged into `Stdarg`. + +- The following types have been moved and modified: + + * `local_binder` -> `local_binder_expr` + * `glob_binder` merged with `glob_decl` + +- The following constructors have been renamed: + + ``` + LocalRawDef -> CLocalDef + LocalRawAssum -> CLocalAssum + LocalPattern -> CLocalPattern + ``` + +- In `Constrexpr_ops`: + + Deprecating `abstract_constr_expr` in favor of `mkCLambdaN`, and + `prod_constr_expr` in favor of `mkCProdN`. Note: the first ones were + interpreting `(x y z:_)` as `(x:_) (y:_) (z:_)` while the second + ones were preserving the original sharing of the type. + +- In `Nameops`: + + The API has been made more uniform. New combinators added in the + `Name` space name. Function `out_name` now fails with `IsAnonymous` + rather than with `Failure "Nameops.out_name"`. + +- Location handling and AST attributes: + + Location handling has been reworked. First, `Loc.ghost` has been + removed in favor of an option type, all objects carrying an optional + source code location have been switched to use `Loc.t option`. + + Storage of location information has been also refactored. The main + datatypes representing Coq AST (`constrexpr`, `glob_expr`) have been + switched to a generic "node with attributes" representation `'a + CAst.ast`, which is a record of the form: + + ```ocaml + type 'a ast = private { + v : 'a; + loc : Loc.t option; + ... + } + ``` + consumers of AST nodes are recommended to use accessor-based pattern + matching `{ v; loc }` to destruct `ast` object. Creation is done + with `CAst.make ?loc obj`, where the attributes are optional. Some + convenient combinators are provided in the module. A typical match: + + ```ocaml + | CCase(loc, a1) -> CCase(loc, f a1) + ``` + + is now done as: + ```ocaml + | { v = CCase(a1); loc } -> CAst.make ?loc @@ CCase(f a1) + + ``` + or even better, if plan to preserve the attributes you can wrap your + top-level function in `CAst.map` to have: + + ```ocaml + | CCase(a1) -> CCase(f a1) + ``` + + This scheme based on records enables easy extensibility of the AST + node type without breaking compatibility. + + Not all objects carrying a location have been converted to the + generic node representation, some of them may be converted in the + future, for some others the abstraction is not just worth it. + + Thus, we still maintain a `'a Loc.located == Loc.t option * a'`, + tuple type which should be treated as private datatype (ok to match + against, but forbidden to manually build), and it is mandatory to + use it for objects that carry a location. This policy has been + implemented in the whole code base. Matching a located object hasn't + changed, however, `Loc.tag ?loc obj` must be used to build one. + +- In `GOption`: + + Support for non-synchronous options has been removed. Now all + options are handled as a piece of normal document state, and thus + passed to workers, etc... As a consequence, the field + `Goptions.optsync` has been removed. + +- In `Coqlib` / reference location: + + We have removed from Coqlib functions returning `constr` from + names. Now it is only possible to obtain references, that must be + processed wrt the particular needs of the client. + We have changed in constrintern the functions returnin `constr` as + well to return global references instead. + + Users of `coq_constant/gen_constant` can do + `Universes.constr_of_global (find_reference dir r)` _however_ note + the warnings in the `Universes.constr_of_global` in the + documentation. It is very likely that you were previously suffering + from problems with polymorphic universes due to using + `Coqlib.coq_constant` that used to do this. You must rather use + `pf_constr_of_global` in tactics and `Evarutil.new_global` variants + when constructing terms in ML (see univpoly.txt for more information). + +### Tactic API + +- `pf_constr_of_global` now returns a tactic instead of taking a continuation. + Thus it only generates one instance of the global reference, and it is the + caller's responsibility to perform a focus on the goal. + +- `pf_global`, `construct_reference`, `global_reference`, + `global_reference_in_absolute_module` now return a `global_reference` + instead of a `constr`. + +- The `tclWEAK_PROGRESS` and `tclNOTSAMEGOAL` tacticals were removed. Their usecase + was very specific. Use `tclPROGRESS` instead. + +- New (internal) tactical `tclINDEPENDENTL` that combined with enter_one allows + to iterate a non-unit tactic on all goals and access their returned values. + +- The unsafe flag of the `Refine.refine` function and its variants has been + renamed and dualized into typecheck and has been made mandatory. + +### Ltac API + +Many Ltac specific API has been moved in its own ltac/ folder. Amongst other +important things: + +- `Pcoq.Tactic` -> `Pltac` +- `Constrarg.wit_tactic` -> `Tacarg.wit_tactic` +- `Constrarg.wit_ltac` -> `Tacarg.wit_ltac` +- API below `ltac/` that accepted a *`_tactic_expr` now accept a *`_generic_argument` + instead +- Some printing functions were moved from `Pptactic` to `Pputils` +- A part of `Tacexpr` has been moved to `Tactypes` +- The `TacFun` tactic expression constructor now takes a `Name.t list` for the + variable list rather than an `Id.t option list`. + +The folder itself has been turned into a plugin. This does not change much, +but because it is a packed plugin, it may wreak havoc for third-party plugins +depending on any module defined in the `ltac/` directory. Namely, even if +everything looks OK at compile time, a plugin can fail to load at link time +because it mistakenly looks for a module `Foo` instead of `Ltac_plugin.Foo`, with +an error of the form: + +``` +Error: while loading myplugin.cmxs, no implementation available for Foo. +``` + +In particular, most `EXTEND` macros will trigger this problem even if they +seemingly do not use any Ltac module, as their expansion do. + +The solution is simple, and consists in adding a statement `open Ltac_plugin` +in each file using a Ltac module, before such a module is actually called. An +alternative solution would be to fully qualify Ltac modules, e.g. turning any +call to Tacinterp into `Ltac_plugin.Tacinterp`. Note that this solution does not +work for `EXTEND` macros though. + +### Additional changes in tactic extensions + +Entry `constr_with_bindings` has been renamed into +`open_constr_with_bindings`. New entry `constr_with_bindings` now +uses type classes and rejects terms with unresolved holes. + +### Error handling + +- All error functions now take an optional parameter `?loc:Loc.t`. For + functions that used to carry a suffix `_loc`, such suffix has been + dropped. + +- `errorlabstrm` and `error` has been removed in favor of `user_err`. + +- The header parameter to `user_err` has been made optional. + +### Pretty printing + +Some functions have been removed, see pretty printing below for more +details. + +#### Pretty Printing and XML protocol + +The type `std_cmdpps` has been reworked and made the canonical "Coq rich +document type". This allows for a more uniform handling of printing +(specially in IDEs). The main consequences are: + + - Richpp has been confined to IDE use. Most of previous uses of the + `richpp` type should be replaced now by `Pp.std_cmdpps`. Main API + has been updated. + + - The XML protocol will send a new message type of `pp`, which should + be rendered client-wise. + + - `Set Printing Width` is deprecated, now width is controlled + client-side. + + - `Pp_control` has removed. The new module `Topfmt` implements + console control for the toplevel. + + - The impure tag system in `Pp` has been removed. This also does away + with the printer signatures and functors. Now printers tag + unconditionally. + + - The following functions have been removed from `Pp`: + + ```ocaml + val stras : int * string -> std_ppcmds + val tbrk : int * int -> std_ppcmds + val tab : unit -> std_ppcmds + val pifb : unit -> std_ppcmds + val comment : int -> std_ppcmds + val comments : ((int * int) * string) list ref + val eval_ppcmds : std_ppcmds -> std_ppcmds + val is_empty : std_ppcmds -> bool + val t : std_ppcmds -> std_ppcmds + val hb : int -> std_ppcmds + val vb : int -> std_ppcmds + val hvb : int -> std_ppcmds + val hovb : int -> std_ppcmds + val tb : unit -> std_ppcmds + val close : unit -> std_ppcmds + val tclose : unit -> std_ppcmds + val open_tag : Tag.t -> std_ppcmds + val close_tag : unit -> std_ppcmds + val msg_with : ... + + module Tag + ``` + +### Stm API + +- We have streamlined the `Stm` API, now `add` and `query` take a + `coq_parsable` instead a `string` so clients can have more control + over their input stream. As a consequence, their types have been + modified. + +- The main parsing entry point has also been moved to the + `Stm`. Parsing is considered a synchronous operation so it will + either succeed or raise an exception. + +- `Feedback` is now only emitted for asynchronous operations. As a + consequence, it always carries a valid stateid and the type has + changed to accommodate that. + +- A few unused hooks were removed due to cleanups, no clients known. + +### Toplevel and Vernacular API + +- The components related to vernacular interpretation have been moved + to their own folder `vernac/` whereas toplevel now contains the + proper toplevel shell and compiler. + +- Coq's toplevel has been ported to directly use the common `Stm` + API. The signature of a few functions has changed as a result. + +### XML Protocol + +- The legacy `Interp` call has been turned into a noop. + +- The `query` call has been modified, now it carries a mandatory + `route_id` integer parameter, that associated the result of such + query with its generated feedback. + +## Changes between Coq 8.5 and Coq 8.6 + +### Parsing + +`Pcoq.parsable` now takes an extra optional filename argument so as to +bind locations to a file name when relevant. + +### Files + +To avoid clashes with OCaml's compiler libs, the following files were renamed: + +``` +kernel/closure.ml{,i} -> kernel/cClosure.ml{,i} +lib/errors.ml{,i} -> lib/cErrors.ml{,i} +toplevel/cerror.ml{,i} -> toplevel/explainErr.mli{,i} +``` + +All IDE-specific files, including the XML protocol have been moved to `ide/` + +### Reduction functions + +In `closure.ml`, we introduced the more precise reduction flags `fMATCH`, `fFIX`, +`fCOFIX`. + +We renamed the following functions: + +``` +Closure.betadeltaiota -> Closure.all +Closure.betadeltaiotanolet -> Closure.allnolet +Reductionops.beta -> Closure.beta +Reductionops.zeta -> Closure.zeta +Reductionops.betaiota -> Closure.betaiota +Reductionops.betaiotazeta -> Closure.betaiotazeta +Reductionops.delta -> Closure.delta +Reductionops.betalet -> Closure.betazeta +Reductionops.betadelta -> Closure.betadeltazeta +Reductionops.betadeltaiota -> Closure.all +Reductionops.betadeltaiotanolet -> Closure.allnolet +Closure.no_red -> Closure.nored +Reductionops.nored -> Closure.nored +Reductionops.nf_betadeltaiota -> Reductionops.nf_all +Reductionops.whd_betadelta -> Reductionops.whd_betadeltazeta +Reductionops.whd_betadeltaiota -> Reductionops.whd_all +Reductionops.whd_betadeltaiota_nolet -> Reductionops.whd_allnolet +Reductionops.whd_betadelta_stack -> Reductionops.whd_betadeltazeta_stack +Reductionops.whd_betadeltaiota_stack -> Reductionops.whd_all_stack +Reductionops.whd_betadeltaiota_nolet_stack -> Reductionops.whd_allnolet_stack +Reductionops.whd_betadelta_state -> Reductionops.whd_betadeltazeta_state +Reductionops.whd_betadeltaiota_state -> Reductionops.whd_all_state +Reductionops.whd_betadeltaiota_nolet_state -> Reductionops.whd_allnolet_state +Reductionops.whd_eta -> Reductionops.shrink_eta +Tacmach.pf_whd_betadeltaiota -> Tacmach.pf_whd_all +Tacmach.New.pf_whd_betadeltaiota -> Tacmach.New.pf_whd_all +``` + +And removed the following ones: + +``` +Reductionops.whd_betaetalet +Reductionops.whd_betaetalet_stack +Reductionops.whd_betaetalet_state +Reductionops.whd_betadeltaeta_stack +Reductionops.whd_betadeltaeta_state +Reductionops.whd_betadeltaeta +Reductionops.whd_betadeltaiotaeta_stack +Reductionops.whd_betadeltaiotaeta_state +Reductionops.whd_betadeltaiotaeta +``` + +In `intf/genredexpr.mli`, `fIota` was replaced by `FMatch`, `FFix` and +`FCofix`. Similarly, `rIota` was replaced by `rMatch`, `rFix` and `rCofix`. + +### Notation_ops + +Use `Glob_ops.glob_constr_eq` instead of `Notation_ops.eq_glob_constr`. + +### Logging and Pretty Printing + +* Printing functions have been removed from `Pp.mli`, which is now a + purely pretty-printing interface. Functions affected are: + +```` ocaml +val pp : std_ppcmds -> unit +val ppnl : std_ppcmds -> unit +val pperr : std_ppcmds -> unit +val pperrnl : std_ppcmds -> unit +val pperr_flush : unit -> unit +val pp_flush : unit -> unit +val flush_all : unit -> unit +val msg : std_ppcmds -> unit +val msgnl : std_ppcmds -> unit +val msgerr : std_ppcmds -> unit +val msgerrnl : std_ppcmds -> unit +val message : string -> unit +```` + + which are no more available. Users of `Pp.pp msg` should now use the + proper `Feedback.msg_*` function. Clients also have no control over + flushing, the back end takes care of it. + + Also, the `msg_*` functions now take an optional `?loc` parameter + for relaying location to the client. + +* Feedback related functions and definitions have been moved to the + `Feedback` module. `message_level` has been renamed to + level. Functions moved from `Pp` to `Feedback` are: + +```` ocaml +val set_logger : logger -> unit +val std_logger : logger +val emacs_logger : logger +val feedback_logger : logger +```` + +* Changes in the Feedback format/Protocol. + +- The `Message` feedback type now carries an optional location, the main + payload is encoded using the richpp document format. + +- The `ErrorMsg` feedback type is thus unified now with `Message` at + level `Error`. + +* We now provide several loggers, `log_via_feedback` is removed in + favor of `set_logger feedback_logger`. Output functions are: + +```` ocaml +val with_output_to_file : string -> ('a -> 'b) -> 'a -> 'b +val msg_error : ?loc:Loc.t -> Pp.std_ppcmds -> unit +val msg_warning : ?loc:Loc.t -> Pp.std_ppcmds -> unit +val msg_notice : ?loc:Loc.t -> Pp.std_ppcmds -> unit +val msg_info : ?loc:Loc.t -> Pp.std_ppcmds -> unit +val msg_debug : ?loc:Loc.t -> Pp.std_ppcmds -> unit +```` + + with the `msg_*` functions being just an alias for `logger $Level`. + +* The main feedback functions are: + +```` ocaml +val set_feeder : (feedback -> unit) -> unit +val feedback : ?id:edit_or_state_id -> ?route:route_id -> feedback_content -> unit +val set_id_for_feedback : ?route:route_id -> edit_or_state_id -> unit +```` + Note that `feedback` doesn't take two parameters anymore. After + refactoring the following function has been removed: + +```` ocaml +val get_id_for_feedback : unit -> edit_or_state_id * route_id +```` + +### Kernel API changes + +- The interface of the `Context` module was changed. + Related types and functions were put in separate submodules. + The mapping from old identifiers to new identifiers is the following: + + ``` + Context.named_declaration ---> Context.Named.Declaration.t + Context.named_list_declaration ---> Context.NamedList.Declaration.t + Context.rel_declaration ---> Context.Rel.Declaration.t + Context.map_named_declaration ---> Context.Named.Declaration.map_constr + Context.map_named_list_declaration ---> Context.NamedList.Declaration.map + Context.map_rel_declaration ---> Context.Rel.Declaration.map_constr + Context.fold_named_declaration ---> Context.Named.Declaration.fold + Context.fold_rel_declaration ---> Context.Rel.Declaration.fold + Context.exists_named_declaration ---> Context.Named.Declaration.exists + Context.exists_rel_declaration ---> Context.Rel.Declaration.exists + Context.for_all_named_declaration ---> Context.Named.Declaration.for_all + Context.for_all_rel_declaration ---> Context.Rel.Declaration.for_all + Context.eq_named_declaration ---> Context.Named.Declaration.equal + Context.eq_rel_declaration ---> Context.Rel.Declaration.equal + Context.named_context ---> Context.Named.t + Context.named_list_context ---> Context.NamedList.t + Context.rel_context ---> Context.Rel.t + Context.empty_named_context ---> Context.Named.empty + Context.add_named_decl ---> Context.Named.add + Context.vars_of_named_context ---> Context.Named.to_vars + Context.lookup_named ---> Context.Named.lookup + Context.named_context_length ---> Context.Named.length + Context.named_context_equal ---> Context.Named.equal + Context.fold_named_context ---> Context.Named.fold_outside + Context.fold_named_list_context ---> Context.NamedList.fold + Context.fold_named_context_reverse ---> Context.Named.fold_inside + Context.instance_from_named_context ---> Context.Named.to_instance + Context.extended_rel_list ---> Context.Rel.to_extended_list + Context.extended_rel_vect ---> Context.Rel.to_extended_vect + Context.fold_rel_context ---> Context.Rel.fold_outside + Context.fold_rel_context_reverse ---> Context.Rel.fold_inside + Context.map_rel_context ---> Context.Rel.map_constr + Context.map_named_context ---> Context.Named.map_constr + Context.iter_rel_context ---> Context.Rel.iter + Context.iter_named_context ---> Context.Named.iter + Context.empty_rel_context ---> Context.Rel.empty + Context.add_rel_decl ---> Context.Rel.add + Context.lookup_rel ---> Context.Rel.lookup + Context.rel_context_length ---> Context.Rel.length + Context.rel_context_nhyps ---> Context.Rel.nhyps + Context.rel_context_tags ---> Context.Rel.to_tags + ``` + +- Originally, rel-context was represented as: + + ```ocaml + type Context.rel_context = Names.Name.t * Constr.t option * Constr.t + ``` + + Now it is represented as: + + ```ocaml + type Context.Rel.Declaration.t = LocalAssum of Names.Name.t * Constr.t + | LocalDef of Names.Name.t * Constr.t * Constr.t + ``` + +- Originally, named-context was represented as: + + ```ocaml + type Context.named_context = Names.Id.t * Constr.t option * Constr.t + ``` + + Now it is represented as: + + ```ocaml + type Context.Named.Declaration.t = LocalAssum of Names.Id.t * Constr.t + | LocalDef of Names.Id.t * Constr.t * Constr.t + ``` + +- The various `EXTEND` macros do not handle specially the Coq-defined entries + anymore. Instead, they just output a name that have to exist in the scope + of the ML code. The parsing rules (`VERNAC`) `ARGUMENT EXTEND` will look for + variables `$name` of type `Gram.entry`, while the parsing rules of + (`VERNAC COMMAND` | `TACTIC`) `EXTEND`, as well as the various `TYPED AS` clauses will + look for variables `wit_$name` of type `Genarg.genarg_type`. The small DSL + for constructing compound entries still works over this scheme. Note that in + the case of (`VERNAC`) `ARGUMENT EXTEND`, the name of the argument entry is bound + in the parsing rules, so beware of recursive calls. + + For example, to get `wit_constr` you must `open Constrarg` at the top of the file. + +- `Evarutil` was split in two parts. The new `Evardefine` file exposes functions + `define_evar_`* mostly used internally in the unification engine. + +- The `Refine` module was moved out of `Proofview`. + + ``` + Proofview.Refine.* ---> Refine.* + ``` + +- A statically monotonic evarmap type was introduced in `Sigma`. Not all the API + has been converted, so that the user may want to use compatibility functions + `Sigma.to_evar_map` and `Sigma.Unsafe.of_evar_map` or `Sigma.Unsafe.of_pair` when + needed. Code can be straightforwardly adapted in the following way: + + ```ocaml + let (sigma, x1) = ... in + ... + let (sigma, xn) = ... in + (sigma, ans) + ``` + + should be turned into: + + ```ocaml + open Sigma.Notations + + let Sigma (x1, sigma, p1) = ... in + ... + let Sigma (xn, sigma, pn) = ... in + Sigma (ans, sigma, p1 +> ... +> pn) + ``` + + Examples of `Sigma.Unsafe.of_evar_map` include: + + ``` + Evarutil.new_evar env (Tacmach.project goal) ty ----> Evarutil.new_evar env (Sigma.Unsafe.of_evar_map (Tacmach.project goal)) ty + ``` + +- The `Proofview.Goal.`*`enter` family of functions now takes a polymorphic + continuation given as a record as an argument. + + ```ocaml + Proofview.Goal.enter begin fun gl -> ... end + ``` + + should be turned into + + ```ocaml + open Proofview.Notations + + Proofview.Goal.enter { enter = begin fun gl -> ... end } + ``` + +- `Tacexpr.TacDynamic(Loc.dummy_loc, Pretyping.constr_in c)` ---> `Tacinterp.Value.of_constr c` +- `Vernacexpr.HintsResolveEntry(priority, poly, hnf, path, atom)` ---> `Vernacexpr.HintsResolveEntry(Vernacexpr.({hint_priority = priority; hint_pattern = None}), poly, hnf, path, atom)` +- `Pretyping.Termops.mem_named_context` ---> `Engine.Termops.mem_named_context_val` +- `Global.named_context` ---> `Global.named_context_val` +- `Context.Named.lookup` ---> `Environ.lookup_named_val` + +### Search API + +The main search functions now take a function iterating over the +results. This allows for clients to use streaming or more economic +printing. + +### XML Protocol + +- In several places, flat text wrapped in `` tags now appears as structured text inside `` tags. + +- The "errormsg" feedback has been replaced by a "message" feedback which contains `` tag, with a message_level attribute of "error". + +## Changes between Coq 8.4 and Coq 8.5 + +### Refactoring : more mli interfaces and simpler grammar.cma + +- A new directory intf/ now contains mli-only interfaces : + + * `Constrexpr` : definition of `constr_expr`, was in `Topconstr` + * `Decl_kinds` : now contains `binding_kind = Explicit | Implicit` + * `Evar_kinds` : type `Evar_kinds.t` was previously `Evd.hole_kind` + * `Extend` : was `parsing/extend.mli` + * `Genredexpr` : regroup `Glob_term.red_expr_gen` and `Tacexpr.glob_red_flag` + * `Glob_term` : definition of `glob_constr` + * `Locus` : definition of occurrences and stuff about clauses + * `Misctypes` : `intro_pattern_expr`, `glob_sort`, `cast_type`, `or_var`, ... + * `Notation_term` : contains `notation_constr`, was `Topconstr.aconstr` + * `Pattern` : contains `constr_pattern` + * `Tacexpr` : was `tactics/tacexpr.ml` + * `Vernacexpr` : was `toplevel/vernacexpr.ml` + +- Many files have been divided : + + * vernacexpr: vernacexpr.mli + Locality + * decl_kinds: decl_kinds.mli + Kindops + * evd: evar_kinds.mli + evd + * tacexpr: tacexpr.mli + tacops + * glob_term: glob_term.mli + glob_ops + genredexpr.mli + redops + * topconstr: constrexpr.mli + constrexpr_ops + + notation_expr.mli + notation_ops + topconstr + * pattern: pattern.mli + patternops + * libnames: libnames (qualid, reference) + globnames (global_reference) + * egrammar: egramml + egramcoq + +- New utility files : miscops (cf. misctypes.mli) and + redops (cf genredexpr.mli). + +- Some other directory changes : + * grammar.cma and the source files specific to it are now in grammar/ + * pretty-printing files are now in printing/ + +- Inner-file changes : + + * aconstr is now notation_constr, all constructors for this type + now start with a N instead of a A (e.g. NApp instead of AApp), + and functions about aconstr may have been renamed (e.g. match_aconstr + is now match_notation_constr). + + * occurrences (now in Locus.mli) is now an algebraic type, with + - AllOccurrences instead of all_occurrences_expr = (false,[]) + - (AllOccurrencesBut l) instead of (all_occurrences_expr_but l) = (false,l) + - NoOccurrences instead of no_occurrences_expr = (true,[]) + - (OnlyOccurrences l) instead of (no_occurrences_expr_but l) = (true,l) + + * move_location (now in Misctypes) has two new constructors + MoveFirst and MoveLast replacing (MoveToEnd false) and (MoveToEnd true) + +- API of pretyping.ml and constrintern.ml has been made more uniform + * Parametrization of understand_* functions is now made using + "inference flags" + * Functions removed: + - interp_constr_judgment (inline its former body if really needed) + - interp_casted_constr, interp_type: use instead interp_constr with + expected_type set to OfType or to IsType + - interp_gen: use any of interp_constr, interp_casted_constr, interp_type + - interp_open_constr_patvar + - interp_context: use interp_context_evars (with a "evar_map ref") and + call solve_remaining_evars afterwards with a failing flag + (e.g. all_and_fail_flags) + - understand_type, understand_gen: use understand with appropriate + parameters + * Change of semantics: + - Functions interp_*_evars_impls have a different interface and do + not any longer check resolution of evars by default; use + check_evars_are_solved explicitly to check that evars are solved. + See also the corresponding commit log. + +- Tactics API: new_induct -> induction; new_destruct -> destruct; + letin_pat_tac do not accept a type anymore + +- New file find_subterm.ml for gathering former functions + `subst_closed_term_occ_modulo`, `subst_closed_term_occ_decl` (which now + take and outputs also an `evar_map`), and + `subst_closed_term_occ_modulo`, `subst_closed_term_occ_decl_modulo` (now + renamed into `replace_term_occ_modulo` and + `replace_term_occ_decl_modulo`). + +- API of Inductiveops made more uniform (see commit log or file itself). + +- API of intros_pattern style tactic changed; "s" is dropped in + "intros_pattern" and "intros_patterns" is not anymore behaving like + tactic "intros" on the empty list. + +- API of cut tactics changed: for instance, cut_intro should be replaced by + "assert_after Anonymous" + +- All functions taking an env and a sigma (or an evdref) now takes the + env first. + +## Changes between Coq 8.3 and Coq 8.4 + +- Functions in unification.ml have now the evar_map coming just after the env + +- Removal of Tacinterp.constr_of_id + +Use instead either global_reference or construct_reference in constrintern.ml. + +- Optimizing calls to Evd functions + +Evars are split into defined evars and undefined evars; for +efficiency, when an evar is known to be undefined, it is preferable to +use specific functions about undefined evars since these ones are +generally fewer than the defined ones. + +- Type changes in TACTIC EXTEND rules + +Arguments bound with tactic(_) in TACTIC EXTEND rules are now of type +glob_tactic_expr, instead of glob_tactic_expr * tactic. Only the first +component is kept, the second one can be obtained via +Tacinterp.eval_tactic. + +- ARGUMENT EXTEND + +It is now forbidden to use TYPED simultaneously with {RAW,GLOB}_TYPED +in ARGUMENT EXTEND statements. + +- Renaming of rawconstr to glob_constr + +The "rawconstr" type has been renamed to "glob_constr" for +consistency. The "raw" in everything related to former rawconstr has +been changed to "glob". For more details about the rationale and +scripts to migrate code using Coq's internals, see commits 13743, +13744, 13755, 13756, 13757, 13758, 13761 (by glondu, end of December +2010) in Subversion repository. Contribs have been fixed too, and +commit messages there might also be helpful for migrating. + +## Changes between Coq 8.2 and Coq 8.3 + +### Light cleaning in evaruil.ml + +whd_castappevar is now whd_head_evar +obsolete whd_ise disappears + +### Restructuration of the syntax of binders + +``` +binders_let -> binders +binders_let_fixannot -> binders_fixannot +binder_let -> closed_binder (and now covers only bracketed binders) +binder was already obsolete and has been removed +``` + +### Semantical change of h_induction_destruct + +Warning, the order of the isrec and evar_flag was inconsistent and has +been permuted. Tactic induction_destruct in tactics.ml is unchanged. + +### Internal tactics renamed + +There is no more difference between bindings and ebindings. The +following tactics are therefore renamed + +``` +apply_with_ebindings_gen -> apply_with_bindings_gen +left_with_ebindings -> left_with_bindings +right_with_ebindings -> right_with_bindings +split_with_ebindings -> split_with_bindings +``` + +and the following tactics are removed + + - apply_with_ebindings (use instead apply_with_bindings) + - eapply_with_ebindings (use instead eapply_with_bindings) + +### Obsolete functions in typing.ml + +For mtype_of, msort_of, mcheck, now use type_of, sort_of, check + +### Renaming functions renamed + +``` +concrete_name -> compute_displayed_name_in +concrete_let_name -> compute_displayed_let_name_in +rename_rename_bound_var -> rename_bound_vars_as_displayed +lookup_name_as_renamed -> lookup_name_as_displayed +next_global_ident_away true -> next_ident_away_in_goal +next_global_ident_away false -> next_global_ident_away +``` + +### Cleaning in commmand.ml + +Functions about starting/ending a lemma are in lemmas.ml +Functions about inductive schemes are in indschemes.ml + +Functions renamed: + +``` +declare_one_assumption -> declare_assumption +declare_assumption -> declare_assumptions +Command.syntax_definition -> Metasyntax.add_syntactic_definition +declare_interning_data merged with add_notation_interpretation +compute_interning_datas -> compute_full_internalization_env +implicits_env -> internalization_env +full_implicits_env -> full_internalization_env +build_mutual -> do_mutual_inductive +build_recursive -> do_fixpoint +build_corecursive -> do_cofixpoint +build_induction_scheme -> build_mutual_induction_scheme +build_indrec -> build_induction_scheme +instantiate_type_indrec_scheme -> weaken_sort_scheme +instantiate_indrec_scheme -> modify_sort_scheme +make_case_dep, make_case_nodep -> build_case_analysis_scheme +make_case_gen -> build_case_analysis_scheme_default +``` + +Types: + +decl_notation -> decl_notation option + +### Cleaning in libnames/nametab interfaces + +Functions: + +``` +dirpath_prefix -> pop_dirpath +extract_dirpath_prefix pop_dirpath_n +extend_dirpath -> add_dirpath_suffix +qualid_of_sp -> qualid_of_path +pr_sp -> pr_path +make_short_qualid -> qualid_of_ident +sp_of_syntactic_definition -> path_of_syntactic_definition +sp_of_global -> path_of_global +id_of_global -> basename_of_global +absolute_reference -> global_of_path +locate_syntactic_definition -> locate_syndef +path_of_syntactic_definition -> path_of_syndef +push_syntactic_definition -> push_syndef +``` + +Types: + +section_path -> full_path + +### Cleaning in parsing extensions (commit 12108) + +Many moves and renamings, one new file (Extrawit, that contains wit_tactic). + +### Cleaning in tactical.mli + +``` +tclLAST_HYP -> onLastHyp +tclLAST_DECL -> onLastDecl +tclLAST_NHYPS -> onNLastHypsId +tclNTH_DECL -> onNthDecl +tclNTH_HYP -> onNthHyp +onLastHyp -> onLastHypId +onNLastHyps -> onNLastDecls +onClauses -> onClause +allClauses -> allHypsAndConcl +``` + +and removal of various unused combinators on type "clause" + +## Changes between Coq 8.1 and Coq 8.2 + +### Datatypes + +List of occurrences moved from "int list" to "Termops.occurrences" (an + alias to "bool * int list") +ETIdent renamed to ETName + +### Functions + +``` +Eauto: e_resolve_constr, vernac_e_resolve_constr -> simplest_eapply +Tactics: apply_with_bindings -> apply_with_bindings_wo_evars +Eauto.simplest_apply -> Hiddentac.h_simplest_apply +Evarutil.define_evar_as_arrow -> define_evar_as_product +Old version of Tactics.assert_tac disappears +Tactics.true_cut renamed into Tactics.assert_tac +Constrintern.interp_constrpattern -> intern_constr_pattern +Hipattern.match_with_conjunction is a bit more restrictive +Hipattern.match_with_disjunction is a bit more restrictive +``` + +### Universe names (univ.mli) + + ```ocaml + base_univ -> type0_univ (* alias of Set is the Type hierarchy *) + prop_univ -> type1_univ (* the type of Set in the Type hierarchy *) + neutral_univ -> lower_univ (* semantic alias of Prop in the Type hierarchy *) + is_base_univ -> is_type1_univ + is_empty_univ -> is_lower_univ + ``` + +### Sort names (term.mli) + + ``` + mk_Set -> set_sort + mk_Prop -> prop_sort + type_0 -> type1_sort + ``` + +## Changes between Coq 8.0 and Coq 8.1 + +### Functions + +- Util: option_app -> option_map +- Term: substl_decl -> subst_named_decl +- Lib: library_part -> remove_section_part +- Printer: prterm -> pr_lconstr +- Printer: prterm_env -> pr_lconstr_env +- Ppconstr: pr_sort -> pr_rawsort +- Evd: in_dom, etc got standard ocaml names (i.e. mem, etc) +- Pretyping: + - understand_gen_tcc and understand_gen_ltac merged into understand_ltac + - type_constraints can now say typed by a sort (use OfType to get the + previous behavior) +- Library: import_library -> import_module + +### Constructors + + * Declarations: mind_consnrealargs -> mind_consnrealdecls + * NoRedun -> NoDup + * Cast and RCast have an extra argument: you can recover the previous + behavior by setting the extra argument to "CastConv DEFAULTcast" and + "DEFAULTcast" respectively + * Names: "kernel_name" is now "constant" when argument of Term.Const + * Tacexpr: TacTrueCut and TacForward(false,_,_) merged into new TacAssert + * Tacexpr: TacForward(true,_,_) branched to TacLetTac + +### Modules + + * module Decl_kinds: new interface + * module Bigint: new interface + * module Tacred spawned module Redexpr + * module Symbols -> Notation + * module Coqast, Ast, Esyntax, Termast, and all other modules related to old + syntax are removed + * module Instantiate: integrated to Evd + * module Pretyping now a functor: use Pretyping.Default instead + +### Internal names + +OBJDEF and OBJDEF1 -> CANONICAL-STRUCTURE + +### Tactic extensions + + * printers have an extra parameter which is a constr printer at high precedence + * the tactic printers have an extra arg which is the expected precedence + * level is now a precedence in declare_extra_tactic_pprule + * "interp" functions now of types the actual arg type, not its encapsulation + as a generic_argument + +## Changes between Coq 7.4 and Coq 8.0 + +See files in dev/syntax-v8 + + +## Main changes between Coq 7.4 and Coq 8.0 + +### Changes due to introduction of modules + +#### Kernel + + The module level has no effect on constr except for the structure of +section_path. The type of unique names for constructions (what +section_path served) is now called a kernel name and is defined by + +```ocaml +type uniq_ident = int * string * dir_path (* int may be enough *) +type module_path = + | MPfile of dir_path (* reference to physical module, e.g. file *) + | MPbound of uniq_ident (* reference to a module parameter in a functor *) + | MPself of uniq_ident (* reference to one of the containing module *) + | MPdot of module_path * label +type label = identifier +type kernel_name = module_path * dir_path * label + ^^^^^^^^^^^ ^^^^^^^^ ^^^^^ + | | \ + | | the base name + | \ + / the (true) section path + example: (non empty only inside open sections) + L = (* i.e. some file of logical name L *) + struct + module A = struct Def a = ... end + end + M = (* i.e. some file of logical name M *) + struct + Def t = ... + N = functor (X : sig module T = struct Def b = ... end end) -> struct + module O = struct + Def u = ... + end + Def x := ... .t ... .O.u ... X.T.b ... L.A.a +``` + + and are self-references, X is a bound reference and L is a +reference to a physical module. + + Notice that functor application is not part of a path: it must be +named by a "module M = F(A)" declaration to be used in a kernel +name. + + Notice that Jacek chose a practical approach, making directories not +modules. Another approach could have been to replace the constructor +MPfile by a constant constructor MProot representing the root of the +world. + + Other relevant informations are in kernel/entries.ml (type +module_expr) and kernel/declarations.ml (type module_body and +module_type_body). + +#### Library + +1. tables +[Summaries] - the only change is the special treatment of the +global environmet. + +2. objects +[Libobject] declares persistent objects, given with methods: + + * cache_function specifying how to add the object in the current + scope; + * load_function, specifying what to do when the module + containing the object is loaded; + * open_function, specifying what to do when the module + containing the object is opened (imported); + * classify_function, specyfying what to do with the object, + when the current module (containing the object) is ended. + * subst_function + * export_function, to signal end_section survival + +(Almost) Each of these methods is called with a parameter of type +object_name = section_path * kernel_name +where section_path is the full user name of the object (such as +Coq.Init.Datatypes.Fst) and kernel_name is its substitutive internal +version such as (MPself,[],"Fst") (see above) + + +#### What happens at the end of an interactive module ? + +(or when a file is stored and reloaded from disk) + +All summaries (except Global environment) are reverted to the state +from before the beginning of the module, and: + +1. the objects (again, since last Declaremods.start_module or + Library.start_library) are classified using the classify_function. + To simplify consider only those who returned Substitute _ or Keep _. + +2. If the module is not a functor, the subst_function for each object of + the first group is called with the substitution + [MPself "" |-> MPfile "Coq.Init.Datatypes"]. + Then the load_function is called for substituted objects and the + "keep" object. + (If the module is a library the substitution is done at reloading). + +3. The objects which returned substitute are stored in the modtab + together with the self ident of the module, and functor argument + names if the module was a functor. + + They will be used (substituted and loaded) when a command like + Module M := F(N) or + Module Z := N + is evaluated + + +#### The difference between "substitute" and "keep" objects + +1. The "keep" objects can _only_ reference other objects by section_paths +and qualids. They do not need the substitution function. + +They will work after end_module (or reloading a compiled library), +because these operations do not change section_path's + +They will obviously not work after Module Z:=N. + +These would typically be grammar rules, pretty printing rules etc. + + + +2. The "substitute" objects can _only_ reference objects by +kernel_names. They must have a valid subst_function. + +They will work after end_module _and_ after Module Z:=N or +Module Z:=F(M). + + + +Other kinds of objects: + +3. "Dispose" - objects which do not survive end_module + As a consequence, objects which reference other objects sometimes + by kernel_names and sometimes by section_path must be of this kind... + +4. "Anticipate" - objects which must be treated individually by + end_module (typically "REQUIRE" objects) + + + +#### Writing subst_thing functions + +The subst_thing shoud not copy the thing if it hasn't actually +changed. There are some cool emacs macros in dev/objects.el +to help writing subst functions this way quickly and without errors. +Also there are *_smartmap functions in Util. + +The subst_thing functions are already written for many types, +including constr (Term.subst_mps), +global_reference (Libnames.subst_global), +rawconstr (Rawterm.subst_raw) etc + +They are all (apart from constr, for now) written in the non-copying +way. + + +#### Nametab + +Nametab has been made more uniform. For every kind of thing there is +only one "push" function and one "locate" function. + + +#### Lib + +library_segment is now a list of object_name * library_item, where +object_name = section_path * kernel_name (see above) + +New items have been added for open modules and module types + + +#### Declaremods + +Functions to declare interactive and noninteractive modules and module +types. + + +#### Library + +Uses Declaremods to actually communicate with Global and to register +objects. + + +### Other changes + +Internal representation of tactics bindings has changed (see type +Rawterm.substitution). + +New parsing model for tactics and vernacular commands + + - Introduction of a dedicated type for tactic expressions + (Tacexpr.raw_tactic_expr) + - Introduction of a dedicated type for vernac expressions + (Vernacexpr.vernac_expr) + - Declaration of new vernacular parsing rules by a new camlp4 macro + GRAMMAR COMMAND EXTEND ... END to be used in ML files + - Declaration of new tactics parsing/printing rules by a new camlp4 macro + TACTIC EXTEND ... END to be used in ML files + +New organisation of THENS: + +- tclTHENS tac tacs : tacs is now an array +- tclTHENSFIRSTn tac1 tacs tac2 : + apply tac1 then, apply the array tacs on the first n subgoals and + tac2 on the remaining subgoals (previously tclTHENST) +- tclTHENSLASTn tac1 tac2 tacs : + apply tac1 then, apply tac2 on the first subgoals and apply the array + tacs on the last n subgoals +- tclTHENFIRSTn tac1 tacs = tclTHENSFIRSTn tac1 tacs tclIDTAC (prev. tclTHENSI) +- tclTHENLASTn tac1 tacs = tclTHENSLASTn tac1 tclIDTAC tacs +- tclTHENFIRST tac1 tac2 = tclTHENFIRSTn tac1 [|tac2|] +- tclTHENLAST tac1 tac2 = tclTHENLASTn tac1 [|tac2|] (previously tclTHENL) +- tclTHENS tac1 tacs = tclTHENSFIRSTn tac1 tacs (fun _ -> error "wrong number") +- tclTHENSV same as tclTHENS but with an array +- tclTHENSi : no longer available + +Proof_type: subproof field in type proof_tree glued with the ref field + +Tacmach: no more echo from functions of module Refiner + +Files plugins/*/g_*.ml4 take the place of files plugins/*/*.v. + +Files parsing/{vernac,tac}extend.ml{4,i} implements TACTIC EXTEND andd + VERNAC COMMAND EXTEND macros + +File syntax/PPTactic.v moved to parsing/pptactic.ml + +Tactics about False and not now in tactics/contradiction.ml + +Tactics depending on Init now tactics/*.ml4 (no longer in tactics/*.v) + +File tacinterp.ml moved from proofs to directory tactics + + +## Changes between Coq 7.1 and Coq 7.2 + +The core of Coq (kernel) has meen minimized with the following effects: + +- kernel/term.ml split into kernel/term.ml, pretyping/termops.ml +- kernel/reduction.ml split into kernel/reduction.ml, pretyping/reductionops.ml +- kernel/names.ml split into kernel/names.ml, library/nameops.ml +- kernel/inductive.ml split into kernel/inductive.ml, pretyping/inductiveops.ml + +the prefixes "Is" ans "IsMut" have been dropped from kind_of_term constructors, +e.g. IsRel is now Rel, IsMutCase is now Case, etc. diff --git a/dev/doc/changes.txt b/dev/doc/changes.txt deleted file mode 100644 index 3de938d7..00000000 --- a/dev/doc/changes.txt +++ /dev/null @@ -1,1095 +0,0 @@ -========================================= -= CHANGES BETWEEN COQ V8.5 AND COQ V8.6 = -========================================= - -** Parsing ** - -Pcoq.parsable now takes an extra optional filename argument so as to -bind locations to a file name when relevant. - -** Files ** - -To avoid clashes with OCaml's compiler libs, the following files were renamed: -kernel/closure.ml{,i} -> kernel/cClosure.ml{,i} -lib/errors.ml{,i} -> lib/cErrors.ml{,i} -toplevel/cerror.ml{,i} -> toplevel/explainErr.mli{,i} - -All IDE-specific files, including the XML protocol have been moved to ide/ - -** Reduction functions ** - -In closure.ml, we introduced the more precise reduction flags fMATCH, fFIX, -fCOFIX. - -We renamed the following functions: - -Closure.betadeltaiota -> Closure.all -Closure.betadeltaiotanolet -> Closure.allnolet -Reductionops.beta -> Closure.beta -Reductionops.zeta -> Closure.zeta -Reductionops.betaiota -> Closure.betaiota -Reductionops.betaiotazeta -> Closure.betaiotazeta -Reductionops.delta -> Closure.delta -Reductionops.betalet -> Closure.betazeta -Reductionops.betadelta -> Closure.betadeltazeta -Reductionops.betadeltaiota -> Closure.all -Reductionops.betadeltaiotanolet -> Closure.allnolet -Closure.no_red -> Closure.nored -Reductionops.nored -> Closure.nored -Reductionops.nf_betadeltaiota -> Reductionops.nf_all -Reductionops.whd_betadelta -> Reductionops.whd_betadeltazeta -Reductionops.whd_betadeltaiota -> Reductionops.whd_all -Reductionops.whd_betadeltaiota_nolet -> Reductionops.whd_allnolet -Reductionops.whd_betadelta_stack -> Reductionops.whd_betadeltazeta_stack -Reductionops.whd_betadeltaiota_stack -> Reductionops.whd_all_stack -Reductionops.whd_betadeltaiota_nolet_stack -> Reductionops.whd_allnolet_stack -Reductionops.whd_betadelta_state -> Reductionops.whd_betadeltazeta_state -Reductionops.whd_betadeltaiota_state -> Reductionops.whd_all_state -Reductionops.whd_betadeltaiota_nolet_state -> Reductionops.whd_allnolet_state -Reductionops.whd_eta -> Reductionops.shrink_eta -Tacmach.pf_whd_betadeltaiota -> Tacmach.pf_whd_all -Tacmach.New.pf_whd_betadeltaiota -> Tacmach.New.pf_whd_all - -And removed the following ones: - -Reductionops.whd_betaetalet -Reductionops.whd_betaetalet_stack -Reductionops.whd_betaetalet_state -Reductionops.whd_betadeltaeta_stack -Reductionops.whd_betadeltaeta_state -Reductionops.whd_betadeltaeta -Reductionops.whd_betadeltaiotaeta_stack -Reductionops.whd_betadeltaiotaeta_state -Reductionops.whd_betadeltaiotaeta - -In intf/genredexpr.mli, fIota was replaced by FMatch, FFix and -FCofix. Similarly, rIota was replaced by rMatch, rFix and rCofix. - -** Notation_ops ** - -Use Glob_ops.glob_constr_eq instead of Notation_ops.eq_glob_constr. - -** Logging and Pretty Printing: ** - -* Printing functions have been removed from `Pp.mli`, which is now a - purely pretty-printing interface. Functions affected are: - -```` ocaml -val pp : std_ppcmds -> unit -val ppnl : std_ppcmds -> unit -val pperr : std_ppcmds -> unit -val pperrnl : std_ppcmds -> unit -val pperr_flush : unit -> unit -val pp_flush : unit -> unit -val flush_all : unit -> unit -val msg : std_ppcmds -> unit -val msgnl : std_ppcmds -> unit -val msgerr : std_ppcmds -> unit -val msgerrnl : std_ppcmds -> unit -val message : string -> unit -```` - - which are no more available. Users of `Pp.pp msg` should now use the - proper `Feedback.msg_*` function. Clients also have no control over - flushing, the back end takes care of it. - - Also, the `msg_*` functions now take an optional `?loc` parameter - for relaying location to the client. - -* Feedback related functions and definitions have been moved to the - `Feedback` module. `message_level` has been renamed to - level. Functions moved from Pp to Feedback are: - -```` ocaml -val set_logger : logger -> unit -val std_logger : logger -val emacs_logger : logger -val feedback_logger : logger -```` - -* Changes in the Feedback format/Protocol. - -- The `Message` feedback type now carries an optional location, the main - payload is encoded using the richpp document format. - -- The `ErrorMsg` feedback type is thus unified now with `Message` at - level `Error`. - -* We now provide several loggers, `log_via_feedback` is removed in - favor of `set_logger feedback_logger`. Output functions are: - -```` ocaml -val with_output_to_file : string -> ('a -> 'b) -> 'a -> 'b -val msg_error : ?loc:Loc.t -> Pp.std_ppcmds -> unit -val msg_warning : ?loc:Loc.t -> Pp.std_ppcmds -> unit -val msg_notice : ?loc:Loc.t -> Pp.std_ppcmds -> unit -val msg_info : ?loc:Loc.t -> Pp.std_ppcmds -> unit -val msg_debug : ?loc:Loc.t -> Pp.std_ppcmds -> unit -```` - - with the `msg_*` functions being just an alias for `logger $Level`. - -* The main feedback functions are: - -```` ocaml -val set_feeder : (feedback -> unit) -> unit -val feedback : ?id:edit_or_state_id -> ?route:route_id -> feedback_content -> unit -val set_id_for_feedback : ?route:route_id -> edit_or_state_id -> unit -```` - Note that `feedback` doesn't take two parameters anymore. After - refactoring the following function has been removed: - -```` ocaml -val get_id_for_feedback : unit -> edit_or_state_id * route_id -```` - -** Kernel API changes ** - -- The interface of the Context module was changed. - Related types and functions were put in separate submodules. - The mapping from old identifiers to new identifiers is the following: - - Context.named_declaration ---> Context.Named.Declaration.t - Context.named_list_declaration ---> Context.NamedList.Declaration.t - Context.rel_declaration ---> Context.Rel.Declaration.t - Context.map_named_declaration ---> Context.Named.Declaration.map_constr - Context.map_named_list_declaration ---> Context.NamedList.Declaration.map - Context.map_rel_declaration ---> Context.Rel.Declaration.map_constr - Context.fold_named_declaration ---> Context.Named.Declaration.fold - Context.fold_rel_declaration ---> Context.Rel.Declaration.fold - Context.exists_named_declaration ---> Context.Named.Declaration.exists - Context.exists_rel_declaration ---> Context.Rel.Declaration.exists - Context.for_all_named_declaration ---> Context.Named.Declaration.for_all - Context.for_all_rel_declaration ---> Context.Rel.Declaration.for_all - Context.eq_named_declaration ---> Context.Named.Declaration.equal - Context.eq_rel_declaration ---> Context.Rel.Declaration.equal - Context.named_context ---> Context.Named.t - Context.named_list_context ---> Context.NamedList.t - Context.rel_context ---> Context.Rel.t - Context.empty_named_context ---> Context.Named.empty - Context.add_named_decl ---> Context.Named.add - Context.vars_of_named_context ---> Context.Named.to_vars - Context.lookup_named ---> Context.Named.lookup - Context.named_context_length ---> Context.Named.length - Context.named_context_equal ---> Context.Named.equal - Context.fold_named_context ---> Context.Named.fold_outside - Context.fold_named_list_context ---> Context.NamedList.fold - Context.fold_named_context_reverse ---> Context.Named.fold_inside - Context.instance_from_named_context ---> Context.Named.to_instance - Context.extended_rel_list ---> Context.Rel.to_extended_list - Context.extended_rel_vect ---> Context.Rel.to_extended_vect - Context.fold_rel_context ---> Context.Rel.fold_outside - Context.fold_rel_context_reverse ---> Context.Rel.fold_inside - Context.map_rel_context ---> Context.Rel.map_constr - Context.map_named_context ---> Context.Named.map_constr - Context.iter_rel_context ---> Context.Rel.iter - Context.iter_named_context ---> Context.Named.iter - Context.empty_rel_context ---> Context.Rel.empty - Context.add_rel_decl ---> Context.Rel.add - Context.lookup_rel ---> Context.Rel.lookup - Context.rel_context_length ---> Context.Rel.length - Context.rel_context_nhyps ---> Context.Rel.nhyps - Context.rel_context_tags ---> Context.Rel.to_tags - -- Originally, rel-context was represented as: - - Context.rel_context = Names.Name.t * Constr.t option * Constr.t - - Now it is represented as: - - Context.Rel.Declaration.t = LocalAssum of Names.Name.t * Constr.t - | LocalDef of Names.Name.t * Constr.t * Constr.t - -- Originally, named-context was represented as: - - Context.named_context = Names.Id.t * Constr.t option * Constr.t - - Now it is represented as: - - Context.Named.Declaration.t = LocalAssum of Names.Id.t * Constr.t - | LocalDef of Names.Id.t * Constr.t * Constr.t - -- The various EXTEND macros do not handle specially the Coq-defined entries - anymore. Instead, they just output a name that have to exist in the scope - of the ML code. The parsing rules (VERNAC) ARGUMENT EXTEND will look for - variables "$name" of type Gram.entry, while the parsing rules of - (VERNAC COMMAND | TACTIC) EXTEND, as well as the various TYPED AS clauses will - look for variables "wit_$name" of type Genarg.genarg_type. The small DSL - for constructing compound entries still works over this scheme. Note that in - the case of (VERNAC) ARGUMENT EXTEND, the name of the argument entry is bound - in the parsing rules, so beware of recursive calls. - - For example, to get "wit_constr" you must "open Constrarg" at the top of the file. - -- Evarutil was split in two parts. The new Evardefine file exposes functions -define_evar_* mostly used internally in the unification engine. - -- The Refine module was move out of Proofview. - - Proofview.Refine.* ---> Refine.* - -- A statically monotonous evarmap type was introduced in Sigma. Not all the API - has been converted, so that the user may want to use compatibility functions - Sigma.to_evar_map and Sigma.Unsafe.of_evar_map or Sigma.Unsafe.of_pair when - needed. Code can be straightforwardly adapted in the following way: - - let (sigma, x1) = ... in - ... - let (sigma, xn) = ... in - (sigma, ans) - - should be turned into: - - open Sigma.Notations - - let Sigma (x1, sigma, p1) = ... in - ... - let Sigma (xn, sigma, pn) = ... in - Sigma (ans, sigma, p1 +> ... +> pn) - - Examples of `Sigma.Unsafe.of_evar_map` include: - - Evarutil.new_evar env (Tacmach.project goal) ty ----> Evarutil.new_evar env (Sigma.Unsafe.of_evar_map (Tacmach.project goal)) ty - -- The Proofview.Goal.*enter family of functions now takes a polymorphic - continuation given as a record as an argument. - - Proofview.Goal.enter begin fun gl -> ... end - - should be turned into - - open Proofview.Notations - - Proofview.Goal.enter { enter = begin fun gl -> ... end } - -- `Tacexpr.TacDynamic(Loc.dummy_loc, Pretyping.constr_in c)` ---> `Tacinterp.Value.of_constr c` -- `Vernacexpr.HintsResolveEntry(priority, poly, hnf, path, atom)` ---> `Vernacexpr.HintsResolveEntry(Vernacexpr.({hint_priority = priority; hint_pattern = None}), poly, hnf, path, atom)` -- `Pretyping.Termops.mem_named_context` ---> `Engine.Termops.mem_named_context_val` - (`Global.named_context` ---> `Global.named_context_val`) - (`Context.Named.lookup` ---> `Environ.lookup_named_val`) - -** Search API ** - -The main search functions now take a function iterating over the -results. This allows for clients to use streaming or more economic -printing. - -========================================= -= CHANGES BETWEEN COQ V8.4 AND COQ V8.5 = -========================================= - -** Refactoring : more mli interfaces and simpler grammar.cma ** - -- A new directory intf/ now contains mli-only interfaces : - - Constrexpr : definition of constr_expr, was in Topconstr - Decl_kinds : now contains binding_kind = Explicit | Implicit - Evar_kinds : type Evar_kinds.t was previously Evd.hole_kind - Extend : was parsing/extend.mli - Genredexpr : regroup Glob_term.red_expr_gen and Tacexpr.glob_red_flag - Glob_term : definition of glob_constr - Locus : definition of occurrences and stuff about clauses - Misctypes : intro_pattern_expr, glob_sort, cast_type, or_var, ... - Notation_term : contains notation_constr, was Topconstr.aconstr - Pattern : contains constr_pattern - Tacexpr : was tactics/tacexpr.ml - Vernacexpr : was toplevel/vernacexpr.ml - -- Many files have been divided : - - vernacexpr: vernacexpr.mli + Locality - decl_kinds: decl_kinds.mli + Kindops - evd: evar_kinds.mli + evd - tacexpr: tacexpr.mli + tacops - glob_term: glob_term.mli + glob_ops + genredexpr.mli + redops - topconstr: constrexpr.mli + constrexpr_ops - + notation_expr.mli + notation_ops + topconstr - pattern: pattern.mli + patternops - libnames: libnames (qualid, reference) + globnames (global_reference) - egrammar: egramml + egramcoq - -- New utility files : miscops (cf. misctypes.mli) and - redops (cf genredexpr.mli). - -- Some other directory changes : - * grammar.cma and the source files specific to it are now in grammar/ - * pretty-printing files are now in printing/ - -- Inner-file changes : - - * aconstr is now notation_constr, all constructors for this type - now start with a N instead of a A (e.g. NApp instead of AApp), - and functions about aconstr may have been renamed (e.g. match_aconstr - is now match_notation_constr). - - * occurrences (now in Locus.mli) is now an algebraic type, with - - AllOccurrences instead of all_occurrences_expr = (false,[]) - - (AllOccurrencesBut l) instead of (all_occurrences_expr_but l) = (false,l) - - NoOccurrences instead of no_occurrences_expr = (true,[]) - - (OnlyOccurrences l) instead of (no_occurrences_expr_but l) = (true,l) - - * move_location (now in Misctypes) has two new constructors - MoveFirst and MoveLast replacing (MoveToEnd false) and (MoveToEnd true) - -- API of pretyping.ml and constrintern.ml has been made more uniform - * Parametrization of understand_* functions is now made using - "inference flags" - * Functions removed: - - interp_constr_judgment (inline its former body if really needed) - - interp_casted_constr, interp_type: use instead interp_constr with - expected_type set to OfType or to IsType - - interp_gen: use any of interp_constr, interp_casted_constr, interp_type - - interp_open_constr_patvar - - interp_context: use interp_context_evars (with a "evar_map ref") and - call solve_remaining_evars afterwards with a failing flag - (e.g. all_and_fail_flags) - - understand_type, understand_gen: use understand with appropriate - parameters - * Change of semantics: - - Functions interp_*_evars_impls have a different interface and do - not any longer check resolution of evars by default; use - check_evars_are_solved explicitly to check that evars are solved. - See also the corresponding commit log. - -- Tactics API: new_induct -> induction; new_destruct -> destruct; - letin_pat_tac do not accept a type anymore - -- New file find_subterm.ml for gathering former functions - subst_closed_term_occ_modulo, subst_closed_term_occ_decl (which now - take and outputs also an evar_map), and - subst_closed_term_occ_modulo, subst_closed_term_occ_decl_modulo (now - renamed into replace_term_occ_modulo and - replace_term_occ_decl_modulo). - -- API of Inductiveops made more uniform (see commit log or file itself). - -- API of intros_pattern style tactic changed; "s" is dropped in - "intros_pattern" and "intros_patterns" is not anymore behaving like - tactic "intros" on the empty list. - -- API of cut tactics changed: for instance, cut_intro should be replaced by - "assert_after Anonymous" - -- All functions taking an env and a sigma (or an evdref) now takes the - env first. - -========================================= -= CHANGES BETWEEN COQ V8.3 AND COQ V8.4 = -========================================= - -** Functions in unification.ml have now the evar_map coming just after the env - -** Removal of Tacinterp.constr_of_id ** - -Use instead either global_reference or construct_reference in constrintern.ml. - -** Optimizing calls to Evd functions ** - -Evars are split into defined evars and undefined evars; for -efficiency, when an evar is known to be undefined, it is preferable to -use specific functions about undefined evars since these ones are -generally fewer than the defined ones. - -** Type changes in TACTIC EXTEND rules ** - -Arguments bound with tactic(_) in TACTIC EXTEND rules are now of type -glob_tactic_expr, instead of glob_tactic_expr * tactic. Only the first -component is kept, the second one can be obtained via -Tacinterp.eval_tactic. - -** ARGUMENT EXTEND ** - -It is now forbidden to use TYPED simultaneously with {RAW,GLOB}_TYPED -in ARGUMENT EXTEND statements. - -** Renaming of rawconstr to glob_constr ** - -The "rawconstr" type has been renamed to "glob_constr" for -consistency. The "raw" in everything related to former rawconstr has -been changed to "glob". For more details about the rationale and -scripts to migrate code using Coq's internals, see commits 13743, -13744, 13755, 13756, 13757, 13758, 13761 (by glondu, end of December -2010) in Subversion repository. Contribs have been fixed too, and -commit messages there might also be helpful for migrating. - -========================================= -= CHANGES BETWEEN COQ V8.2 AND COQ V8.3 = -========================================= - -** Light cleaning in evarutil.ml ** - -whd_castappevar is now whd_head_evar -obsolete whd_ise disappears - -** Restructuration of the syntax of binders ** - -binders_let -> binders -binders_let_fixannot -> binders_fixannot -binder_let -> closed_binder (and now covers only bracketed binders) -binder was already obsolete and has been removed - -** Semantical change of h_induction_destruct ** - -Warning, the order of the isrec and evar_flag was inconsistent and has -been permuted. Tactic induction_destruct in tactics.ml is unchanged. - -** Internal tactics renamed - -There is no more difference between bindings and ebindings. The -following tactics are therefore renamed - -apply_with_ebindings_gen -> apply_with_bindings_gen -left_with_ebindings -> left_with_bindings -right_with_ebindings -> right_with_bindings -split_with_ebindings -> split_with_bindings - -and the following tactics are removed - -apply_with_ebindings (use instead apply_with_bindings) -eapply_with_ebindings (use instead eapply_with_bindings) - -** Obsolete functions in typing.ml - -For mtype_of, msort_of, mcheck, now use type_of, sort_of, check - -** Renaming functions renamed - -concrete_name -> compute_displayed_name_in -concrete_let_name -> compute_displayed_let_name_in -rename_rename_bound_var -> rename_bound_vars_as_displayed -lookup_name_as_renamed -> lookup_name_as_displayed -next_global_ident_away true -> next_ident_away_in_goal -next_global_ident_away false -> next_global_ident_away - -** Cleaning in commmand.ml - -Functions about starting/ending a lemma are in lemmas.ml -Functions about inductive schemes are in indschemes.ml - -Functions renamed: - -declare_one_assumption -> declare_assumption -declare_assumption -> declare_assumptions -Command.syntax_definition -> Metasyntax.add_syntactic_definition -declare_interning_data merged with add_notation_interpretation -compute_interning_datas -> compute_full_internalization_env -implicits_env -> internalization_env -full_implicits_env -> full_internalization_env -build_mutual -> do_mutual_inductive -build_recursive -> do_fixpoint -build_corecursive -> do_cofixpoint -build_induction_scheme -> build_mutual_induction_scheme -build_indrec -> build_induction_scheme -instantiate_type_indrec_scheme -> weaken_sort_scheme -instantiate_indrec_scheme -> modify_sort_scheme -make_case_dep, make_case_nodep -> build_case_analysis_scheme -make_case_gen -> build_case_analysis_scheme_default - -Types: - -decl_notation -> decl_notation option - -** Cleaning in libnames/nametab interfaces - -Functions: - -dirpath_prefix -> pop_dirpath -extract_dirpath_prefix pop_dirpath_n -extend_dirpath -> add_dirpath_suffix -qualid_of_sp -> qualid_of_path -pr_sp -> pr_path -make_short_qualid -> qualid_of_ident -sp_of_syntactic_definition -> path_of_syntactic_definition -sp_of_global -> path_of_global -id_of_global -> basename_of_global -absolute_reference -> global_of_path -locate_syntactic_definition -> locate_syndef -path_of_syntactic_definition -> path_of_syndef -push_syntactic_definition -> push_syndef - -Types: - -section_path -> full_path - -** Cleaning in parsing extensions (commit 12108) - -Many moves and renamings, one new file (Extrawit, that contains wit_tactic). - -** Cleaning in tactical.mli - -tclLAST_HYP -> onLastHyp -tclLAST_DECL -> onLastDecl -tclLAST_NHYPS -> onNLastHypsId -tclNTH_DECL -> onNthDecl -tclNTH_HYP -> onNthHyp -onLastHyp -> onLastHypId -onNLastHyps -> onNLastDecls -onClauses -> onClause -allClauses -> allHypsAndConcl - -+ removal of various unused combinators on type "clause" - -========================================= -= CHANGES BETWEEN COQ V8.1 AND COQ V8.2 = -========================================= - -A few differences in Coq ML interfaces between Coq V8.1 and V8.2 -================================================================ - -** Datatypes - -List of occurrences moved from "int list" to "Termops.occurrences" (an - alias to "bool * int list") -ETIdent renamed to ETName - -** Functions - -Eauto: e_resolve_constr, vernac_e_resolve_constr -> simplest_eapply -Tactics: apply_with_bindings -> apply_with_bindings_wo_evars -Eauto.simplest_apply -> Hiddentac.h_simplest_apply -Evarutil.define_evar_as_arrow -> define_evar_as_product -Old version of Tactics.assert_tac disappears -Tactics.true_cut renamed into Tactics.assert_tac -Constrintern.interp_constrpattern -> intern_constr_pattern -Hipattern.match_with_conjunction is a bit more restrictive -Hipattern.match_with_disjunction is a bit more restrictive - -** Universe names (univ.mli) - - base_univ -> type0_univ (* alias of Set is the Type hierarchy *) - prop_univ -> type1_univ (* the type of Set in the Type hierarchy *) - neutral_univ -> lower_univ (* semantic alias of Prop in the Type hierarchy *) - is_base_univ -> is_type1_univ - is_empty_univ -> is_lower_univ - -** Sort names (term.mli) - - mk_Set -> set_sort - mk_Prop -> prop_sort - type_0 -> type1_sort - -========================================= -= CHANGES BETWEEN COQ V8.0 AND COQ V8.1 = -========================================= - -A few differences in Coq ML interfaces between Coq V8.0 and V8.1 -================================================================ - -** Functions - -Util: option_app -> option_map -Term: substl_decl -> subst_named_decl -Lib: library_part -> remove_section_part -Printer: prterm -> pr_lconstr -Printer: prterm_env -> pr_lconstr_env -Ppconstr: pr_sort -> pr_rawsort -Evd: in_dom, etc got standard ocaml names (i.e. mem, etc) -Pretyping: - - understand_gen_tcc and understand_gen_ltac merged into understand_ltac - - type_constraints can now say typed by a sort (use OfType to get the - previous behavior) -Library: import_library -> import_module - -** Constructors - -Declarations: mind_consnrealargs -> mind_consnrealdecls -NoRedun -> NoDup -Cast and RCast have an extra argument: you can recover the previous - behavior by setting the extra argument to "CastConv DEFAULTcast" and - "DEFAULTcast" respectively -Names: "kernel_name" is now "constant" when argument of Term.Const -Tacexpr: TacTrueCut and TacForward(false,_,_) merged into new TacAssert -Tacexpr: TacForward(true,_,_) branched to TacLetTac - -** Modules - -module Decl_kinds: new interface -module Bigint: new interface -module Tacred spawned module Redexpr -module Symbols -> Notation -module Coqast, Ast, Esyntax, Termast, and all other modules related to old - syntax are removed -module Instantiate: integrated to Evd -module Pretyping now a functor: use Pretyping.Default instead - -** Internal names - -OBJDEF and OBJDEF1 -> CANONICAL-STRUCTURE - -** Tactic extensions - -- printers have an extra parameter which is a constr printer at high precedence -- the tactic printers have an extra arg which is the expected precedence -- level is now a precedence in declare_extra_tactic_pprule -- "interp" functions now of types the actual arg type, not its encapsulation - as a generic_argument - -========================================= -= CHANGES BETWEEN COQ V7.4 AND COQ V8.0 = -========================================= - -See files in dev/syntax-v8 - - -============================================== -= MAIN CHANGES BETWEEN COQ V7.3 AND COQ V7.4 = -============================================== - -CHANGES DUE TO INTRODUCTION OF MODULES -====================================== - -1.Kernel --------- - - The module level has no effect on constr except for the structure of -section_path. The type of unique names for constructions (what -section_path served) is now called a kernel name and is defined by - -type uniq_ident = int * string * dir_path (* int may be enough *) -type module_path = - | MPfile of dir_path (* reference to physical module, e.g. file *) - | MPbound of uniq_ident (* reference to a module parameter in a functor *) - | MPself of uniq_ident (* reference to one of the containing module *) - | MPdot of module_path * label -type label = identifier -type kernel_name = module_path * dir_path * label - ^^^^^^^^^^^ ^^^^^^^^ ^^^^^ - | | \ - | | the base name - | \ - / the (true) section path - example: (non empty only inside open sections) - L = (* i.e. some file of logical name L *) - struct - module A = struct Def a = ... end - end - M = (* i.e. some file of logical name M *) - struct - Def t = ... - N = functor (X : sig module T = struct Def b = ... end end) -> struct - module O = struct - Def u = ... - end - Def x := ... .t ... .O.u ... X.T.b ... L.A.a - - and are self-references, X is a bound reference and L is a -reference to a physical module. - - Notice that functor application is not part of a path: it must be -named by a "module M = F(A)" declaration to be used in a kernel -name. - - Notice that Jacek chose a practical approach, making directories not -modules. Another approach could have been to replace the constructor -MPfile by a constant constructor MProot representing the root of the -world. - - Other relevant informations are in kernel/entries.ml (type -module_expr) and kernel/declarations.ml (type module_body and -module_type_body). - -2. Library ----------- - -i) tables -[Summaries] - the only change is the special treatment of the -global environmet. - -ii) objects -[Libobject] declares persistent objects, given with methods: - - * cache_function specifying how to add the object in the current - scope; - * load_function, specifying what to do when the module - containing the object is loaded; - * open_function, specifying what to do when the module - containing the object is opened (imported); - * classify_function, specyfying what to do with the object, - when the current module (containing the object) is ended. - * subst_function - * export_function, to signal end_section survival - -(Almost) Each of these methods is called with a parameter of type -object_name = section_path * kernel_name -where section_path is the full user name of the object (such as -Coq.Init.Datatypes.Fst) and kernel_name is its substitutive internal -version such as (MPself,[],"Fst") (see above) - - -What happens at the end of an interactive module ? -================================================== -(or when a file is stored and reloaded from disk) - -All summaries (except Global environment) are reverted to the state -from before the beginning of the module, and: - -a) the objects (again, since last Declaremods.start_module or - Library.start_library) are classified using the classify_function. - To simplify consider only those who returned Substitute _ or Keep _. - -b) If the module is not a functor, the subst_function for each object of - the first group is called with the substitution - [MPself "" |-> MPfile "Coq.Init.Datatypes"]. - Then the load_function is called for substituted objects and the - "keep" object. - (If the module is a library the substitution is done at reloading). - -c) The objects which returned substitute are stored in the modtab - together with the self ident of the module, and functor argument - names if the module was a functor. - - They will be used (substituted and loaded) when a command like - Module M := F(N) or - Module Z := N - is evaluated - - -The difference between "substitute" and "keep" objects -======================================================== -i) The "keep" objects can _only_ reference other objects by section_paths -and qualids. They do not need the substitution function. - -They will work after end_module (or reloading a compiled library), -because these operations do not change section_path's - -They will obviously not work after Module Z:=N. - -These would typically be grammar rules, pretty printing rules etc. - - - -ii) The "substitute" objects can _only_ reference objects by -kernel_names. They must have a valid subst_function. - -They will work after end_module _and_ after Module Z:=N or -Module Z:=F(M). - - - -Other kinds of objects: -iii) "Dispose" - objects which do not survive end_module - As a consequence, objects which reference other objects sometimes - by kernel_names and sometimes by section_path must be of this kind... - -iv) "Anticipate" - objects which must be treated individually by - end_module (typically "REQUIRE" objects) - - - -Writing subst_thing functions -============================= -The subst_thing shoud not copy the thing if it hasn't actually -changed. There are some cool emacs macros in dev/objects.el -to help writing subst functions this way quickly and without errors. -Also there are *_smartmap functions in Util. - -The subst_thing functions are already written for many types, -including constr (Term.subst_mps), -global_reference (Libnames.subst_global), -rawconstr (Rawterm.subst_raw) etc - -They are all (apart from constr, for now) written in the non-copying -way. - - -Nametab -======= - -Nametab has been made more uniform. For every kind of thing there is -only one "push" function and one "locate" function. - - -Lib -=== - -library_segment is now a list of object_name * library_item, where -object_name = section_path * kernel_name (see above) - -New items have been added for open modules and module types - - -Declaremods -========== -Functions to declare interactive and noninteractive modules and module -types. - - -Library -======= -Uses Declaremods to actually communicate with Global and to register -objects. - - -OTHER CHANGES -============= - -Internal representation of tactics bindings has changed (see type -Rawterm.substitution). - -New parsing model for tactics and vernacular commands - - - Introduction of a dedicated type for tactic expressions - (Tacexpr.raw_tactic_expr) - - Introduction of a dedicated type for vernac expressions - (Vernacexpr.vernac_expr) - - Declaration of new vernacular parsing rules by a new camlp4 macro - GRAMMAR COMMAND EXTEND ... END to be used in ML files - - Declaration of new tactics parsing/printing rules by a new camlp4 macro - TACTIC EXTEND ... END to be used in ML files - -New organisation of THENS: -tclTHENS tac tacs : tacs is now an array -tclTHENSFIRSTn tac1 tacs tac2 : - apply tac1 then, apply the array tacs on the first n subgoals and - tac2 on the remaining subgoals (previously tclTHENST) -tclTHENSLASTn tac1 tac2 tacs : - apply tac1 then, apply tac2 on the first subgoals and apply the array - tacs on the last n subgoals -tclTHENFIRSTn tac1 tacs = tclTHENSFIRSTn tac1 tacs tclIDTAC (prev. tclTHENSI) -tclTHENLASTn tac1 tacs = tclTHENSLASTn tac1 tclIDTAC tacs -tclTHENFIRST tac1 tac2 = tclTHENFIRSTn tac1 [|tac2|] -tclTHENLAST tac1 tac2 = tclTHENLASTn tac1 [|tac2|] (previously tclTHENL) -tclTHENS tac1 tacs = tclTHENSFIRSTn tac1 tacs (fun _ -> error "wrong number") -tclTHENSV same as tclTHENS but with an array -tclTHENSi : no longer available - -Proof_type: subproof field in type proof_tree glued with the ref field - -Tacmach: no more echo from functions of module Refiner - -Files plugins/*/g_*.ml4 take the place of files plugins/*/*.v. -Files parsing/{vernac,tac}extend.ml{4,i} implements TACTIC EXTEND andd - VERNAC COMMAND EXTEND macros -File syntax/PPTactic.v moved to parsing/pptactic.ml -Tactics about False and not now in tactics/contradiction.ml -Tactics depending on Init now tactics/*.ml4 (no longer in tactics/*.v) -File tacinterp.ml moved from proofs to directory tactics - - -========================================== -= MAIN CHANGES FROM COQ V7.1 TO COQ V7.2 = -========================================== - -The core of Coq (kernel) has meen minimized with the following effects: - -kernel/term.ml split into kernel/term.ml, pretyping/termops.ml -kernel/reduction.ml split into kernel/reduction.ml, pretyping/reductionops.ml -kernel/names.ml split into kernel/names.ml, library/nameops.ml -kernel/inductive.ml split into kernel/inductive.ml, pretyping/inductiveops.ml - -the prefixes "Is" ans "IsMut" have been dropped from kind_of_term constructors, -e.g. IsRel is now Rel, IsMutCase is now Case, etc. - - -======================================================= -= PRINCIPAUX CHANGEMENTS ENTRE COQ V6.3.1 ET COQ V7.0 = -======================================================= - -Changements d'organisation / modules : --------------------------------------- - - Std, More_util -> lib/util.ml - - Names -> kernel/names.ml et kernel/sign.ml - (les parties noms et signatures ont été séparées) - - Avm,Mavm,Fmavm,Mhm -> utiliser plutôt Map (et freeze alors gratuit) - Mhb -> Bij - - Generic est intégré à Term (et un petit peu à Closure) - -Changements dans les types de données : ---------------------------------------- - dans Generic: free_rels : constr -> int Listset.t - devient : constr -> Intset.t - - type_judgement -> typed_type - environment -> context - context -> typed_type signature - - -ATTENTION: ----------- - - Il y a maintenant d'autres exceptions que UserError (TypeError, - RefinerError, etc.) - - Il ne faut donc plus se contenter (pour rattraper) de faire - - try . .. with UserError _ -> ... - - mais écrire à la place - - try ... with e when Logic.catchable_exception e -> ... - - -Changements dans les fonctions : --------------------------------- - - Vectops. - it_vect -> Array.fold_left - vect_it -> Array.fold_right - exists_vect -> Util.array_exists - for_all2eq_vect -> Util.array_for_all2 - tabulate_vect -> Array.init - hd_vect -> Util.array_hd - tl_vect -> Util.array_tl - last_vect -> Util.array_last - it_vect_from -> array_fold_left_from - vect_it_from -> array_fold_right_from - app_tl_vect -> array_app_tl - cons_vect -> array_cons - map_i_vect -> Array.mapi - map2_vect -> array_map2 - list_of_tl_vect -> array_list_of_tl - - Names - sign_it -> fold_var_context (se fait sur env maintenant) - it_sign -> fold_var_context_reverse (sur env maintenant) - - Generic - noccur_bet -> noccur_between - substn_many -> substnl - - Std - comp -> Util.compose - rev_append -> List.rev_append - - Termenv - mind_specif_of_mind -> Global.lookup_mind_specif - ou Environ.lookup_mind_specif si on a un env sous la main - mis_arity -> instantiate_arity - mis_lc -> instantiate_lc - - Ex-Environ - mind_of_path -> Global.lookup_mind - - Printer - gentermpr -> gen_pr_term - term0 -> prterm_env - pr_sign -> pr_var_context - pr_context_opt -> pr_context_of - pr_ne_env -> pr_ne_context_of - - Typing, Machops - type_of_type -> judge_of_type - fcn_proposition -> judge_of_prop_contents - safe_fmachine -> safe_infer - - Reduction, Clenv - whd_betadeltat -> whd_betaevar - whd_betadeltatiota -> whd_betaiotaevar - find_mrectype -> Inductive.find_mrectype - find_minductype -> Inductive.find_inductive - find_mcoinductype -> Inductive.find_coinductive - - Astterm - constr_of_com_casted -> interp_casted_constr - constr_of_com_sort -> interp_type - constr_of_com -> interp_constr - rawconstr_of_com -> interp_rawconstr - type_of_com -> type_judgement_of_rawconstr - judgement_of_com -> judgement_of_rawconstr - - Termast - bdize -> ast_of_constr - - Tacmach - pf_constr_of_com_sort -> pf_interp_type - pf_constr_of_com -> pf_interp_constr - pf_get_hyp -> pf_get_hyp_typ - pf_hyps, pf_untyped_hyps -> pf_env (tout se fait sur env maintenant) - - Pattern - raw_sopattern_of_compattern -> Astterm.interp_constrpattern - somatch -> is_matching - dest_somatch -> matches - - Tacticals - matches -> gl_is_matching - dest_match -> gl_matches - suff -> utiliser sort_of_goal - lookup_eliminator -> utiliser sort_of_goal pour le dernier arg - - Divers - initial_sign -> var_context - - Sign - ids_of_sign -> ids_of_var_context (or Environ.ids_of_context) - empty_sign -> empty_var_context - - Pfedit - list_proofs -> get_all_proof_names - get_proof -> get_current_proof_name - abort_goal -> abort_proof - abort_goals -> abort_all_proofs - abort_cur_goal -> abort_current_proof - get_evmap_sign -> get_goal_context/get_current_goal_context - unset_undo -> reset_undo - - Proof_trees - mkGOAL -> mk_goal - - Declare - machine_constant -> declare_constant (+ modifs) - - ex-Trad, maintenant Pretyping - inh_cast_rel -> Coercion.inh_conv_coerce_to - inh_conv_coerce_to -> Coercion.inh_conv_coerce_to_fail - ise_resolve1 -> understand, understand_type - ise_resolve -> understand_judgment, understand_type_judgment - - ex-Tradevar, maintenant Evarutil - mt_tycon -> empty_tycon - - Recordops - struc_info -> find_structure - -Changements dans les inductifs ------------------------------- -Nouveaux types "constructor" et "inductive" dans Term -La plupart des fonctions de typage des inductives prennent maintenant -un inductive au lieu d'un oonstr comme argument. Les seules fonctions -à traduire un constr en inductive sont les find_rectype and co. - -Changements dans les grammaires -------------------------------- - - . le lexer (parsing/lexer.mll) est maintenant un lexer ocamllex - - . attention : LIDENT -> IDENT (les identificateurs n'ont pas de - casse particulière dans Coq) - - . Le mot "command" est remplacé par "constr" dans les noms de - fichiers, noms de modules et non-terminaux relatifs au parsing des - termes; aussi les changements suivants "COMMAND"/"CONSTR" dans - g_vernac.ml4, VARG_COMMAND/VARG_CONSTR dans vernac*.ml* - - . Les constructeurs d'arguments de tactiques IDENTIFIER, CONSTR, ...n - passent en minuscule Identifier, Constr, ... - - . Plusieurs parsers ont changé de format (ex: sortarg) - -Changements dans le pretty-printing ------------------------------------ - - . Découplage de la traduction de constr -> rawconstr (dans detyping) - et de rawconstr -> ast (dans termast) - . Déplacement des options d'affichage de printer vers termast - . Déplacement des réaiguillage d'univers du pp de printer vers esyntax - - -Changements divers ------------------- - - . il n'y a plus de script coqtop => coqtop et coqtop.byte sont - directement le résultat du link du code - => debuggage et profiling directs - - . il n'y a plus d'installation locale dans bin/$ARCH - - . #use "include.ml" => #use "include" - go() => loop() - - . il y a "make depend" et "make dependcamlp4" car ce dernier prend beaucoup - de temps diff --git a/dev/doc/cic.dtd b/dev/doc/cic.dtd index f2314e22..cc33efd4 100644 --- a/dev/doc/cic.dtd +++ b/dev/doc/cic.dtd @@ -125,7 +125,7 @@ id ID #REQUIRED sort %sort; #REQUIRED> - + diff --git a/dev/doc/coq-src-description.txt b/dev/doc/coq-src-description.txt index 00e7f5c5..b3d49b7e 100644 --- a/dev/doc/coq-src-description.txt +++ b/dev/doc/coq-src-description.txt @@ -14,11 +14,6 @@ parsing tactics toplevel -highparsing : - - Files in parsing/ that cannot be linked too early. - Contains the grammar rules g_*.ml4 - Special components ------------------ @@ -30,7 +25,7 @@ intf : grammar : - Camlp4 syntax extensions. The file grammar/grammar.cma is used + Camlp5 syntax extensions. The file grammar/grammar.cma is used to pre-process .ml4 files containing EXTEND constructions, either TACTIC EXTEND, ARGUMENTS EXTEND or VERNAC ... EXTEND. This grammar.cma incorporates many files from other directories diff --git a/dev/doc/debugging.md b/dev/doc/debugging.md new file mode 100644 index 00000000..14a1cc69 --- /dev/null +++ b/dev/doc/debugging.md @@ -0,0 +1,106 @@ +Debugging from Coq toplevel using Caml trace mechanism +====================================================== + + 1. Launch bytecode version of Coq (coqtop.byte) + 2. Access Ocaml toplevel using vernacular command 'Drop.' + 3. Install load paths and pretty printers for terms, idents, ... using + Ocaml command '#use "base_include";;' (use '#use "include";;' for + installing the advanced term pretty printers) + 4. Use #trace to tell which function(s) to trace + 5. Go back to Coq toplevel with 'go();;' + 6. Test your Coq command and observe the result of tracing your functions + 7. Freely switch from Coq to Ocaml toplevels with 'Drop.' and 'go();;' + + You can avoid typing #use "include" (or "base_include") after Drop + by adding the following lines in your $HOME/.ocamlinit : + + if Filename.basename Sys.argv.(0) = "coqtop.byte" + then ignore (Toploop.use_silently Format.std_formatter "include") + + Hints: To remove high-level pretty-printing features (coercions, + notations, ...), use "Set Printing All". It will affect the #trace + printers too. + + +Debugging with ocamldebug from Emacs +==================================== + + Requires [Tuareg mode](https://github.com/ocaml/tuareg) in Emacs.\ + Coq must be configured with `-local` (`./configure -local`) and the + byte-code version of `coqtop` must have been generated with `make byte`. + + 1. M-x camldebug + 2. give the binary name bin/coqtop.byte + 3. give ../dev/ocamldebug-coq + 4. source db (to get pretty-printers) + 5. add breakpoints with C-x C-a C-b from the buffer displaying the ocaml + source + 6. get more help from ocamldebug manual + run + step + back + start + next + last + print x (abbreviated into p x) + ... + 7. some hints: + + - To debug a failure/error/anomaly, add a breakpoint in + `Vernac.interp_vernac` (in `toplevel/vernac.ml`) at the with clause of the "try ... interp com + with ..." block, then go "back" a few steps to find where the + failure/error/anomaly has been raised + - Alternatively, for an error or an anomaly, add breakpoints in the middle + of each of error* functions or anomaly* functions in lib/util.ml + - If "source db" fails, do a "make printers" and try again (it should build + top_printers.cmo and the core cma files). + - If you build Coq with an OCaml version earlier than 4.06, and have the + OCAMLRUNPARAM environment variable set, Coq may hang on startup when run + from the debugger. If this happens, unset the variable, re-start Emacs, and + run the debugger again. + +Debugging with ocamldebug from the command line +=============================================== + +In the `coq` directory: +1. (on Cygwin/Windows) Pass the `-no-custom` option to the `configure` script before building Coq. +2. Run `make` (to compile the .v files) +3. Run `make byte` +4. (on Cygwin/Windows) Add the full pathname of the directory `.../kernel/byterun` to your bash PATH. + Alternatively, copy the file `kernel/byterun/dllcoqrun.dll` to a directory that is in the PATH. (The + CAML_LD_LIBRARY_PATH mechanism described at the end of INSTALL isn't working.) +5. Run `dev/ocamldebug-coq bin/coqtop.byte` (on Cygwin/Windows, use `... bin/coqtop.byte.exe`) +6. Enter `source db` to load printers +7. Enter `set arguments -coqlib .` so Coq can find plugins, theories, etc. +8. See the ocamldebug manual for more information. A few points: + - use `break @ Printer 501` to set a breakpoint on line 501 in the Printer module (printer.ml). + `break` can be abbreviated as `b`. + - `backtrace` or `bt` to see the call stack + - `step` or `s` goes into called functions; `next` or `n` skips over them + - `list` or `li` shows the code just before and after the current stack frame + - `print ` or `p ` to see the value of a variable +Note that `make byte` doesn't recompile .v files. `make` recompiles all of them if there +are changes in any .ml file--safer but much slower. + +Global gprof-based profiling +============================ + + Coq must be configured with option -profile + + 1. Run native Coq which must end normally (use Quit or option -batch) + 2. gprof ./coqtop gmon.out + +Per function profiling +====================== + + To profile function foo in file bar.ml, add the following lines, just + after the definition of the function: + + let fookey = CProfile.declare_profile "foo";; + let foo a b c = CProfile.profile3 fookey foo a b c;; + + where foo is assumed to have three arguments (adapt using + Profile.profile1, Profile. profile2, etc). + + This has the effect to cumulate the time passed in foo under a + line of name "foo" which is displayed at the time coqtop exits. diff --git a/dev/doc/debugging.txt b/dev/doc/debugging.txt deleted file mode 100644 index f0df2fc3..00000000 --- a/dev/doc/debugging.txt +++ /dev/null @@ -1,78 +0,0 @@ -Debugging from Coq toplevel using Caml trace mechanism -====================================================== - - 1. Launch bytecode version of Coq (coqtop.byte or coqtop -byte) - 2. Access Ocaml toplevel using vernacular command 'Drop.' - 3. Install load paths and pretty printers for terms, idents, ... using - Ocaml command '#use "base_include";;' (use '#use "include";;' for - installing the advanced term pretty printers) - 4. Use #trace to tell which function(s) to trace - 5. Go back to Coq toplevel with 'go();;' - 6. Test your Coq command and observe the result of tracing your functions - 7. Freely switch from Coq to Ocaml toplevels with 'Drop.' and 'go();;' - - You can avoid typing #use "include" (or "base_include") after Drop - by adding the following lines in your $HOME/.ocamlinit : - - if Filename.basename Sys.argv.(0) = "coqtop.byte" - then ignore (Toploop.use_silently Format.std_formatter "include") - - Hints: To remove high-level pretty-printing features (coercions, - notations, ...), use "Set Printing All". It will affect the #trace - printers too. - - -Debugging from Caml debugger -============================ - - Needs tuareg mode in Emacs - Coq must be configured with -debug and -local (./configure -debug -local) - - 1. M-x camldebug - 2. give the binary name bin/coqtop.byte - 3. give ../dev/ocamldebug-coq - 4. source db (to get pretty-printers) - 5. add breakpoints with C-x C-a C-b from the buffer displaying the ocaml - source - 6. get more help from ocamldebug manual - run - step - back - start - next - last - print x (abbreviated into p x) - ... - 7. some hints: - - - To debug a failure/error/anomaly, add a breakpoint in - Vernac.vernac_com at the with clause of the "try ... interp com - with ..." block, then go "back" a few steps to find where the - failure/error/anomaly has been raised - - Alternatively, for an error or an anomaly, add breakpoints in the middle - of each of error* functions or anomaly* functions in lib/util.ml - - If "source db" fails, recompile printers.cma with - "make dev/printers.cma" and try again - -Global gprof-based profiling -============================ - - Coq must be configured with option -profile - - 1. Run native Coq which must end normally (use Quit or option -batch) - 2. gprof ./coqtop gmon.out - -Per function profiling -====================== - - 1. To profile function foo in file bar.ml, add the following lines, just - after the definition of the function: - - let fookey = Profile.declare_profile "foo";; - let foo a b c = Profile.profile3 fookey foo a b c;; - - where foo is assumed to have three arguments (adapt using - Profile.profile1, Profile. profile2, etc). - - This has the effect to cumulate the time passed in foo under a - line of name "foo" which is displayed at the time coqtop exits. diff --git a/dev/doc/econstr.md b/dev/doc/econstr.md new file mode 100644 index 00000000..bb17e8fb --- /dev/null +++ b/dev/doc/econstr.md @@ -0,0 +1,129 @@ +# Evar-insensitive terms (EConstr) + +Evar-insensitive terms were introduced in 8.7, following +[CEP #10](https://github.com/coq/ceps/blob/master/text/010-econstr.md). We will +not recap the motivations in this document and rather summarize the code changes +to perform. + +## Overview + +The essential datastructures are defined in +[the `EConstr` module](/engine/eConstr.mli) module. It defines +the tactic counterparts of kernel data structures such as terms +(`EConstr.constr`), universes (`EConstr.ESorts.t`) and contexts +(`EConstr.*_context`). + +The main difference with kernel-side types is that observing them requires +an evar-map at hand in order to normalize evars on the fly. The basic primitive +to observe an `EConstr.t` is the following function: +``` +val kind : Evd.evar_map -> t -> (t, t, ESorts.t, EInstance.t) Constr.kind_of_term +(** Same as {!Constr.kind} except that it expands evars and normalizes + universes on the fly. *) +``` + +Essentially, each time it sees an evar which happens to be defined in the +provided evar-map, it replaces it with the corresponding body and carries on. + +Due to universe unification occuring at the tactic level, the same goes for +universe instances and sorts. See the `ESort` and `EInstance` modules in +`EConstr`. + +This normalization is critical for the soundness of tactics. Before EConstr, a +lot of bugs were lurking in the code base, a few still are (most notably in +meta-based unification) and failure to respect the guidelines thereafter may +result in nasal demons. + +## Transition path + +### Types + +As a rule of thumb, all functions living at the tactic level should manipulate +`EConstr.t` instead of `Constr.t`, and similarly for the other data structures. + +To ease the transition, the `EConstr` module defines a handful of aliases to +shadow the type names from the kernel. + +It is recommended to perform the following replacement in headers. +```ocaml +(** Kernel types. You may remove the two following opens if you want. Beware + that [kind_of_term] needs to be in scope if you use [EConstr.kind] so that + you may still need to open one of the two. *) +open Term +open Constr +(** Tactic types. Open this after to shadow kernel types. *) +open EConstr +``` + +Note that the `EConstr` module also redefines a `Vars` submodule. + +### Evar-map-passing + +All functions deconstructing an econstr need to take an evar-map as a parameter. +Therefore, you need to pass one as an argument virtually everywhere. + +In the Coq source code, it is recommended to take the evar-map as a first +argument called `sigma`, except if the function also takes an environment in +which case it is passed second. Namely, the two typical instances are: +```ocaml +let foo sigma c = mycode +val foo : Evd.evar_map -> EConstr.t -> Foo.t + +let bar env sigma c = mycode +val bar : Environ.env -> Evd.evar_map -> EConstr.t -> Bar.t +``` + +The EConstr API makes the code much more sensitive to evar-maps, because a +lot of now useless normalizations were removed. Thus one should be cautious of +**not** dropping the evar-map when it has been updated, and should rather stick +to a strict state-passing discipline. Unsound primitives like +`Typing.unsafe_type_of` are also a known source of problems, so you should +replace them with the corresponding evar-map-returning function and thread it +properly. + +### Functions + +Many functions from `Constr` and `Term` are redefined to work on econstr in +the `EConstr` module, so that it is often enough to perform the `open` as +described above to replace them. Their type may differ though, because they now +need access to an evar-map. A lot of econstr-manipulating functions are also +defined in [`Termops`](/engine/termops.mli). + +Functions manipulating tactic terms and kernel terms share the same name if they +are the equivalent one of the other. Do not hesitate to grep Coq mli files to +find the equivalent of a function you want to port if it is neither in `EConstr` +nor in `Termops` (this should be very rare). + +### Conversion + +Sometimes you do not have any other choice than calling kernel-side functions +on terms, and conversely to turn a kernel term into a tactic term. + +There are two functions to do so. +* `EConstr.of_constr` turns kernel terms into tactic terms. It is currently +the physical identity, and thus O(1), but this may change in the future. +* `EConstr.to_constr` turns tactic terms into kernel terms. It performs a +full-blown normalization of the given term, which is O(n) and potentially +costly. + +For performance reasons, avoiding to jump back and forth between kernel and +tactic terms is recommended. + +There are also a few unsafe conversion functions that take advantage of the +fact that `EConstr.t` is internally the same as `Constr.t`. Namely, +`EConstr.Unsafe.to_constr` is the physical identity. It should **not** be used +in typical code and is instead provided for efficiency **when you know what you +are doing**. Either use it to reimplement low-level functions that happen to +be insensitive externally, or use it to provide backward compatibility with +broken code that relies on evar-sensitivity. **Do not use it because it is +easier than stuffing evar-maps everywhere.** You've been warned. + +## Notes + +The EConstr branch fixed a lot of eisenbugs linked to lack of normalization +everywhere, most notably in unification. It may also have introduced a few, so +if you see a change in behaviour *that looks like a bug*, please report it. +Obviously, unification is not specified, so it's hard to tell apart, but still. + +Efficiency has been affected as well. We now pay an overhead when observing a +term, but at the same time a lot of costly upfront normalizations were removed. diff --git a/dev/doc/naming-conventions.tex b/dev/doc/naming-conventions.tex index 34916494..337b9226 100644 --- a/dev/doc/naming-conventions.tex +++ b/dev/doc/naming-conventions.tex @@ -267,7 +267,7 @@ If the conclusion is in the other way than listed below, add suffix {forall x y:D, op (op' x y) = op' x (op y)} \itemrule{Idempotency of binary operator {\op} on domain {\D}}{Dop\_idempotent} -{forall x:D, op x n = x} +{forall x:D, op x x = x} \itemrule{Idempotency of unary operator {\op} on domain {\D}}{Dop\_idempotent} {forall x:D, op (op x) = op x} diff --git a/dev/doc/notes-on-conversion b/dev/doc/notes-on-conversion deleted file mode 100644 index a81f170c..00000000 --- a/dev/doc/notes-on-conversion +++ /dev/null @@ -1,73 +0,0 @@ -(**********************************************************************) -(* A few examples showing the current limits of the conversion algorithm *) -(**********************************************************************) - -(*** We define (pseudo-)divergence from Ackermann function ***) - -Definition ack (n : nat) := - (fix F (n0 : nat) : nat -> nat := - match n0 with - | O => S - | S n1 => - fun m : nat => - (fix F0 (n2 : nat) : nat := - match n2 with - | O => F n1 1 - | S n3 => F n1 (F0 n3) - end) m - end) n. - -Notation OMEGA := (ack 4 4). - -Definition f (x:nat) := x. - -(* Evaluation in tactics can somehow be controlled *) -Lemma l1 : OMEGA = OMEGA. -reflexivity. (* succeed: identity *) -Qed. (* succeed: identity *) - -Lemma l2 : OMEGA = f OMEGA. -reflexivity. (* fail: conversion wants to convert OMEGA with f OMEGA *) -Abort. (* but it reduces the right side first! *) - -Lemma l3 : f OMEGA = OMEGA. -reflexivity. (* succeed: reduce left side first *) -Qed. (* succeed: expected concl (the one with f) is on the left *) - -Lemma l4 : OMEGA = OMEGA. -assert (f OMEGA = OMEGA) by reflexivity. (* succeed *) -unfold f in H. (* succeed: no type-checking *) -exact H. (* succeed: identity *) -Qed. (* fail: "f" is on the left *) - -(* This example would fail whatever the preferred side is *) -Lemma l5 : OMEGA = f OMEGA. -unfold f. -assert (f OMEGA = OMEGA) by reflexivity. -unfold f in H. -exact H. -Qed. (* needs to convert (f OMEGA = OMEGA) and (OMEGA = f OMEGA) *) - -(**********************************************************************) -(* Analysis of the inefficiency in Nijmegen/LinAlg/LinAlg/subspace_dim.v *) -(* (proof of span_ind_uninject_prop *) - -In the proof, a problem of the form (Equal S t1 t2) -is "simpl"ified, then "red"uced to (Equal S' t1 t1) -where the new t1's are surrounded by invisible coercions. -A reflexivity steps conclude the proof. - -The trick is that Equal projects the equality in the setoid S, and -that (Equal S) itself reduces to some (fun x y => Equal S' (f x) (g y)). - -At the Qed time, the problem to solve is (Equal S t1 t2) = (Equal S' t1 t1) -and the algorithm is to first compare S and S', and t1 and t2. -Unfortunately it does not work, and since t1 and t2 involve concrete -instances of algebraic structures, it takes a lot of time to realize that -it is not convertible. - -The only hope to improve this problem is to observe that S' hides -(behind two indirections) a Setoid constructor. This could be the -argument to solve the problem. - - diff --git a/dev/doc/notes-on-conversion.v b/dev/doc/notes-on-conversion.v new file mode 100644 index 00000000..a81f170c --- /dev/null +++ b/dev/doc/notes-on-conversion.v @@ -0,0 +1,73 @@ +(**********************************************************************) +(* A few examples showing the current limits of the conversion algorithm *) +(**********************************************************************) + +(*** We define (pseudo-)divergence from Ackermann function ***) + +Definition ack (n : nat) := + (fix F (n0 : nat) : nat -> nat := + match n0 with + | O => S + | S n1 => + fun m : nat => + (fix F0 (n2 : nat) : nat := + match n2 with + | O => F n1 1 + | S n3 => F n1 (F0 n3) + end) m + end) n. + +Notation OMEGA := (ack 4 4). + +Definition f (x:nat) := x. + +(* Evaluation in tactics can somehow be controlled *) +Lemma l1 : OMEGA = OMEGA. +reflexivity. (* succeed: identity *) +Qed. (* succeed: identity *) + +Lemma l2 : OMEGA = f OMEGA. +reflexivity. (* fail: conversion wants to convert OMEGA with f OMEGA *) +Abort. (* but it reduces the right side first! *) + +Lemma l3 : f OMEGA = OMEGA. +reflexivity. (* succeed: reduce left side first *) +Qed. (* succeed: expected concl (the one with f) is on the left *) + +Lemma l4 : OMEGA = OMEGA. +assert (f OMEGA = OMEGA) by reflexivity. (* succeed *) +unfold f in H. (* succeed: no type-checking *) +exact H. (* succeed: identity *) +Qed. (* fail: "f" is on the left *) + +(* This example would fail whatever the preferred side is *) +Lemma l5 : OMEGA = f OMEGA. +unfold f. +assert (f OMEGA = OMEGA) by reflexivity. +unfold f in H. +exact H. +Qed. (* needs to convert (f OMEGA = OMEGA) and (OMEGA = f OMEGA) *) + +(**********************************************************************) +(* Analysis of the inefficiency in Nijmegen/LinAlg/LinAlg/subspace_dim.v *) +(* (proof of span_ind_uninject_prop *) + +In the proof, a problem of the form (Equal S t1 t2) +is "simpl"ified, then "red"uced to (Equal S' t1 t1) +where the new t1's are surrounded by invisible coercions. +A reflexivity steps conclude the proof. + +The trick is that Equal projects the equality in the setoid S, and +that (Equal S) itself reduces to some (fun x y => Equal S' (f x) (g y)). + +At the Qed time, the problem to solve is (Equal S t1 t2) = (Equal S' t1 t1) +and the algorithm is to first compare S and S', and t1 and t2. +Unfortunately it does not work, and since t1 and t2 involve concrete +instances of algebraic structures, it takes a lot of time to realize that +it is not convertible. + +The only hope to improve this problem is to observe that S' hides +(behind two indirections) a Setoid constructor. This could be the +argument to solve the problem. + + diff --git a/dev/doc/primproj.md b/dev/doc/primproj.md new file mode 100644 index 00000000..ea76aeea --- /dev/null +++ b/dev/doc/primproj.md @@ -0,0 +1,41 @@ +Primitive Projections +--------------------- + + | Proj of Projection.t * constr + +Projections are always applied to a term, which must be of a record +type (i.e. reducible to an inductive type `I params`). Type-checking, +reduction and conversion are fast (not as fast as they could be yet) +because we don't keep parameters around. As you can see, it's +currently a `constant` that is used here to refer to the projection, +that will change to an abstract `projection` type in the future. +Basically a projection constant records which inductive it is a +projection for, the number of params and the actual position in the +constructor that must be projected. For compatibility reason, we also +define an eta-expanded form (accessible from user syntax `@f`). The +constant_entry of a projection has both informations. Declaring a +record (under `Set Primitive Projections`) will generate such +definitions. The API to declare them is not stable at the moment, but +the inductive type declaration also knows about the projections, i.e. +a record inductive type decl contains an array of terms representing +the projections. This is used to implement eta-conversion for record +types (with at least one field and having all projections definable). +The canonical value being `Build_R (pn x) ... (pn x)`. Unification and +conversion work up to this eta rule. The records can also be universe +polymorphic of course, and we don't need to keep track of the universe +instance for the projections either. Projections are reduced _eagerly_ +everywhere, and introduce a new `Zproj` constructor in the abstract +machines that obeys both the delta (for the constant opacity) and iota +laws (for the actual reduction). Refolding works as well (afaict), but +there is a slight hack there related to universes (not projections). + +For the ML programmer, the biggest change is that pattern-matchings on +kind_of_term require an additional case, that is handled usually +exactly like an `App (Const p) arg`. + +There are slight hacks related to hints is well, to use the primitive +projection form of f when one does `Hint Resolve f`. Usually hint +resolve will typecheck the term, resulting in a partially applied +projection (disallowed), so we allow it to take +`constr_or_global_reference` arguments instead and special-case on +projections. Other tactic extensions might need similar treatment. diff --git a/dev/doc/profiling.txt b/dev/doc/profiling.txt index 9d2ebf0d..b5dd8445 100644 --- a/dev/doc/profiling.txt +++ b/dev/doc/profiling.txt @@ -7,7 +7,7 @@ want to profile time or memory consumption. AFAIK, this only works for Linux. In Coq source folder: -opam switch 4.02.1+fp +opam switch 4.02.3+fp ./configure -local -debug make perf record -g bin/coqtop -compile file.v diff --git a/dev/doc/proof-engine.md b/dev/doc/proof-engine.md new file mode 100644 index 00000000..8f96ac22 --- /dev/null +++ b/dev/doc/proof-engine.md @@ -0,0 +1,133 @@ +Tutorial on the new proof engine for ML tactic writers +====================================================== + +Starting from Coq 8.5, a new proof engine has been introduced, replacing the old +meta-based engine which had a lot of drawbacks, ranging from expressivity to +soundness, the major one being that the type of tactics was transparent. This +was pervasively abused and made virtually impossible to tweak the implementation +of the engine. + +The old engine is deprecated and is slowly getting removed from the source code. + +The new engine relies on a monadic API defined in the `Proofview` module. Helper +functions and higher-level operations are defined in the `Tacmach` and +`Tacticals` modules, and end-user tactics are defined amongst other in the +`Tactics` module. + +At the root of the engine is a representation of proofs as partial terms that +can contain typed holes, called evars, short for *existential variable*. An evar +is essentially defined by its context and return type, that we will write +`?e : [Γ ⊢ _ : A]`. An evar `?e` must be applied to a substitution `σ` of type +`Γ` (i.e. a list of terms) to produce a term of type `A`, which is done by +applying `EConstr.mkEvar`, and which we will write `?e{σ}`. + +The engine monad features a notion of global state called `evar_map`, defined in +the `Evd` module, which is the structure containing the incremental refinement +of evars. `Evd` is a low-level API and its use is discouraged in favour of the +`Evarutil` module which provides more abstract primitives. + +In addition to this state, the monad also features a goal state, that is +an ordered list of current holes to be filled. While these holes are referred +to as goals at a high-enough level, they are actually no more than evars. The +API provided to deal with these holes can be found in the `Proofview.Goal` +module. Tactics are naturally operating on several goals at once, so that it is +usual to use the `Proofview.Goal.enter` function and its variants to dispatch a +tactic to each of the goals under focus. + +Primitive tactics by term refining +------------------------------------- + +A typical low-level tactic will be defined by plugging partial terms in the +goal holes thanks to the `Refine` module, and in particular to the +`Refine.refine` primitive. + +```ocaml +val refine : typecheck:bool -> Constr.t Sigma.run -> unit tactic +(** In [refine typecheck t], [t] is a term with holes under some + [evar_map] context. The term [t] is used as a partial solution + for the current goal (refine is a goal-dependent tactic), the + new holes created by [t] become the new subgoals. Exceptions + raised during the interpretation of [t] are caught and result in + tactic failures. If [typecheck] is [true] [t] is type-checked beforehand. *) +``` + +In a first approximation, we can think of `'a Sigma.run` as +`evar_map -> 'a * evar_map`. What the function does is first evaluate the +`Constr.t Sigma.run` argument in the current proof state, and then use the +resulting term as a filler for the proof under focus. All evars that have been +created by the invocation of this thunk are then turned into new goals added in +the order of their creation. + +To see how we can use it, let us have a look at an idealized example, the `cut` +tactic. Assuming `X` is a type, `cut X` fills the current goal `[Γ ⊢ _ : A]` +with a term `let x : X := ?e2{Γ} in ?e1{Γ} x` where `x` is a fresh variable and +`?e1 : [Γ ⊢ _ : X -> A]` and `?e2 : [Γ ⊢ _ : X]`. The current goal is solved and +two new holes `[e1, e2]` are added to the goal state in this order. + +```ocaml +let cut c = + let open Sigma in + Proofview.Goal.nf_enter { enter = begin fun gl -> + (** In this block, we focus on one goal at a time indicated by gl *) + let env = Proofview.Goal.env gl in + (** Get the context of the goal, essentially [Γ] *) + let concl = Proofview.Goal.concl gl in + (** Get the conclusion [A] of the goal *) + let hyps = Tacmach.New.pf_ids_of_hyps gl in + (** List of hypotheses from the context of the goal *) + let id = Namegen.next_name_away Anonymous hyps in + (** Generate a fresh identifier *) + let t = mkArrow c (Vars.lift 1 concl) in + (** Build [X -> A]. Note the lifting of [A] due to being on the right hand + side of the arrow. *) + Refine.refine { run = begin fun sigma -> + (** All evars generated by this block will be added as goals *) + let Sigma (f, sigma, p) = Evarutil.new_evar env sigma t in + (** Generate ?e1 : [Γ ⊢ _ : X -> A], add it to sigma, and return the + term [f := Γ ⊢ ?e1{Γ} : X -> A] with the updated sigma. The identity + substitution for [Γ] is extracted from the [env] argument, so that + one must be careful to pass the correct context here in order for the + resulting term to be well-typed. The [p] return value is a proof term + used to enforce sigma monotonicity. *) + let Sigma (x, sigma, q) = Evarutil.new_evar env sigma c in + (** Generate ?e2 : [Γ ⊢ _ : X] in sigma and return + [x := Γ ⊢ ?e2{Γ} : X]. *) + let r = mkLetIn (Name id, x, c, mkApp (Vars.lift 1 r, [|mkRel 1|])) in + (** Build [r := Γ ⊢ let id : X := ?e2{Γ} in ?e1{Γ} id : A] *) + Sigma (r, sigma, p +> q) + (** Fills the current hole with [r]. The [p +> q] thingy ensures + monotonicity of sigma. *) + end } + end } +``` + +The `Evarutil.new_evar` function is the preferred way to generate evars in +tactics. It returns a ready-to-use term, so that one does not have to call +the `mkEvar` primitive. There are lower-level variants whose use is dedicated to +special use cases, *e.g.* whenever one wants a non-identity substitution. One +should take care to call it with the proper `env` argument so that the evar +and term it generates make sense in the context they will be plugged in. + +For the sake of completeness, the old engine was relying on the `Tacmach.refine` +function to provide a similar feature. Nonetheless, it was using untyped metas +instead of evars, so that it had to mangle the argument term to actually produce +the term that would be put into the hole. For instance, to work around the +untypedness, some metas had to be coerced with a cast to enforce their type, +otherwise leading to runtime errors. This was working for very simple +instances, but was unreliable for everything else. + +High-level composition of tactics +------------------------------------ + +It is possible to combine low-level refinement tactics to create more powerful +abstractions. While it was the standard way of doing things in the old engine +to overcome its technical limitations (namely that one was forced to go through +a limited set of derivation rules), it is recommended to generate proofs as +much as possible by refining in ML tactics when it is possible and easy enough. +Indeed, this prevents dependence on fragile constructions such as unification. + +Obviously, it does not forbid the use of tacticals to mimick what one would do +in Ltac. Each Ltac primitive has a corresponding ML counterpart with simple +semantics. A list of such tacticals can be found in the `Tacticals` module. Most +of them are a porting of the tacticals from the old engine to the new one, so +that if they share the same name they are expected to have the same semantics. diff --git a/dev/doc/setup.txt b/dev/doc/setup.txt index 1b016a4e..c48c2d5d 100644 --- a/dev/doc/setup.txt +++ b/dev/doc/setup.txt @@ -12,7 +12,7 @@ How to compile Coq Getting build dependencies: - sudo apt-get install make opam git mercurial darcs + sudo apt-get install make opam git opam init --comp 4.02.3 # Then follow the advice displayed at the end as how to update your ~/.bashrc and ~/.ocamlinit files. @@ -41,17 +41,15 @@ Building coqtop: cd ~/git/coq git checkout trunk make distclean - ./configure -annotate -with-doc no -local -debug -usecamlp5 + ./configure -profile devel make clean make -j4 coqide printers -The "-annotate" option is essential when one wants to use Merlin. +The "-profile devel" enables all options recommended for developers (like +warnings, support for Merlin, etc). Moreover Coq is configured so that +it can be run without installing it (i.e. from the current directory). -The "-local" option is useful if one wants to run the coqtop and coqide binaries without running make install - -The "-debug" option is essential if one wants to use ocamldebug with the coqtop binary. - -Then check if +Once the compilation is over check if - bin/coqtop - bin/coqide behave as expected. @@ -60,30 +58,12 @@ behave as expected. A note about rlwrap ------------------- -Running "coqtop" under "rlwrap" is possible, but there is a catch. If you try: - - cd ~/git/coq - rlwrap bin/coqtop - -you will get an error: +When using "rlwrap coqtop" make sure the version of rlwrap is at least +0.42, otherwise you will get rlwrap: error: Couldn't read completions from /usr/share/rlwrap/completions/coqtop: No such file or directory -This is a known issue: - - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=779692 - -It was fixed upstream in version 0.42, and in a Debian package that, at the time of writing, is not part of Debian stable/testing/sid archives but only of Debian experimental. - - https://packages.debian.org/experimental/rlwrap - -The quick solution is to grab it from there, since it installs fine on Debian stable (jessie). - - cd /tmp - wget http://ftp.us.debian.org/debian/pool/main/r/rlwrap/rlwrap_0.42-1_amd64.deb - sudo dpkg -i rlwrap_0.42-1_amd64.deb - -After that, "rlwrap" works fine with "coqtop". +If this happens either update or use an alternate readline wrapper like "ledit". How to install and configure Merlin (for Emacs) @@ -281,7 +261,7 @@ You can load them by switching to the window holding the "ocamldebug" shell and Some of the functions were you might want to set a breakpoint and see what happens next --------------------------------------------------------------------------------------- -- Coqtop.start : This function is called by the code produced by "coqmktop". +- Coqtop.start : This function is the main entry point of coqtop. - Coqtop.parse_args : This function is responsible for parsing command-line arguments. - Coqloop.loop : This function implements the read-eval-print loop. - Vernacentries.interp : This function is called to execute the Vernacular command user have typed.\ diff --git a/dev/doc/style.txt b/dev/doc/style.txt index 27695a09..2ee3dadd 100644 --- a/dev/doc/style.txt +++ b/dev/doc/style.txt @@ -1,75 +1,142 @@ - -<< L'uniformité du style est plus importante que le style lui-même. >> -(Kernigan & Pike, The Practice of Programming) - -Mode Emacs -========== - Tuareg, que l'on trouve ici : http://www.prism.uvsq.fr/~acohen/tuareg/ - - avec le réglage suivant : (setq tuareg-in-indent 2) - -Types récursifs et filtrages -============================ - Une barre de séparation y compris sur le premier constructeur - -type t = - | A - | B of machin - -match expr with - | A -> ... - | B x -> ... - -Remarque : à partir de la 8.2 environ, la tendance est à utiliser le -format suivant qui permet de limiter l'escalade d'indentation tout en -produisant un aspect visuel intéressant de bloc : - -type t = -| A -| B of machin - -match expr with -| A -> ... -| B x -> ... - -let f expr = match expr with -| A -> ... -| B x -> ... - -let f expr = function -| A -> ... -| B x -> ... - -Le deuxième cas est obtenu sous tuareg avec les réglages - - (setq tuareg-with-indent 0) - (setq tuareg-function-indent 0) - (setq tuareg-let-always-indent nil) /// notons que cette dernière est bien - /// pour les let mais pas pour les let-in - -Conditionnelles -=============== - if condition then - premier-cas - else - deuxieme-cas - - Si effets de bord dans les branches, utilisez begin ... end et non des - parenthèses i.e. - - if condition then begin - instr1; - instr2 - end else begin - instr3; - instr4 - end - - Si la première branche lève une exception, évitez le else i.e. - - if condition then if condition then error "machin"; - error "machin" -----> suite +<< Style uniformity is more important than style itself >> + (Kernigan & Pike, The Practice of Programming) + +OCaml Style: +- Spacing and indentation + - indent your code (using tuareg default) + - no strong constraints in formatting "let in"; possible styles are: + "let x = ... in" + "let x = + ... in" + "let + x = ... + in" + - but: no extra indentation before a "in" coming on next line, + otherwise, it first shifts further and further on the right, + reducing the amount of space available; second, it is not robust to + insertion of a new "let" + - it is established usage to have space around "|" as in + "match c with + | [] | [a] -> ... + | a::b::l -> ..." + - in a one-line "match", it is preferred to have no "|" in front of + the first case (this saves spaces for the match to hold in the line) + - from about 8.2, the tendency is to use the following format which + limit excessive indentation while providing an interesting "block" aspect + type t = + | A + | B of machin + + let f expr = match expr with + | A -> ... + | B x -> ... + + let f expr = function + | A -> ... + | B x -> ... + - add spaces around = and == (make the code "breaths") + - the common usage is to write "let x,y = ... in ..." rather than + "let (x,y) = ... in ..." + - parenthesizing with either "(" and ")" or with "begin" and "end" is + common practice + - preferred layout for conditionals: + if condition then + premier-cas else - suite - - + deuxieme-cas + - in case of effects in branches, use "begin ... end" rather than + parentheses + if condition then begin + instr1; + instr2 + end else begin + instr3; + instr4 + end + - if the first branch raises an exception, avoid the "else", i.e.: + if condition then if condition then error "foo"; + error "foo" -----> bar + else + bar + - it is the usage not to use ;; to end OCaml sentences (however, + inserting ";;" can be useful for debugging syntax errors crossing + the boundary of functions) + - relevant options in tuareg: + (setq tuareg-in-indent 2) + (setq tuareg-with-indent 0) + (setq tuareg-function-indent 0) + (setq tuareg-let-always-indent nil) + +- Coding methodology + - no "try ... with _ -> ..." which catches even Sys.Break (Ctrl-C), + Out_of_memory, Stack_overflow, etc. + at least, use "try with e when Errors.noncritical e -> ..." + (to be detailed, Pierre L. ?) + - do not abuse of fancy combinators: sometimes what a "let rec" loop + does is more readable and simpler to grasp than what a "fold" does + - do not break abstractions: if an internal property is hidden + behind an interface, do no rely on it in code which uses this + interface (e.g. do not use List.map thinking it is left-to-right, + use map_left) + - in particular, do not use "=" on abstract types: there is no + reason a priori that it is the intended equality on this type; use the + "equal" function normally provided with the abstract type + - avoid polymorphically typed "=" whose implementation is not + optimized in OCaml and which has moreover no reason to be the + intended implementation of the equality when it comes to be + instantiated on a particular type (e.g. use List.mem_f, + List.assoc_f, rather than List.mem, List.assoc, etc, unless it is + absolutely clear that "=" will implement the intended equality, and + with the right complexity) + - any new general-purpose enough combinator on list should be put in + cList.ml, on type option in cOpt.ml, etc. + - unless of a good reason not to so, follow the style of the + surrounding code in the same file as much as possible, + the general guidelines are otherwise "let spacing breaths" (we + have large screen nowadays), "make your code easy to read and + to understand" + - document what is tricky, but do not overdocument, sometimes the + choice of names and the structuration of the code is a better + documentation than a long discourse; use of unicode in comments is + welcome if it can make comments more readable (then + "toggle-enable-multibyte-characters" can help when using the + debugger in emacs) + - all of initial "open File", or of small-scope File.(...), or + per-ident File.foo are common practices + +- Choice of variable names + - be consistent when naming from one function to another + - be consistent with the naming adopted in the functions from the + same file, or with the naming used elsewhere by similar functions + - use variable names which express meaning + - keep "cst" for constants and avoid it for constructors which is + otherwise a source of confusion + - for constructors, use "cstr" in type constructor (resp. "cstru" in + constructor puniverse); avoid "constr" for "constructor" which + could be think as the name of an arbitrary Constr.t + - for inductive types, use "ind" in the type inductive (resp "indu" + in inductive puniverse) + - for env, use "env" + - for evar_map, use "sigma", with tolerance into "evm" and "evd" + - for named_context or rel_context, use "ctxt" or "ctx" (or "sign") + - for formal/actual indices of inductive types: "realdecls", "realargs" + - for formal/actual parameters of inductive types: "paramdecls", "paramargs" + - for terms, use e.g. c, b, a, ... + - if a term is known to be a function: f, ... + - if a term is known to be a type: t, u, typ, ... + - for a declaration, use d or "decl" + - for errors, exceptions, use e + +- Common OCaml pitfalls + - in "match ... with Case1 -> try ... with ... -> ... | Case2 -> ...", or in + "match ... with Case1 -> match ... with SubCase -> ... | Case2 -> ...", or in + parentheses are needed around the "try" and the inner "match" + - even if stream are lazy, the Pp.(++) combinator is strict and + forces the evaluation of its arguments (use a "lazy" or a "fun () ->") + to make it lazy explicitly + - in "if ... then ... else ... ++ ...", the default parenthesizing + is somehow counter-intuitive; use "(if ... then ... else ...) ++ ..." + - in "let myspecialfun = mygenericfun args", be sure that it does no + do side-effect; prefer otherwise "let mygenericfun arg = + mygenericfun args arg" to ensure that the function is evaluated at + runtime diff --git a/dev/doc/universes.md b/dev/doc/universes.md new file mode 100644 index 00000000..c276603e --- /dev/null +++ b/dev/doc/universes.md @@ -0,0 +1,226 @@ +Notes on universe polymorphism +------------------------------ + +The implementation of universe polymorphism introduces a few changes +to the API of Coq. First and foremost, the term language changes, as +global references now carry a universe level substitution: + +~~~ocaml +type 'a puniverses = 'a * Univ.Instance.t +type pconstant = constant puniverses +type pinductive = inductive puniverses +type pconstructor = constructor puniverses + +type constr = ... + | Const of puniverses + | Ind of pinductive + | Constr of pconstructor +~~~ + +Universes +--------- + +Universe instances (an array of levels) gets substituted when +unfolding definitions, are used to typecheck and are unified according +to the rules in the ITP'14 paper on universe polymorphism in Coq. + +~~~ocaml +type Level.t = Set | Prop | Level of int * dirpath (* hashconsed *) +type Instance.t = Level.t array +type Universe.t = Level.t list (* hashconsed *) +~~~ + +The universe module defines modules and abstract types for levels, +universes etc.. Structures are hashconsed (with a hack to take care +of the fact that deserialization breaks sharing). + + Definitions (constants, inductives) now carry around not only +constraints but also the universes they introduced (a Univ.UContext.t). +There is another kind of contexts `Univ.ContextSet.t`, the latter has +a set of universes, while the former has serialized the levels in an +array, and is used for polymorphic objects. Both have "reified" +constraints depending on global and local universes. + + A polymorphic definition is abstract w.r.t. the variables in this +context, while a monomorphic one (or template polymorphic) just adds the +universes and constraints to the global universe context when it is put +in the environment. No other universes than the global ones and the +declared local ones are needed to check a declaration, hence the kernel +does not produce any constraints anymore, apart from module +subtyping.... There are hence two conversion functions now: `check_conv` +and `infer_conv`: the former just checks the definition in the current env +(in which we usually push_universe_context of the associated context), +and `infer_conv` which produces constraints that were not implied by the +ambient constraints. Ideally, that one could be put out of the kernel, +but currently module subtyping needs it. + + Inference of universes is now done during refinement, and the evar_map +carries the incrementally built universe context, starting from the +global universe constraints (see `Evd.from_env`). `Evd.conversion` is a +wrapper around `infer_conv` that will do the bookkeeping for you, it +uses `evar_conv_x`. There is a universe substitution being built +incrementally according to the constraints, so one should normalize at +the end of a proof (or during a proof) with that substitution just like +we normalize evars. There are some nf_* functions in +library/universes.ml to do that. Additionally, there is a minimization +algorithm in there that can be applied at the end of a proof to simplify +the universe constraints used in the term. It is heuristic but +validity-preserving. No user-introduced universe (i.e. coming from a +user-written anonymous Type) gets touched by this, only the fresh +universes generated for each global application. Using +~~~ocaml +val pf_constr_of_global : Globnames.global_reference -> (constr -> tactic) -> tactic +~~~ +Is the way to make a constr out of a global reference in the new API. +If they constr is polymorphic, it will add the necessary constraints to +the evar_map. Even if a constr is not polymorphic, we have to take care +of keeping track of its universes. Typically, using: +~~~ocaml + mkApp (coq_id_function, [| A; a |]) +~~~ +and putting it in a proof term is not enough now. One has to somehow +show that A's type is in cumululativity relation with id's type +argument, incurring a universe constraint. To do this, one can simply +call Typing.resolve_evars env evdref c which will do some infer_conv to +produce the right constraints and put them in the evar_map. Of course in +some cases you might know from an invariant that no new constraint would +be produced and get rid of it. Anyway the kernel will tell you if you +forgot some. As a temporary way out, `Universes.constr_of_global` allows +you to make a constr from any non-polymorphic constant, but it will fail +on polymorphic ones. + +Other than that, unification (w_unify and evarconv) now take account of universes and +produce only well-typed evar_maps. + +Some syntactic comparisons like the one used in `change` have to be +adapted to allow identification up-to-universes (when dealing with +polymorphic references), `make_eq_univs_test` is there to help. +In constr, there are actually many new comparison functions to deal with +that: +~~~ocaml +(** [equal a b] is true if [a] equals [b] modulo alpha, casts, + and application grouping *) +val equal : constr -> constr -> bool + +(** [eq_constr_univs u a b] is [true] if [a] equals [b] modulo alpha, casts, + application grouping and the universe equalities in [u]. *) +val eq_constr_univs : constr Univ.check_function + +(** [leq_constr_univs u a b] is [true] if [a] is convertible to [b] modulo + alpha, casts, application grouping and the universe inequalities in [u]. *) +val leq_constr_univs : constr Univ.check_function + +(** [eq_constr_universes a b] [true, c] if [a] equals [b] modulo alpha, casts, + application grouping and the universe equalities in [c]. *) +val eq_constr_universes : constr -> constr -> bool Univ.universe_constrained + +(** [leq_constr_universes a b] [true, c] if [a] is convertible to [b] modulo + alpha, casts, application grouping and the universe inequalities in [c]. *) +val leq_constr_universes : constr -> constr -> bool Univ.universe_constrained + +(** [eq_constr_univs a b] [true, c] if [a] equals [b] modulo alpha, casts, + application grouping and ignoring universe instances. *) +val eq_constr_nounivs : constr -> constr -> bool +~~~ +The `_univs` versions are doing checking of universe constraints +according to a graph, while the `_universes` are producing (non-atomic) +universe constraints. The non-atomic universe constraints include the +`ULub` constructor: when comparing `f (* u1 u2 *) c` and `f (* u1' u2' +*) c` we add ULub constraints on `u1, u1'` and `u2, u2'`. These are +treated specially: as unfolding `f` might not result in these +unifications, we need to keep track of the fact that failure to satisfy +them does not mean that the term are actually equal. This is used in +unification but probably not necessary to the average programmer. + +Another issue for ML programmers is that tables of constrs now usually +need to take a `constr Univ.in_universe_context_set` instead, and +properly refresh the universes context when using the constr, e.g. using +Clenv.refresh_undefined_univs clenv or: +~~~ocaml +(** Get fresh variables for the universe context. + Useful to make tactics that manipulate constrs in universe contexts polymorphic. *) +val fresh_universe_context_set_instance : universe_context_set -> + universe_level_subst * universe_context_set +~~~ +The substitution should be applied to the constr(s) under consideration, +and the context_set merged with the current evar_map with: +~~~ocaml +val merge_context_set : rigid -> evar_map -> Univ.universe_context_set -> evar_map +~~~ +The `rigid` flag here should be `Evd.univ_flexible` most of the +time. This means the universe levels of polymorphic objects in the +constr might get instantiated instead of generating equality constraints +(Evd.univ_rigid does that). + +On this issue, I recommend forcing commands to take `global_reference`s +only, the user can declare his specialized terms used as hints as +constants and this is cleaner. Alas, backward-compatibility-wise, +this is the only solution I found. In the case of global_references +only, it's just a matter of using `Evd.fresh_global` / +`pf_constr_of_global` to let the system take care of universes. + + +The universe graph +------------------ + +To accomodate universe polymorphic definitions, the graph structure in +kernel/univ.ml was modified. The new API forces every universe to be +declared before it is mentionned in any constraint. This forces to +declare every universe to be >= Set or > Set. Every universe variable +introduced during elaboration is >= Set. Every _global_ universe is now +declared explicitly > Set, _after_ typechecking the definition. In +polymorphic definitions Type@{i} ranges over Set and any other universe +j. However, at instantiation time for polymorphic references, one can +try to instantiate a universe parameter with Prop as well, if the +instantiated constraints allow it. The graph invariants ensure that +no universe i can be set lower than Set, so the chain of universes +always bottoms down at Prop < Set. + +Modules +------- + +One has to think of universes in modules as being globally declared, so +when including a module (type) which declares a type i (e.g. through a +parameter), we get back a copy of i and not some fresh universe. + +Incompatibilities +----------------- + +Old-style universe polymorphic definitions were implemented by taking +advantage of the fact that elaboration (i.e., pretyping and unification) +were _not_ universe aware, so some of the constraints generated during +pretypechecking would be forgotten. In the current setting, this is not +possible, as unification ensures that the substitution is built is +entirely well-typed, even w.r.t universes. This means that some terms +that type-checked before no longer do, especially projections of the +pair: +~~~coq +@fst ?x ?y : prod ?x ?y : Type (max(Datatypes.i, Datatypes.j)). +~~~ +The "template universe polymorphic" variables i and j appear during +typing without being refreshed, meaning that they can be lowered (have +upper constraints) with user-introduced universes. In most cases this +won't work, so ?x and ?y have to be instantiated earlier, either from +the type of the actual projected pair term (some t : prod A B) or the +typing constraint. Adding the correct type annotations will always fix +this. + + +Unification semantics +--------------------- + +In Ltac, matching with: + +- a universe polymorphic constant `c` matches any instance of the + constant. +- a variable ?x already bound to a term `t` (non-linear pattern) uses + strict equality of universes (e.g., Type@{i} and Type@{j} are not + equal). + +In tactics: + +- `change foo with bar`, `pattern foo` will unify all instances of `foo` + (and convert them with `bar`). This might incur unifications of + universes. `change` uses conversion while `pattern` only does + syntactic matching up-to unification of universes. +- `apply`, `refine` use unification up to universes. diff --git a/dev/doc/universes.txt b/dev/doc/universes.txt deleted file mode 100644 index a40706e9..00000000 --- a/dev/doc/universes.txt +++ /dev/null @@ -1,26 +0,0 @@ -How to debug universes? - -1. There is a command Print Universes in Coq toplevel - - Print Universes. - prints the graph of universes in the form of constraints - - Print Universes "file". - produces the "file" containing universe constraints in the form - univ1 # univ2 ; - where # can be either > >= or = - - If "file" ends with .gv or .dot, the resulting file will be in - dot format. - - - *) for dot see http://www.research.att.com/sw/tools/graphviz/ - - -2. There is a printing option - - {Set,Unset} Printing Universes. - - which, when set, makes all pretty-printed Type's annotated with the - name of the universe. - diff --git a/dev/doc/univpoly.txt b/dev/doc/univpoly.txt deleted file mode 100644 index 6a69c579..00000000 --- a/dev/doc/univpoly.txt +++ /dev/null @@ -1,279 +0,0 @@ -Notes on universe polymorphism and primitive projections, M. Sozeau -=================================================================== - -The new implementation of universe polymorphism and primitive -projections introduces a few changes to the API of Coq. First and -foremost, the term language changes, as global references now carry a -universe level substitution: - -type 'a puniverses = 'a * Univ.Instance.t -type pconstant = constant puniverses -type pinductive = inductive puniverses -type pconstructor = constructor puniverses - -type constr = ... - | Const of puniversess - | Ind of pinductive - | Constr of pconstructor - | Proj of constant * constr - - -Universes -========= - - Universe instances (an array of levels) gets substituted when -unfolding definitions, are used to typecheck and are unified according -to the rules in the ITP'14 paper on universe polymorphism in Coq. - -type Level.t = Set | Prop | Level of int * dirpath (* hashconsed *) -type Instance.t = Level.t array -type Universe.t = Level.t list (* hashconsed *) - -The universe module defines modules and abstract types for levels, -universes etc.. Structures are hashconsed (with a hack to take care -of the fact that deserialization breaks sharing). - - Definitions (constants, inductives) now carry around not only -constraints but also the universes they introduced (a Univ.UContext.t). -There is another kind of contexts [Univ.ContextSet.t], the latter has -a set of universes, while the former has serialized the levels in an -array, and is used for polymorphic objects. Both have "reified" -constraints depending on global and local universes. - - A polymorphic definition is abstract w.r.t. the variables in this -context, while a monomorphic one (or template polymorphic) just adds the -universes and constraints to the global universe context when it is put -in the environment. No other universes than the global ones and the -declared local ones are needed to check a declaration, hence the kernel -does not produce any constraints anymore, apart from module -subtyping.... There are hence two conversion functions now: [check_conv] -and [infer_conv]: the former just checks the definition in the current env -(in which we usually push_universe_context of the associated context), -and [infer_conv] which produces constraints that were not implied by the -ambient constraints. Ideally, that one could be put out of the kernel, -but currently module subtyping needs it. - - Inference of universes is now done during refinement, and the evar_map -carries the incrementally built universe context, starting from the -global universe constraints (see [Evd.from_env]). [Evd.conversion] is a -wrapper around [infer_conv] that will do the bookkeeping for you, it -uses [evar_conv_x]. There is a universe substitution being built -incrementally according to the constraints, so one should normalize at -the end of a proof (or during a proof) with that substitution just like -we normalize evars. There are some nf_* functions in -library/universes.ml to do that. Additionally, there is a minimization -algorithm in there that can be applied at the end of a proof to simplify -the universe constraints used in the term. It is heuristic but -validity-preserving. No user-introduced universe (i.e. coming from a -user-written anonymous Type) gets touched by this, only the fresh -universes generated for each global application. Using - -val pf_constr_of_global : Globnames.global_reference -> (constr -> tactic) -> tactic - -Is the way to make a constr out of a global reference in the new API. -If they constr is polymorphic, it will add the necessary constraints to -the evar_map. Even if a constr is not polymorphic, we have to take care -of keeping track of its universes. Typically, using: - - mkApp (coq_id_function, [| A; a |]) - -and putting it in a proof term is not enough now. One has to somehow -show that A's type is in cumululativity relation with id's type -argument, incurring a universe constraint. To do this, one can simply -call Typing.resolve_evars env evdref c which will do some infer_conv to -produce the right constraints and put them in the evar_map. Of course in -some cases you might know from an invariant that no new constraint would -be produced and get rid of it. Anyway the kernel will tell you if you -forgot some. As a temporary way out, [Universes.constr_of_global] allows -you to make a constr from any non-polymorphic constant, but it will fail -on polymorphic ones. - -Other than that, unification (w_unify and evarconv) now take account of universes and -produce only well-typed evar_maps. - -Some syntactic comparisons like the one used in [change] have to be -adapted to allow identification up-to-universes (when dealing with -polymorphic references), [make_eq_univs_test] is there to help. -In constr, there are actually many new comparison functions to deal with -that: - -(** [equal a b] is true if [a] equals [b] modulo alpha, casts, - and application grouping *) -val equal : constr -> constr -> bool - -(** [eq_constr_univs u a b] is [true] if [a] equals [b] modulo alpha, casts, - application grouping and the universe equalities in [u]. *) -val eq_constr_univs : constr Univ.check_function - -(** [leq_constr_univs u a b] is [true] if [a] is convertible to [b] modulo - alpha, casts, application grouping and the universe inequalities in [u]. *) -val leq_constr_univs : constr Univ.check_function - -(** [eq_constr_universes a b] [true, c] if [a] equals [b] modulo alpha, casts, - application grouping and the universe equalities in [c]. *) -val eq_constr_universes : constr -> constr -> bool Univ.universe_constrained - -(** [leq_constr_universes a b] [true, c] if [a] is convertible to [b] modulo - alpha, casts, application grouping and the universe inequalities in [c]. *) -val leq_constr_universes : constr -> constr -> bool Univ.universe_constrained - -(** [eq_constr_univs a b] [true, c] if [a] equals [b] modulo alpha, casts, - application grouping and ignoring universe instances. *) -val eq_constr_nounivs : constr -> constr -> bool - -The [_univs] versions are doing checking of universe constraints -according to a graph, while the [_universes] are producing (non-atomic) -universe constraints. The non-atomic universe constraints include the -[ULub] constructor: when comparing [f (* u1 u2 *) c] and [f (* u1' u2' -*) c] we add ULub constraints on [u1, u1'] and [u2, u2']. These are -treated specially: as unfolding [f] might not result in these -unifications, we need to keep track of the fact that failure to satisfy -them does not mean that the term are actually equal. This is used in -unification but probably not necessary to the average programmer. - -Another issue for ML programmers is that tables of constrs now usually -need to take a [constr Univ.in_universe_context_set] instead, and -properly refresh the universes context when using the constr, e.g. using -Clenv.refresh_undefined_univs clenv or: - -(** Get fresh variables for the universe context. - Useful to make tactics that manipulate constrs in universe contexts polymorphic. *) -val fresh_universe_context_set_instance : universe_context_set -> - universe_level_subst * universe_context_set - -The substitution should be applied to the constr(s) under consideration, -and the context_set merged with the current evar_map with: - -val merge_context_set : rigid -> evar_map -> Univ.universe_context_set -> evar_map - -The [rigid] flag here should be [Evd.univ_flexible] most of the -time. This means the universe levels of polymorphic objects in the -constr might get instantiated instead of generating equality constraints -(Evd.univ_rigid does that). - -On this issue, I recommend forcing commands to take [global_reference]s -only, the user can declare his specialized terms used as hints as -constants and this is cleaner. Alas, backward-compatibility-wise, -this is the only solution I found. In the case of global_references -only, it's just a matter of using [Evd.fresh_global] / -[pf_constr_of_global] to let the system take care of universes. - - -The universe graph -================== - -To accomodate universe polymorphic definitions, the graph structure in -kernel/univ.ml was modified. The new API forces every universe to be -declared before it is mentionned in any constraint. This forces to -declare every universe to be >= Set or > Set. Every universe variable -introduced during elaboration is >= Set. Every _global_ universe is now -declared explicitly > Set, _after_ typechecking the definition. In -polymorphic definitions Type@{i} ranges over Set and any other universe -j. However, at instantiation time for polymorphic references, one can -try to instantiate a universe parameter with Prop as well, if the -instantiated constraints allow it. The graph invariants ensure that -no universe i can be set lower than Set, so the chain of universes -always bottoms down at Prop < Set. - -Modules -======= - -One has to think of universes in modules as being globally declared, so -when including a module (type) which declares a type i (e.g. through a -parameter), we get back a copy of i and not some fresh universe. - -Projections -=========== - - | Proj of constant * constr - -Projections are always applied to a term, which must be of a record type -(i.e. reducible to an inductive type [I params]). Type-checking, -reduction and conversion are fast (not as fast as they could be yet) -because we don't keep parameters around. As you can see, it's currently -a [constant] that is used here to refer to the projection, that will -change to an abstract [projection] type in the future. Basically a -projection constant records which inductive it is a projection for, the -number of params and the actual position in the constructor that must be -projected. For compatibility reason, we also define an eta-expanded form -(accessible from user syntax @f). The constant_entry of a projection has -both informations. Declaring a record (under [Set Primitive -Projections]) will generate such definitions. The API to declare them is -not stable at the moment, but the inductive type declaration also knows -about the projections, i.e. a record inductive type decl contains an -array of terms representing the projections. This is used to implement -eta-conversion for record types (with at least one field and having all -projections definable). The canonical value being [Build_R (pn x) -... (pn x)]. Unification and conversion work up to this eta rule. The -records can also be universe polymorphic of course, and we don't need to -keep track of the universe instance for the projections either. -Projections are reduced _eagerly_ everywhere, and introduce a new Zproj -constructor in the abstract machines that obeys both the delta (for the -constant opacity) and iota laws (for the actual reduction). Refolding -works as well (afaict), but there is a slight hack there related to -universes (not projections). - -For the ML programmer, the biggest change is that pattern-matchings on -kind_of_term require an additional case, that is handled usually exactly -like an [App (Const p) arg]. - -There are slight hacks related to hints is well, to use the primitive -projection form of f when one does [Hint Resolve f]. Usually hint -resolve will typecheck the term, resulting in a partially applied -projection (disallowed), so we allow it to take -[constr_or_global_reference] arguments instead and special-case on -projections. Other tactic extensions might need similar treatment. - -WIP -=== - -- [vm_compute] does not deal with universes and projections correctly, -except when it goes to a normal form with no projections or polymorphic -constants left (the most common case). E.g. Ring with Set Universe -Polymorphism and Set Primitive Projections work (at least it did at some -point, I didn't recheck yet). - -- [native_compute] works with universes and projections. - - -Incompatibilities -================= - -Old-style universe polymorphic definitions were implemented by taking -advantage of the fact that elaboration (i.e., pretyping and unification) -were _not_ universe aware, so some of the constraints generated during -pretypechecking would be forgotten. In the current setting, this is not -possible, as unification ensures that the substitution is built is -entirely well-typed, even w.r.t universes. This means that some terms -that type-checked before no longer do, especially projections of the -pair: - -@fst ?x ?y : prod ?x ?y : Type (max(Datatypes.i, Datatypes.j)). - -The "template universe polymorphic" variables i and j appear during -typing without being refreshed, meaning that they can be lowered (have -upper constraints) with user-introduced universes. In most cases this -won't work, so ?x and ?y have to be instantiated earlier, either from -the type of the actual projected pair term (some t : prod A B) or the -typing constraint. Adding the correct type annotations will always fix -this. - - -Unification semantics -===================== - -In Ltac, matching with: - -- a universe polymorphic constant [c] matches any instance of the - constant. -- a variable ?x already bound to a term [t] (non-linear pattern) uses - strict equality of universes (e.g., Type@{i} and Type@{j} are not - equal). - -In tactics: - -- [change foo with bar], [pattern foo] will unify all instances of [foo] - (and convert them with [bar]). This might incur unifications of - universes. [change] uses conversion while [pattern] only does - syntactic matching up-to unification of universes. -- [apply], [refine] use unification up to universes. diff --git a/dev/doc/versions-history.tex b/dev/doc/versions-history.tex index 492e75a7..3867d4af 100644 --- a/dev/doc/versions-history.tex +++ b/dev/doc/versions-history.tex @@ -376,9 +376,27 @@ Coq V8.5 beta1 & released 21 January 2015 & \feature{computation via compilation && \feature{new proof engine deployed} [2-11-2013]\\ && \feature{universe polymorphism} [6-5-2014]\\ && \feature{primitive projections} [6-5-2014]\\ +&& \feature{miscellaneous optimizations}\\ Coq V8.5 beta2 & released 22 April 2015 & \feature{MMaps library} [4-3-2015]\\ +Coq V8.5 & released 22 January 2016 & \\ + +Coq V8.6 beta 1 & released 19 November 2016 & \feature{irrefutable patterns} [15-2-2016]\\ +&& \feature{Ltac profiling} [14-6-2016]\\ +&& \feature{warning system} [29-6-2016]\\ +&& \feature{miscellaneous optimizations}\\ + +Coq V8.6 & released 14 December 2016 & \\ + +Coq V8.7 beta 1 & released 6 September 2017 & \feature{bundled with Ssreflect plugin} [6-6-2017]\\ +&& \feature{cumulative polymorphic inductive types} [19-6-2017]\\ +&& \feature{further optimizations}\\ + +Coq V8.7 beta 2 & released 6 October 2017 & \\ + +Coq V8.7 & released 18 October 2016 & \\ + \end{tabular} \medskip diff --git a/dev/doc/xml-protocol.md b/dev/doc/xml-protocol.md new file mode 100644 index 00000000..b35571e9 --- /dev/null +++ b/dev/doc/xml-protocol.md @@ -0,0 +1,755 @@ +# Coq XML Protocol + +This document is based on documentation originally written by CJ Bell +for his [vscoq](https://github.com/siegebell/vscoq/) project. + +Here, the aim is to provide a "hands on" description of the XML +protocol that coqtop and IDEs use to communicate. The protocol first appeared +with Coq 8.5, and is used by CoqIDE. It will also be used in upcoming +versions of Proof General. + +A somewhat out-of-date description of the async state machine is +[documented here](https://github.com/ejgallego/jscoq/blob/master/etc/notes/coq-notes.md). +OCaml types for the protocol can be found in the [`ide/interface.mli` file](/ide/interface.mli). + +Changes to the XML protocol are documented as part of [`dev/doc/changes.txt`](/dev/doc/changes.txt). + +* [Commands](#commands) + - [About](#command-about) + - [Add](#command-add) + - [EditAt](#command-editAt) + - [Init](#command-init) + - [Goal](#command-goal) + - [Status](#command-status) + - [Query](#command-query) + - [Evars](#command-evars) + - [Hints](#command-hints) + - [Search](#command-search) + - [GetOptions](#command-getoptions) + - [SetOptions](#command-setoptions) + - [MkCases](#command-mkcases) + - [StopWorker](#command-stopworker) + - [PrintAst](#command-printast) + - [Annotate](#command-annotate) +* [Feedback messages](#feedback) + - [Added Axiom](#feedback-addedaxiom) + - [Processing](#feedback-processing) + - [Processed](#feedback-processed) + - [Incomplete](#feedback-incomplete) + - [Complete](#feedback-complete) + - [GlobRef](#feedback-globref) + - [Error](#feedback-error) + - [InProgress](#feedback-inprogress) + - [WorkerStatus](#feedback-workerstatus) + - [File Dependencies](#feedback-filedependencies) + - [File Loaded](#feedback-fileloaded) + - [Message](#feedback-message) + - [Custom](#feedback-custom) + +Sentences: each command sent to Coqtop is a "sentence"; they are typically terminated by ".\s" (followed by whitespace or EOF). +Examples: "Lemma a: True.", "(* asdf *) Qed.", "auto; reflexivity." +In practice, the command sentences sent to Coqtop are terminated at the "." and start with any previous whitespace. +Each sentence is assigned a unique stateId after being sent to Coq (via Add). +States: + * Processing: has been received by Coq and has no obvious syntax error (that would prevent future parsing) + * Processed: + * InProgress: + * Incomplete: the validity of the sentence cannot be checked due to a prior error + * Complete: + * Error: the sentence has an error + +State ID 0 is reserved as a 'dummy' state. + +-------------------------- + +## Commands + +### **About(unit)** +Returns information about the protocol and build dates for Coqtop. +``` + + + +``` +#### *Returns* +```html + + 8.6 + 20150913 + December 2016 + Dec 23 2016 16:16:30 + + +``` +The string fields are the Coq version, the protocol version, the release date, and the compile time of Coqtop. +The protocol version is a date in YYYYMMDD format, where "20150913" corresponds to Coq 8.6. An IDE that wishes +to support multiple Coq versions can use the protocol version information to know how to handle output from Coqtop. + +### **Add(stateId: integer, command: string, verbose: boolean)** +Adds a toplevel command (e.g. vernacular, definition, tactic) to the given state. +`verbose` controls whether out-of-band messages will be generated for the added command (e.g. "foo is assumed" in response to adding "Axiom foo: nat."). +```html + + + + ${command} + ${editId} + + + + + + + +``` + +#### *Returns* +* The added command is given a fresh `stateId` and becomes the next "tip". +```html + + + + + + ${message} + + + +``` +* When closing a focused proof (in the middle of a bunch of interpreted commands), +the `Qed` will be assigned a prior `stateId` and `nextStateId` will be the id of an already-interpreted +state that should become the next tip. +```html + + + + + + ${message} + + + +``` +* Failure: + - Syntax error. Error offsets are byte offsets (not character offsets) with respect to the start of the sentence, starting at 0. + ```html + + + ${errorMessage} + + ``` + - Another kind of error, for example, Qed with a pending goal. + ```html + ${errorMessage} + ``` + +------------------------------- + +### **EditAt(stateId: integer)** +Moves current tip to `${stateId}`, such that commands may be added to the new state ID. +```html + +``` +#### *Returns* +* Simple backtrack; focused stateId becomes the parent state +```html + + + +``` + +* New focus; focusedQedStateId is the closing Qed of the new focus; senteneces between the two should be cleared +```html + + + + + + + + + + + +``` +* Failure: If `stateId` is in an error-state and cannot be jumped to, `errorFreeStateId` is the parent state of ``stateId` that shopuld be edited instead. +```html + + + ${errorMessage} + +``` + +------------------------------- + +### **Init()** +* No options. +```html + +``` +* With options. Looking at + [ide_slave.ml](https://github.com/coq/coq/blob/c5d0aa889fa80404f6c291000938e443d6200e5b/ide/ide_slave.ml#L355), + it seems that `options` is just the name of a script file, whose path + is added via `Add LoadPath` to the initial state. +```html + + + +``` +Providing the script file enables Coq to use .aux files created during +compilation. Those file contain timing information that allow Coq to +choose smartly between asynchronous and synchronous processing of +proofs. + +#### *Returns* +* The initial stateId (not associated with a sentence) +```html + + + +``` + +------------------------------- + + +### **Goal()** +```html + +``` +#### *Returns* +* If there is a goal. `shelvedGoals` and `abandonedGoals` have the same structure as the first set of (current/foreground) goals. `backgroundGoals` contains a list of pairs of lists of goals (list ((list Goal)*(list Goal))); it represents a "focus stack" ([see code for reference](https://github.com/coq/coq/blob/trunk/engine/proofview.ml#L113)). Each time a proof is focused, it will add a new pair of lists-of-goals. The first pair is the most nested set of background goals, the last pair is the top level set of background goals. The first list in the pair is in reverse order. Each time you focus the goal (e.g. using `Focus` or a bullet), a new pair will be prefixed to the list. +```html + + + +``` + +For example, this script: +```coq +Goal P -> (1=1/\2=2) /\ (3=3 /\ (4=4 /\ 5=5) /\ 6=6) /\ 7=7. +intros. +split; split. (* current visible goals are [1=1, 2=2, 3=3/\(4=4/\5=5)/\6=6, 7=7] *) +Focus 3. (* focus on 3=3/\(4=4/\5=5)/\6=6; bg-before: [1=1, 2=2], bg-after: [7=7] *) +split; [ | split ]. (* current visible goals are [3=3, 4=4/\5=5, 6=6] *) +Focus 2. (* focus on 4=4/\5=5; bg-before: [3=3], bg-after: [6=6] *) +* (* focus again on 4=4/\5=5; bg-before: [], bg-after: [] *) +split. (* current visible goals are [4=4,5=5] *) +``` +should generate the following goals structure: +``` +goals: [ P|-4=4, P|-5=5 ] +background: +[ + ( [], [] ), (* bullet with one goal has no before or after background goals *) + ( [ P|-3=3 ], [ P|-6=6 ] ), (* Focus 2 *) + ( [ P|-2=2, P|-1=1 ], [ P|-7=7 ] ) (* Focus 3; notice that 1=1 and 2=2 are reversed *) +] +``` +Pseudocode for listing all of the goals in order: `rev (flat_map fst background) ++ goals ++ flat_map snd background`. + +* No goal: +```html + +``` + +------------------------------- + + +### **Status(force: bool)** +Returns information about the current proofs. CoqIDE typically sends this +message with `force = false` after each sentence, and with `force = true` if +the user wants to force the checking of all proofs (wheels button). In terms of +the STM API, `force` triggers a `Join`. +```html + +``` +#### *Returns* +* +```html + + ${path} + ${proofName} + ${allProofs} + ${proofNumber} + +``` + +------------------------------- + +### **Query(route_id: integer, query: string, stateId: integer)** + +`routeId` can be used to distinguish the result of a particular query, +`stateId` should be set to the state the query should be run. + +```html + + + + + ${query} + + + + +``` +#### *Returns* +* +```html + + ${message} + +``` + +Before 8.8, `Query` only executed the first command present in the +`query` string; starting with 8.8, the caller may include several +statements. This is useful for instance for temporarily setting an +option and then executing a command. + +------------------------------- + + + +### **Evars()** +```html + +``` +#### *Returns* +* +```html + + + +``` + +------------------------------- + + +### **Hints()** +```html + +``` +#### *Returns* +* +```html + + + +``` + +------------------------------- + + +### **Search([(constraintTypeN: string, constraintValueN: string, positiveConstraintN: boolean)])** +Searches for objects that satisfy a list of constraints. If `${positiveConstraint}` is `false`, then the constraint is inverted. +```html + + + + + ${constraintValue1} + + + + ... + + + + bool_rect + + + + + +``` +#### *Returns* +* +```html + + + + + ${metaInfo} + ... + + + ${name} + + ${definition} + + ... + + +``` +##### Types of constraints: +* Name pattern: `${constraintType} = "name_pattern"`; `${constraintValue}` is a regular expression string. +* Type pattern: `${constraintType} = "type_pattern"`; `${constraintValue}` is a pattern (???: an open gallina term) string. +* SubType pattern: `${constraintType} = "subtype_pattern"`; `${constraintValue}` is a pattern (???: an open gallina term) string. +* In module: `${constraintType} = "in_module"`; `${constraintValue}` is a list of strings specifying the module/directory structure. +* Include blacklist: `${constraintType} = "include_blacklist"`; `${constraintValue}` *is ommitted*. + +------------------------------- + + +### **GetOptions()** +```html + +``` +#### *Returns* +* +```html + + + + ${string1}... + + ${sync} + ${deprecated} + ${name} + ${option_value} + + + ... + + +``` + +------------------------------- + + +### **SetOptions(options)** +Sends a list of option settings, where each setting roughly looks like: +`([optionNamePart1, ..., optionNamePartN], value)`. +```html + + + + + optionNamePart1 + ... + optionNamePartN + + + + + + ... + + + + Printing + Width + + + + + + + +``` +CoqIDE sends the following settings (defaults in parentheses): +``` +Printing Width : (60), +Printing Coercions : (), +Printing Matching : (...true...) +Printing Notations : (...true...) +Printing Existential Instances : (...false...) +Printing Implicit : (...false...) +Printing All : (...false...) +Printing Universes : (...false...) +``` +#### *Returns* +* +```html + +``` + +------------------------------- + + +### **MkCases(...)** +```html +... +``` +#### *Returns* +* +```html + + + ${string1}... + ... + + +``` + +------------------------------- + + +### **StopWorker(worker: string)** +```html +${worker} +``` +#### *Returns* +* +```html + +``` + +------------------------------- + + +### **PrintAst(stateId: integer)** +```html + +``` +#### *Returns* +* +```html + + + + + + + + ... + ${token} + ... + + ... + + + ... + + +``` + +------------------------------- + + + +### **Annotate(annotation: string)** +```html +${annotation} +``` +#### *Returns* +* + +take `Theorem plus_0_r : forall n : nat, n + 0 = n.` as an example. + +```html + + + + Theorem +  plus_0_r :  + + forall +  n :  + nat + ,  + + + + + n + +  + +   + + 0 + + + +  = +   + + n + + + + + . + + +``` + +------------------------------- + +## Feedback messages + +Feedback messages are issued out-of-band, + giving updates on the current state of sentences/stateIds, + worker-thread status, etc. + +In the descriptions of feedback syntax below, wherever a `state_id` +tag may occur, there may instead be an `edit_id` tag. + +* Added Axiom: in response to `Axiom`, `admit`, `Admitted`, etc. +```html + + + + +``` +* Processing +```html + + + + ${workerName} + + +``` +* Processed +```html + + + + + +``` +* Incomplete +```html + + + + +``` +* Complete +* GlobRef +* Error. Issued, for example, when a processed tactic has failed or is unknown. +The error offsets may both be 0 if there is no particular syntax involved. +* InProgress +```html + + + + 1 + + +``` +* WorkerStatus +Ex: `workername = "proofworker:0"` +Ex: `status = "Idle"` or `status = "proof: myLemmaName"` or `status = "Dead"` +```html + + + + + ${workerName} + ${status} + + + +``` +* File Dependencies. Typically in response to a `Require`. Dependencies are *.vo files. + - State `stateId` directly depends on `dependency`: + ```html + + + + + + ``` + - State `stateId` depends on `dependency` via dependency `sourceDependency` + ```xml + + + + + ${dependency} + + + ``` +* File Loaded. For state `stateId`, module `module` is being loaded from `voFileName` +```xml + + + + ${module} + ${voFileName`} + + +``` + +* Message. `level` is one of `{info,warning,notice,error,debug}`. For example, in response to an add `"Axiom foo: nat."` with `verbose=true`, message `foo is assumed` will be emitted in response. +```xml + + + + + + ${message} + + + +``` + +* Custom. A feedback message that Coq plugins can use to return structured results, including results from Ltac profiling. Optionally, `startPos` and `stopPos` define a range of offsets in the document that the message refers to; otherwise, they will be 0. `customTag` is intended as a unique string that identifies what kind of payload is contained in `customXML`. +```xml + + + + + ${customTag} + ${customXML} + + +``` + diff --git a/dev/header b/dev/header deleted file mode 100644 index 41320517..00000000 --- a/dev/header +++ /dev/null @@ -1,7 +0,0 @@ -(************************************************************************) -(* v * The Coq Proof Assistant / The Coq Development Team *) -(* &2 echo "usage: $CALLNAME " + >&2 echo "The order of commits is as given to 'git diff'" +} + +if [ "$#" != 2 ]; +then + usage + exit 1 +fi + +BASE_COMMIT="$1" +HEAD_COMMIT="$2" + +bad=() +while IFS= read -r commit; do + echo Checking "$commit" + # git diff --check + # uses .gitattributes to know what to check + if ! git diff --check "${commit}^" "$commit"; + then + bad+=("$commit") + fi +done < <(git rev-list "$HEAD_COMMIT" --not "$BASE_COMMIT" --) + +if [ "${#bad[@]}" != 0 ] +then + >&2 echo "Whitespace errors!" + >&2 echo "In commits ${bad[*]}" + >&2 echo "If you use emacs, you can prevent this kind of error from reocurring by installing ws-butler and enabling ws-butler-convert-leading-tabs-or-spaces." + exit 1 +fi diff --git a/dev/lint-repository.sh b/dev/lint-repository.sh new file mode 100755 index 00000000..ee9c8777 --- /dev/null +++ b/dev/lint-repository.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +# A script to check prettyness over the repository. + +# lint-commits.sh seeks to prevent the worsening of already present +# problems, such as tab indentation in ml files. lint-repository.sh +# seeks to prevent the (re-)introduction of solved problems, such as +# newlines at the end of .v files. + +CODE=0 + +if [ -n "${TRAVIS_PULL_REQUEST}" ] && [ "${TRAVIS_PULL_REQUEST}" != false ]; +then + # skip PRs from before the linter existed + if [ -z "$(git ls-tree --name-only "${TRAVIS_PULL_REQUEST_SHA}" dev/lint-commits.sh)" ]; + then + 1>&2 echo "Linting skipped: pull request older than the linter." + exit 0 + fi + + # Some problems are too widespread to fix in one commit, but we + # can still check that they don't worsen. + CUR_HEAD=${TRAVIS_COMMIT_RANGE%%...*} + PR_HEAD=${TRAVIS_COMMIT_RANGE##*...} + MERGE_BASE=$(git merge-base "$CUR_HEAD" "$PR_HEAD") + dev/lint-commits.sh "$MERGE_BASE" "$PR_HEAD" || CODE=1 +fi + +# Check that the files with 'whitespace' gitattribute end in a newline. +# xargs exit status is 123 if any file failed the test +find . "(" -path ./.git -prune ")" -o -type f -print0 | + xargs -0 dev/tools/check-eof-newline.sh || CODE=1 + +exit $CODE diff --git a/dev/nsis/FileAssociation.nsh b/dev/nsis/FileAssociation.nsh deleted file mode 100644 index b8c1e5ee..00000000 --- a/dev/nsis/FileAssociation.nsh +++ /dev/null @@ -1,190 +0,0 @@ -/* -_____________________________________________________________________________ - - File Association -_____________________________________________________________________________ - - Based on code taken from http://nsis.sourceforge.net/File_Association - - Usage in script: - 1. !include "FileAssociation.nsh" - 2. [Section|Function] - ${FileAssociationFunction} "Param1" "Param2" "..." $var - [SectionEnd|FunctionEnd] - - FileAssociationFunction=[RegisterExtension|UnRegisterExtension] - -_____________________________________________________________________________ - - ${RegisterExtension} "[executable]" "[extension]" "[description]" - -"[executable]" ; executable which opens the file format - ; -"[extension]" ; extension, which represents the file format to open - ; -"[description]" ; description for the extension. This will be display in Windows Explorer. - ; - - - ${UnRegisterExtension} "[extension]" "[description]" - -"[extension]" ; extension, which represents the file format to open - ; -"[description]" ; description for the extension. This will be display in Windows Explorer. - ; - -_____________________________________________________________________________ - - Macros -_____________________________________________________________________________ - - Change log window verbosity (default: 3=no script) - - Example: - !include "FileAssociation.nsh" - !insertmacro RegisterExtension - ${FileAssociation_VERBOSE} 4 # all verbosity - !insertmacro UnRegisterExtension - ${FileAssociation_VERBOSE} 3 # no script -*/ - - -!ifndef FileAssociation_INCLUDED -!define FileAssociation_INCLUDED - -!include Util.nsh - -!verbose push -!verbose 3 -!ifndef _FileAssociation_VERBOSE - !define _FileAssociation_VERBOSE 3 -!endif -!verbose ${_FileAssociation_VERBOSE} -!define FileAssociation_VERBOSE `!insertmacro FileAssociation_VERBOSE` -!verbose pop - -!macro FileAssociation_VERBOSE _VERBOSE - !verbose push - !verbose 3 - !undef _FileAssociation_VERBOSE - !define _FileAssociation_VERBOSE ${_VERBOSE} - !verbose pop -!macroend - - - -!macro RegisterExtensionCall _EXECUTABLE _EXTENSION _DESCRIPTION - !verbose push - !verbose ${_FileAssociation_VERBOSE} - Push `${_DESCRIPTION}` - Push `${_EXTENSION}` - Push `${_EXECUTABLE}` - ${CallArtificialFunction} RegisterExtension_ - !verbose pop -!macroend - -!macro UnRegisterExtensionCall _EXTENSION _DESCRIPTION - !verbose push - !verbose ${_FileAssociation_VERBOSE} - Push `${_EXTENSION}` - Push `${_DESCRIPTION}` - ${CallArtificialFunction} UnRegisterExtension_ - !verbose pop -!macroend - - - -!define RegisterExtension `!insertmacro RegisterExtensionCall` -!define un.RegisterExtension `!insertmacro RegisterExtensionCall` - -!macro RegisterExtension -!macroend - -!macro un.RegisterExtension -!macroend - -!macro RegisterExtension_ - !verbose push - !verbose ${_FileAssociation_VERBOSE} - - Exch $R2 ;exe - Exch - Exch $R1 ;ext - Exch - Exch 2 - Exch $R0 ;desc - Exch 2 - Push $0 - Push $1 - - ReadRegStr $1 HKCR $R1 "" ; read current file association - StrCmp "$1" "" NoBackup ; is it empty - StrCmp "$1" "$R0" NoBackup ; is it our own - WriteRegStr HKCR $R1 "backup_val" "$1" ; backup current value -NoBackup: - WriteRegStr HKCR $R1 "" "$R0" ; set our file association - - ReadRegStr $0 HKCR $R0 "" - StrCmp $0 "" 0 Skip - WriteRegStr HKCR "$R0" "" "$R0" - WriteRegStr HKCR "$R0\shell" "" "open" - WriteRegStr HKCR "$R0\DefaultIcon" "" "$R2,0" -Skip: - WriteRegStr HKCR "$R0\shell\open\command" "" '"$R2" "%1"' - WriteRegStr HKCR "$R0\shell\edit" "" "Edit $R0" - WriteRegStr HKCR "$R0\shell\edit\command" "" '"$R2" "%1"' - - Pop $1 - Pop $0 - Pop $R2 - Pop $R1 - Pop $R0 - - !verbose pop -!macroend - - - -!define UnRegisterExtension `!insertmacro UnRegisterExtensionCall` -!define un.UnRegisterExtension `!insertmacro UnRegisterExtensionCall` - -!macro UnRegisterExtension -!macroend - -!macro un.UnRegisterExtension -!macroend - -!macro UnRegisterExtension_ - !verbose push - !verbose ${_FileAssociation_VERBOSE} - - Exch $R1 ;desc - Exch - Exch $R0 ;ext - Exch - Push $0 - Push $1 - - ReadRegStr $1 HKCR $R0 "" - StrCmp $1 $R1 0 NoOwn ; only do this if we own it - ReadRegStr $1 HKCR $R0 "backup_val" - StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key - DeleteRegKey HKCR $R0 - Goto NoOwn - -Restore: - WriteRegStr HKCR $R0 "" $1 - DeleteRegValue HKCR $R0 "backup_val" - DeleteRegKey HKCR $R1 ;Delete key with association name settings - -NoOwn: - - Pop $1 - Pop $0 - Pop $R1 - Pop $R0 - - !verbose pop -!macroend - -!endif # !FileAssociation_INCLUDED \ No newline at end of file diff --git a/dev/nsis/coq.nsi b/dev/nsis/coq.nsi index 80da8451..f48013cf 100755 --- a/dev/nsis/coq.nsi +++ b/dev/nsis/coq.nsi @@ -13,7 +13,7 @@ SetCompressor lzma !define MY_PRODUCT "Coq" ;Define your own software name here !define COQ_SRC_PATH "..\.." -!define OUTFILE "coq-installer-${VERSION}-${ARCH}.exe" +!define OUTFILE "coq-${VERSION}-installer-windows-${ARCH}.exe" !include "MUI2.nsh" !include "FileAssociation.nsh" diff --git a/dev/ocamldebug-coq.run b/dev/ocamldebug-coq.run index f9310e07..f3e60ede 100644 --- a/dev/ocamldebug-coq.run +++ b/dev/ocamldebug-coq.run @@ -3,22 +3,24 @@ # Wrapper around ocamldebug for Coq # This file is to be launched via the generated script ocamldebug-coq, -# which will set the env variables $OCAMLDEBUG, $CAMLP4LIB, $COQTOP +# which will set the env variables $OCAMLDEBUG, $CAMLP5LIB, $COQTOP # Anyway, just in case someone tries to use this script directly, # here are some reasonable default values [ -z "$OCAMLDEBUG" ] && OCAMLDEBUG=ocamldebug -[ -z "$CAMLP4LIB" ] && CAMLP4LIB=+camlp5 +[ -z "$CAMLP5LIB" ] && CAMLP5LIB=+camlp5 [ -z "$COQTOP" -a -d "$PWD/kernel" ] && COQTOP=$PWD [ -z "$COQTOP" -a -d "$PWD/../kernel" ] && COQTOP=`dirname $PWD` +export CAML_LD_LIBRARY_PATH=$COQTOP/kernel/byterun:$CAML_LD_LIBRARY_PATH + exec $OCAMLDEBUG \ - -I $CAMLP4LIB \ + -I $CAMLP5LIB -I +threads \ -I $COQTOP \ - -I $COQTOP/config -I $COQTOP/printing -I $COQTOP/grammar \ - -I $COQTOP/lib -I $COQTOP/intf -I $COQTOP/kernel \ + -I $COQTOP/config -I $COQTOP/printing -I $COQTOP/grammar -I $COQTOP/clib \ + -I $COQTOP/lib -I $COQTOP/intf -I $COQTOP/kernel -I $COQTOP/kernel/byterun \ -I $COQTOP/library -I $COQTOP/engine \ - -I $COQTOP/pretyping -I $COQTOP/parsing \ + -I $COQTOP/pretyping -I $COQTOP/parsing -I $COQTOP/vernac \ -I $COQTOP/interp -I $COQTOP/proofs -I $COQTOP/tactics -I $COQTOP/stm \ -I $COQTOP/toplevel -I $COQTOP/dev -I $COQTOP/config -I $COQTOP/ltac \ -I $COQTOP/plugins/cc -I $COQTOP/plugins/dp \ @@ -30,6 +32,6 @@ exec $OCAMLDEBUG \ -I $COQTOP/plugins/ring -I $COQTOP/plugins/romega \ -I $COQTOP/plugins/rtauto -I $COQTOP/plugins/setoid_ring \ -I $COQTOP/plugins/subtac -I $COQTOP/plugins/syntax \ - -I $COQTOP/plugins/xml \ + -I $COQTOP/plugins/xml -I $COQTOP/plugins/ltac \ -I $COQTOP/ide \ "$@" diff --git a/dev/printers.mllib b/dev/printers.mllib deleted file mode 100644 index 31654954..00000000 --- a/dev/printers.mllib +++ /dev/null @@ -1,219 +0,0 @@ -Coq_config - -Terminal -Hook -Canary -Hashset -Hashcons -CSet -CMap -Int -Dyn -HMap -Option -Store -Exninfo -Backtrace -IStream -Pp_control -Loc -CList -CString -Tok -Compat -Flags -Control -Loc -Serialize -Stateid -CObj -CArray -CStack -Util -Pp -Ppstyle -Richpp -Feedback -Segmenttree -Unicodetable -Unicode -CErrors -CWarnings -Bigint -CUnix -Minisys -System -Envars -Aux_file -Profile -Explore -Predicate -Rtree -Heap -Genarg -Stateid -CEphemeron -Future -RemoteCounter -Monad - -Names -Univ -UGraph -Esubst -Uint31 -Sorts -Evar -Constr -Context -Vars -Term -Mod_subst -Cbytecodes -Copcodes -Cemitcodes -Nativevalues -Primitives -Nativeinstr -Future -Opaqueproof -Declareops -Retroknowledge -Conv_oracle -Pre_env -Nativelambda -Nativecode -Nativelib -Cbytegen -Environ -CClosure -Reduction -Nativeconv -Type_errors -Modops -Inductive -Typeops -Fast_typeops -Indtypes -Cooking -Term_typing -Subtyping -Mod_typing -Nativelibrary -Safe_typing -Unionfind - -Summary -Nameops -Libnames -Globnames -Global -Nametab -Libobject -Lib -Loadpath -Goptions -Decls -Heads -Keys -Locusops -Miscops -Universes -Termops -Namegen -UState -Evd -Sigma -Glob_ops -Redops -Pretype_errors -Evarutil -Reductionops -Inductiveops -Arguments_renaming -Nativenorm -Retyping -Cbv - -Evardefine -Evarsolve -Recordops -Evarconv -Typing -Patternops -Constr_matching -Find_subterm -Tacred -Classops -Typeclasses_errors -Logic_monad -Proofview_monad -Proofview -Ftactic -Geninterp -Typeclasses -Detyping -Indrec -Program -Coercion -Cases -Pretyping -Unification -Declaremods -Library -States - -Genprint -CLexer -Ppextend -Pputils -Ppannotation -Stdarg -Constrarg -Constrexpr_ops -Genintern -Notation_ops -Notation -Dumpglob -Syntax_def -Smartlocate -Topconstr -Reserve -Impargs -Implicit_quantifiers -Constrintern -Modintern -Constrextern -Goal -Miscprint -Logic -Refiner -Clenv -Evar_refiner -Refine -Proof -Proof_global -Pfedit -Decl_mode -Ppconstr -Pcoq -Printer -Pptactic -Ppdecl_proof -Egramml -Egramcoq -Tacsubst -Trie -Dn -Btermdn -Hints -Himsg -ExplainErr -Locality -Assumptions -Vernacinterp -Dischargedhypsmap -Discharge -Declare -Ind_tables -Top_printers diff --git a/dev/set_raw_db b/dev/set_raw_db deleted file mode 100644 index 5caff7e5..00000000 --- a/dev/set_raw_db +++ /dev/null @@ -1 +0,0 @@ -install_printer Top_printers.ppconstrdb diff --git a/dev/tools/Makefile.devel b/dev/tools/Makefile.devel deleted file mode 100644 index 8dcc70cf..00000000 --- a/dev/tools/Makefile.devel +++ /dev/null @@ -1,74 +0,0 @@ -# to be linked to makefile (lowercase - takes precedence over Makefile) -# in main directory -# make devel in main directory should do this for you. - -TOPDIR=. -BASEDIR= - -SOURCEDIRS=lib kernel library pretyping parsing proofs tactics toplevel - -default: usage noargument - -usage:: - @echo Usage: make \ - @echo Targets are: - -usage:: - @echo " setup-devel -- set the devel makefile" -setup-devel: - @ln -sfv dev/tools/Makefile.devel makefile - @(for i in $(SOURCEDIRS); do \ - (cd $(TOPDIR)/$$i; ln -sfv ../dev/tools/Makefile.dir Makefile) \ - done) - - -usage:: - @echo " clean-devel -- clear all devel files" -clean-devel: - echo rm -f makefile .depend.devel - echo rm -f $(foreach dir,$(SOURCEDIRS), $(TOPDIR)/$(dir)/Makefile) - - -usage:: - @echo " coqtop -- make until the bytecode executable, make the link" -coqtop: bin/coqtop.byte - ln -sf bin/coqtop.byte coqtop - - -usage:: - @echo " quick -- make bytecode executable and states" -quick: - $(MAKE) states BEST=byte - -include Makefile - -include $(TOPDIR)/dev/tools/Makefile.common - -# this file is better described in dev/tools/Makefile.dir -include .depend.devel - -#if dev/tools/Makefile.local exists, it is included -ifneq ($(wildcard $(TOPDIR)/dev/tools/Makefile.local),) -include $(TOPDIR)/dev/tools/Makefile.local -endif - - -usage:: - @echo " total -- runs coqtop with all theories required" -total: - ledit ./bin/coqtop.byte $(foreach th,$(THEORIESVO),-require $(notdir $(basename $(th)))) - - -usage:: - @echo " run -- makes and runs bytecode coqtop using ledit and the history file" - @echo " if you want to pass arguments to coqtop, use make run ARG=" -run: $(TOPDIR)/coqtop - ledit -h $(TOPDIR)/dev/debug_history -x $(TOPDIR)/coqtop $(ARG) $(ARGS) - - -usage:: - @echo " vars -- echos commands to set COQTOP and COQBIN variables" -vars: - @(cd $(TOPDIR); \ - echo export COQTOP=`pwd`/ ; \ - echo export COQBIN=`pwd`/bin/ ) diff --git a/dev/tools/Makefile.dir b/dev/tools/Makefile.dir deleted file mode 100644 index 1a1bb90b..00000000 --- a/dev/tools/Makefile.dir +++ /dev/null @@ -1,131 +0,0 @@ -# make a link to this file if you are working hard in one directory of Coq -# ln -s ../dev/tools/Makefile.dir Makefile -# if you are working in a sub/dir/ make a link to dev/tools/Makefile.subdir instead -# this Makefile provides many useful facilities to develop Coq -# it is not completely compatible with .ml4 files unfortunately - -ifndef TOPDIR -TOPDIR=.. -endif - -# this complicated thing should work for subsubdirs as well -BASEDIR=$(shell (dir=`pwd`; cd $(TOPDIR); top=`pwd`; echo $$dir | sed -e "s|$$top/||")) - -noargs: dir - -test-dir: - @echo TOPDIR=$(TOPDIR) - @echo BASEDIR=$(BASEDIR) - -include $(TOPDIR)/dev/tools/Makefile.common - -# make this directory -dir: - $(MAKE) -C $(TOPDIR) $(notdir $(BASEDIR)) - -# make all cmo's in this directory. Useful in case the main Makefile is not -# up-to-date -all: - @( ( for i in *.ml; do \ - echo -n $(BASEDIR)/`basename $$i .ml`.cmo "" ; \ - done; \ - for i in *.ml4; do \ - echo -n $(BASEDIR)/`basename $$i .ml4`.cmo "" ; \ - done ) \ - | xargs $(MAKE) -C $(TOPDIR) ) - -# lists all files that should be compiled in this directory -list: - @(for i in *.mli; do \ - ls -l `basename $$i .mli`.cmi; \ - done) - @(for i in *.ml; do \ - ls -l `basename $$i .ml`.cmo; \ - done) - @(for i in *.ml4; do \ - ls -l `basename $$i .ml4`.cmo; \ - done) - - -clean:: - rm -f *.cmi *.cmo *.cmx *.o - - -# if grammar.cmo files cannot be compiled and main .depend cannot be -# rebuilt, this is quite useful -depend: - (cd $(TOPDIR); ocamldep -I $(BASEDIR) $(BASEDIR)/*.ml $(BASEDIR)/*.mli > .depend.devel) - - -# displays the dependency graph of the current directory (vertically, -# unlike in doc/) -graph: - (ocamldep *.ml *.mli | ocamldot | dot -Tps | gv -) & - - -# the pretty entry draws a dependency graph marking red those nodes -# which do not have their .cmo files - -.INTERMEDIATE: depend.dot depend.2.dot -.PHONY: depend.ps - -depend.dot: - ocamldep *.ml *.mli | ocamldot > $@ - -depend.2.dot: depend.dot - (i=`cat $< | wc -l`; i=`expr $$i - 1`; head -n $$i $<) > $@ - (for ml in *.ml; do \ - base=`basename $$ml .ml`; \ - fst=`echo $$base | cut -c1 | tr [:lower:] [:upper:]`; \ - rest=`echo $$base | cut -c2-`; \ - name=`echo $$fst $$rest | tr -d " "`; \ - cmo=$$base.cmo; \ - if [ ! -e $$cmo ]; then \ - echo \"$$name\" [color=red]\; >> $@;\ - fi;\ - done;\ - echo } >> $@) - -depend.ps: depend.2.dot - dot -Tps $< > $@ - -clean:: - rm -f depend.ps - -pretty: depend.ps - (gv -spartan $<; rm $<) & -# gv -spartan $< & - - - -# generating file.ml.mli by tricking make to pass -i to ocamlc - -%.ml.mli: FORCE - @(cmo=`basename $@ .ml.mli`.cmo ; \ - mv -f $$cmo $$cmo.tmp ; \ - $(MAKE) -s -C $(TOPDIR) $(BASEDIR)/$$cmo CAMLDEBUG=-i > $@ ; \ - echo Generated interface file $@ ; \ - mv -f $$cmo.tmp $$cmo) - -%.annot: FORCE - @(cmo=`basename $@ .annot`.cmo ; \ - mv -f $$cmo $$cmo.tmp ; \ - $(MAKE) -s -C $(TOPDIR) $(BASEDIR)/$$cmo CAMLDEBUG=-dtypes ; \ - echo Generated annotation file $@ ; \ - mv -f $$cmo.tmp $$cmo) - -FORCE: - -clean:: - rm -f *.ml.mli - -# this is not perfect but mostly WORKS! It just calls the main makefile - -%.cmi: FORCE - $(MAKE) -C $(TOPDIR) $(BASEDIR)/$@ - -%.cmo: FORCE - $(MAKE) -C $(TOPDIR) $(BASEDIR)/$@ - -coqtop: - $(MAKE) -C $(TOPDIR) bin/coqtop.byte diff --git a/dev/tools/Makefile.subdir b/dev/tools/Makefile.subdir deleted file mode 100644 index cb914bd1..00000000 --- a/dev/tools/Makefile.subdir +++ /dev/null @@ -1,7 +0,0 @@ -# if you work in a sub/sub-rectory of Coq -# you should make a link to that makefile -# ln -s ../../dev/tools/Makefile.subdir Makefile -# in order to have all the facilities of dev/tools/Makefile.dir - -TOPDIR=../.. -include $(TOPDIR)/dev/tools/Makefile.dir diff --git a/dev/tools/anomaly-traces-parser.el b/dev/tools/anomaly-traces-parser.el deleted file mode 100644 index 68f54266..00000000 --- a/dev/tools/anomaly-traces-parser.el +++ /dev/null @@ -1,28 +0,0 @@ -;; This Elisp snippet adds a regexp parser for the format of Anomaly -;; backtraces (coqc -bt ...), to the error parser of the Compilation -;; mode (C-c C-c: "Compile command: ..."). Once the -;; coq-change-error-alist-for-backtraces function has run, file -;; locations in traces are recognized and can be jumped from easily -;; from the *compilation* buffer. - -;; You can just copy everything below to your .emacs and this will be -;; enabled from any compilation command launched from an OCaml file. - -(defun coq-change-error-alist-for-backtraces () - "Hook to change the compilation-error-regexp-alist variable, to - search the coq backtraces for error locations" - (interactive) - (add-to-list - 'compilation-error-regexp-alist-alist - '(coq-backtrace - "^ *\\(?:raise\\|frame\\) @ file \\(\"?\\)\\([^,\" \n\t<>]+\\)\\1,\ - lines? \\([0-9]+\\)-?\\([0-9]+\\)?\\(?:$\\|,\ - \\(?: characters? \\([0-9]+\\)-?\\([0-9]+\\)?:?\\)?\\)" - 2 (3 . 4) (5 . 6))) - (add-to-list 'compilation-error-regexp-alist 'coq-backtrace)) - -;; this Anomaly parser should be available when one is hacking -;; on the *OCaml* code of Coq (adding bugs), so we enable it -;; through the OCaml mode hooks. -(add-hook 'caml-mode-hook 'coq-change-error-alist-for-backtraces) -(add-hook 'tuareg-mode-hook 'coq-change-error-alist-for-backtraces) diff --git a/dev/tools/backport-pr.sh b/dev/tools/backport-pr.sh new file mode 100755 index 00000000..e4359f70 --- /dev/null +++ b/dev/tools/backport-pr.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash + +# Usage: dev/tools/backport-pr.sh [--stop-before-merging] + +set -e + +PRNUM=$1 +OPTION=$2 + +if ! git log master --grep "Merge PR #${PRNUM}" | grep "." > /dev/null; then + echo "PR #${PRNUM} does not exist." + exit 1 +fi + +SIGNATURE_STATUS=$(git log master --grep "Merge PR #${PRNUM}" --format="%G?") +git log master --grep "Merge PR #${PRNUM}" --format="%GG" +if [[ "${SIGNATURE_STATUS}" != "G" ]]; then + echo + read -p "Merge commit does not have a good (valid) signature. Bypass? [y/N] " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + exit 1 + fi +fi + +BRANCH=backport-pr-${PRNUM} +RANGE=$(git log master --grep "Merge PR #${PRNUM}" --format="%P" | sed 's/ /../') +MESSAGE=$(git log master --grep "Merge PR #${PRNUM}" --format="%s" | sed 's/Merge/Backport/') + +if git checkout -b ${BRANCH}; then + + if ! git cherry-pick -x ${RANGE}; then + echo "Please fix the conflicts, then exit." + bash + while ! git cherry-pick --continue; do + echo "Please fix the conflicts, then exit." + bash + done + fi + git checkout - + +else + + echo + read -p "Skip directly to merging phase? [y/N] " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + exit 1 + fi + +fi + +if ! git diff --exit-code HEAD ${BRANCH} -- "*.mli"; then + echo + read -p "Some mli files are modified. Bypass? [y/N] " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + exit 1 + fi +fi + +if [[ "${OPTION}" == "--stop-before-merging" ]]; then + exit 0 +fi + +git merge -S --no-ff ${BRANCH} -m "${MESSAGE}" +git branch -d ${BRANCH} + +# To-Do: +# - Support for backporting a PR before it is merged +# - Automatically backport all PRs in the "Waiting to be backported" column using a command like: +# $ curl -s -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.inertia-preview+json" https://api.github.com/projects/columns/1358120/cards | jq -r '.[].content_url' | grep issue | sed 's/^.*issues\/\([0-9]*\)$/\1/' | tac +# (The ID of the column must first be obtained through https://api.github.com/repos/coq/coq/projects then https://api.github.com/projects/819866/columns.) +# - Then move each of the backported PR to the subsequent columns automatically as well... diff --git a/dev/tools/check-eof-newline.sh b/dev/tools/check-eof-newline.sh new file mode 100755 index 00000000..e244d9ab --- /dev/null +++ b/dev/tools/check-eof-newline.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +# Usage: check-eof-newline.sh [--fix] FILES... +# Detect missing end of file newlines for FILES. +# Files are skipped if untracked by git and depending on gitattributes. +# With --fix, automatically append a newline. +# Exit status: +# Without --fix: 1 if any file had a missing newline, 0 otherwise. +# With --fix: 1 if any non writable file had a missing newline, 0 otherwise. + +FIX= +if [ "$1" = --fix ]; +then + FIX=1 + shift +fi + +CODE=0 +for f in "$@"; do + if git ls-files --error-unmatch "$f" >/dev/null 2>&1 && \ + git check-attr whitespace -- "$f" | grep -q -v -e 'unset$' -e 'unspecified$' && \ + [ -n "$(tail -c 1 "$f")" ] + then + if [ -n "$FIX" ]; + then + if [ -w "$f" ]; + then + echo >> "$f" + echo "Newline appended to file $f!" + else + echo "File $f is missing a newline and not writable!" + CODE=1 + fi + else + echo "No newline at end of file $f!" + CODE=1 + fi + fi +done + +exit "$CODE" diff --git a/dev/tools/coqdev.el b/dev/tools/coqdev.el new file mode 100644 index 00000000..62fdaec8 --- /dev/null +++ b/dev/tools/coqdev.el @@ -0,0 +1,107 @@ +;;; coqdev.el --- Emacs helpers for Coq development -*- lexical-binding:t -*- + +;; Copyright (C) 2018 The Coq Development Team + +;; Maintainer: coqdev@inria.fr + +;;; Commentary: + +;; Helpers to set compilation commands, proof general variables, etc +;; for Coq development + +;; You can disable individual features without editing this file by +;; using `remove-hook', for instance +;; (remove-hook 'hack-local-variables-hook #'coqdev-setup-compile-command) + +;;; Installation: + +;; To use this, with coqdev.el located at /path/to/coqdev.el, add the +;; following to your init: + +;; (add-to-list 'load-path "/path/to/coqdev/") +;; (require 'coqdev) + +;; If you load this file from a git repository, checking out an old +;; commit will make it disappear and cause errors for your Emacs +;; startup. To ignore those errors use (require 'coqdev nil t). If you +;; check out a malicious commit Emacs startup would allow it to run +;; arbitrary code, to avoid this you can copy coqdev.el to any +;; location and adjust the load path accordingly (of course if you run +;; ./configure to compile Coq it is already too late). + +;;; Code: + +(defun coqdev-default-directory () + "Return the Coq repository containing `default-directory'." + (let ((dir (locate-dominating-file default-directory "META.coq"))) + (when dir (expand-file-name dir)))) + +(defun coqdev-setup-compile-command () + "Setup `compile-command' for Coq development." + (let ((dir (coqdev-default-directory))) + ;; we add a space at the end to make it easy to add arguments (eg -j or target) + (when dir (setq-local compile-command (concat "make -C " (shell-quote-argument dir) " "))))) +(add-hook 'hack-local-variables-hook #'coqdev-setup-compile-command) + +(defvar camldebug-command-name) ; from camldebug.el (caml package) +(defvar ocamldebug-command-name) ; from ocamldebug.el (tuareg package) +(defun coqdev-setup-camldebug () + "Setup ocamldebug for Coq development. + +Specifically `camldebug-command-name' and `ocamldebug-command-name'." + (let ((dir (coqdev-default-directory))) + (when dir + (setq-local camldebug-command-name + (concat dir "dev/ocamldebug-coq")) + (setq-local ocamldebug-command-name + (concat dir "dev/ocamldebug-coq"))))) +(add-hook 'hack-local-variables-hook #'coqdev-setup-camldebug) + +(defun coqdev-setup-tags () + "Setup `tags-file-name' for Coq development." + (let ((dir (coqdev-default-directory))) + (when dir (setq-local tags-file-name (concat dir "TAGS"))))) +(add-hook 'hack-local-variables-hook #'coqdev-setup-tags) + +(defvar coq-prog-args) +(defvar coq-prog-name) + +;; Lets us detect whether there are file local variables +;; even though PG sets it with `setq' when there's a _Coqproject. +;; Also makes sense generally, so might make it into PG someday. +(make-variable-buffer-local 'coq-prog-args) +(setq-default coq-prog-args nil) + +(defun coqdev-setup-proofgeneral () + "Setup Proofgeneral variables for Coq development. + +Note that this function is executed before _Coqproject is read if it exists." + (let ((dir (coqdev-default-directory))) + (when dir + (unless coq-prog-args + (setq coq-prog-args + `("-coqlib" ,dir "-R" ,(concat dir "plugins") + "Coq" "-R" ,(concat dir "theories") + "Coq"))) + (setq-local coq-prog-name (concat dir "bin/coqtop"))))) +(add-hook 'hack-local-variables-hook #'coqdev-setup-proofgeneral) + +;; This Elisp snippet adds a regexp parser for the format of Anomaly +;; backtraces (coqc -bt ...), to the error parser of the Compilation +;; mode (C-c C-c: "Compile command: ..."). File locations in traces +;; are recognized and can be jumped from easily in the *compilation* +;; buffer. +(defvar compilation-error-regexp-alist-alist) +(defvar compilation-error-regexp-alist) +(with-eval-after-load 'compile + (add-to-list + 'compilation-error-regexp-alist-alist + '(coq-backtrace + "^ *\\(?:raise\\|frame\\) @ file \\(\"?\\)\\([^,\" \n\t<>]+\\)\\1,\ + lines? \\([0-9]+\\)-?\\([0-9]+\\)?\\(?:$\\|,\ + \\(?: characters? \\([0-9]+\\)-?\\([0-9]+\\)?:?\\)?\\)" + 2 (3 . 4) (5 . 6))) + (add-to-list 'compilation-error-regexp-alist 'coq-backtrace)) + +(provide 'coqdev) +;;; coqdev ends here diff --git a/dev/tools/github-check-prs.py b/dev/tools/github-check-prs.py new file mode 100755 index 00000000..beb26d91 --- /dev/null +++ b/dev/tools/github-check-prs.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 + +# Requires PyGithub https://pypi.python.org/pypi/PyGithub, for instance +# debian package: python3-github +# nix: nix-shell -p python3 python3Packages.PyGithub --run ./github-check-rebase.py +from github import Github +import argparse + +REPO = "coq/coq" +REBASE_LABEL="needs: rebase" + +parser = argparse.ArgumentParser() +parser.add_argument("--token-file", type=argparse.FileType('r')) +args = parser.parse_args() + +if args.token_file is None: + token = input("Github access token: ").strip() +else: + token = args.token_file.read().rstrip("\n") + args.token_file.close() + +if token == "": + print ("Warning: using the GitHub API without a token") + print ("We may run into rate limit issues") + g = Github() +else: + g = Github(token) + +repo = g.get_repo(REPO) + +for pull in repo.get_pulls(): + # if conflicts then dirty + # otherwise blocked (because I have no rights) + dirty = pull.mergeable_state == "dirty" + labelled = False + for label in repo.get_issue(pull.number).get_labels(): + if label.name == REBASE_LABEL: + labelled = True + if labelled and not dirty: + print ("PR #" + str(pull.number) + " is not dirty but is labelled") + print ("("+ pull.html_url +")") + elif dirty and not labelled: + print ("PR #" + str(pull.number) + " is dirty and not labelled") + print ("("+ pull.html_url +")") + else: + # give some feedback so the user can see we didn't crash + print ("PR #" + str(pull.number) + " OK") diff --git a/dev/tools/merge-pr.sh b/dev/tools/merge-pr.sh new file mode 100755 index 00000000..9f24960f --- /dev/null +++ b/dev/tools/merge-pr.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + +set -e + +# This script depends (at least) on git and jq. +# It should be used like this: dev/tools/merge-pr.sh /PR number/ + +#TODO: check arguments and show usage if relevant + +PR=$1 + +CURRENT_LOCAL_BRANCH=$(git rev-parse --abbrev-ref HEAD) +REMOTE=$(git config --get "branch.$CURRENT_LOCAL_BRANCH.remote") +git fetch "$REMOTE" "refs/pull/$PR/head" + +API=https://api.github.com/repos/coq/coq + +BASE_BRANCH=$(curl -s "$API/pulls/$PR" | jq -r '.base.label') + +COMMIT=$(git rev-parse FETCH_HEAD) +STATUS=$(curl -s "$API/commits/$COMMIT/status" | jq -r '.state') + +if [ "$BASE_BRANCH" != "coq:$CURRENT_LOCAL_BRANCH" ]; then + echo "Wrong base branch" + read -p "Bypass? [y/N] " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]] + then + exit 1 + fi +fi; + +if [ "$STATUS" != "success" ]; then + echo "CI status is \"$STATUS\"" + read -p "Bypass? [y/N] " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]] + then + exit 1 + fi +fi; + +git merge -S --no-ff FETCH_HEAD -m "Merge PR #$PR: $(curl -s "$API/pulls/$PR" | jq -r '.title')" -e + +# TODO: improve this check +if ! git diff --quiet "$REMOTE/$CURRENT_LOCAL_BRANCH" -- dev/ci; then + echo "******************************************" + echo "** WARNING: does this PR have overlays? **" + echo "******************************************" +fi diff --git a/dev/tools/pre-commit b/dev/tools/pre-commit new file mode 100755 index 00000000..dfa95bac --- /dev/null +++ b/dev/tools/pre-commit @@ -0,0 +1,73 @@ +#!/bin/sh + +# configure automatically sets up a wrapper at .git/hooks/pre-commit +# which calls this script (if it exists). + +set -e + +if ! git diff --cached --name-only -z | xargs -0 dev/tools/check-eof-newline.sh || + ! git diff-index --check --cached HEAD >/dev/null 2>&1 ; +then + 1>&2 echo "Auto fixing whitespace issues..." + + # We fix whitespace in the index and in the working tree + # separately to preserve non-added changes. + index=$(mktemp "git-fix-ws-index.XXXXXX") + fixed_index=$(mktemp "git-fix-ws-index-fixed.XXXXXX") + tree=$(mktemp "git-fix-ws-tree.XXXXXX") + 1>&2 echo "Patches are saved in '$index', '$fixed_index' and '$tree'." + 1>&2 echo "If an error destroys your changes you can recover using them." + 1>&2 echo "(The files are cleaned up on success.)" + 1>&2 echo #newline + + git diff-index -p --cached HEAD > "$index" + git diff-index -p HEAD > "$tree" + + # reset work tree and index + # NB: untracked files which were not added are untouched + git apply --whitespace=nowarn --cached -R "$index" + git apply --whitespace=nowarn -R "$tree" + + # Fix index + # For end of file newlines we must go through the worktree + 1>&2 echo "Fixing staged changes..." + git apply --cached --whitespace=fix "$index" + git apply --whitespace=fix "$index" 2>/dev/null # no need to repeat yourself + git diff --cached --name-only -z | xargs -0 dev/tools/check-eof-newline.sh --fix + git add -u + 1>&2 echo #newline + + # reset work tree + git diff-index -p --cached HEAD > "$fixed_index" + # If all changes were bad whitespace changes the patch is empty + # making git fail. Don't fail now: we fix the worktree first. + if [ -s "$fixed_index" ] + then + git apply --whitespace=nowarn -R "$fixed_index" + fi + + # Fix worktree + 1>&2 echo "Fixing unstaged changes..." + git apply --whitespace=fix "$tree" + git diff --name-only -z | xargs -0 dev/tools/check-eof-newline.sh --fix + 1>&2 echo #newline + + if ! [ -s "$fixed_index" ] + then + 1>&2 echo "No changes after fixing whitespace issues!" + exit 1 + fi + + # Check that we did fix whitespace + if ! git diff-index --check --cached HEAD; + then + 1>&2 echo "Auto-fixing whitespace failed: errors remain." + 1>&2 echo "This may fix itself if you try again." + 1>&2 echo "(Consider whether the number of errors decreases after each run.)" + exit 1 + fi + 1>&2 echo "Whitespace issues fixed!" + + # clean up temporary files + rm "$index" "$tree" "$fixed_index" +fi diff --git a/dev/tools/sudo-apt-get-update.sh b/dev/tools/sudo-apt-get-update.sh new file mode 100755 index 00000000..f8bf6bed --- /dev/null +++ b/dev/tools/sudo-apt-get-update.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +(sudo apt-get update "$@" 2>&1 || echo 'E: update failed') | tee /tmp/apt.err +! grep -q '^\(E:\|W: Failed to fetch\)' /tmp/apt.err || exit $? diff --git a/dev/top_printers.ml b/dev/top_printers.ml index a3d5cf5c..ba0c5440 100644 --- a/dev/top_printers.ml +++ b/dev/top_printers.ml @@ -1,24 +1,25 @@ (************************************************************************) -(* v * The Coq Proof Assistant / The Coq Development Team *) -(* raise Not_found) +let _ = Detyping.set_detype_anonymous (fun ?loc _ -> raise Not_found) (* std_ppcmds *) -let pp x = Pp.pp_with !Pp_control.std_ft x +let pp x = Pp.pp_with !Topfmt.std_ft x (** Future printer *) let ppfuture kx = pp (Future.print (fun _ -> str "_") kx) (* name printers *) -let ppid id = pp (pr_id id) -let pplab l = pp (pr_lab l) +let ppid id = pp (Id.print id) +let pplab l = pp (Label.print l) let ppmbid mbid = pp (str (MBId.debug_to_string mbid)) -let ppdir dir = pp (pr_dirpath dir) +let ppdir dir = pp (DirPath.print dir) let ppmp mp = pp(str (ModPath.debug_to_string mp)) -let ppcon con = pp(debug_pr_con con) -let ppproj con = pp(debug_pr_con (Projection.constant con)) +let ppcon con = pp(Constant.debug_print con) +let ppproj con = pp(Constant.debug_print (Projection.constant con)) let ppkn kn = pp(str (KerName.to_string kn)) -let ppmind kn = pp(debug_pr_mind kn) -let ppind (kn,i) = pp(debug_pr_mind kn ++ str"," ++int i) +let ppmind kn = pp(MutInd.debug_print kn) +let ppind (kn,i) = pp(MutInd.debug_print kn ++ str"," ++int i) let ppsp sp = pp(pr_path sp) let ppqualid qid = pp(pr_qualid qid) let ppclindex cl = pp(Classops.pr_cl_index cl) let ppscheme k = pp (Ind_tables.pr_scheme_kind k) -let pprecarg = function +let prrecarg = function | Declarations.Norec -> str "Norec" | Declarations.Mrec (mind,i) -> str "Mrec[" ++ MutInd.print mind ++ pr_comma () ++ int i ++ str "]" | Declarations.Imbr (mind,i) -> str "Imbr[" ++ MutInd.print mind ++ pr_comma () ++ int i ++ str "]" -let ppwf_paths x = pp (Rtree.pp_tree pprecarg x) - -let pprecarg = function - | Declarations.Norec -> str "Norec" - | Declarations.Mrec (mind,i) -> - str "Mrec[" ++ MutInd.print mind ++ pr_comma () ++ int i ++ str "]" - | Declarations.Imbr (mind,i) -> - str "Imbr[" ++ MutInd.print mind ++ pr_comma () ++ int i ++ str "]" -let ppwf_paths x = pp (Rtree.pp_tree pprecarg x) +let ppwf_paths x = pp (Rtree.pp_tree prrecarg x) (* term printers *) +let envpp pp = let sigma,env = Pfedit.get_current_context () in pp env sigma let rawdebug = ref false -let ppevar evk = pp (str (Evd.string_of_existential evk)) -let ppconstr x = pp (Termops.print_constr x) +let ppevar evk = pp (Evar.print evk) +let ppconstr x = pp (Termops.print_constr (EConstr.of_constr x)) +let ppeconstr x = pp (Termops.print_constr x) let ppconstr_expr x = pp (Ppconstr.pr_constr_expr x) -let ppconstrdb x = pp(Flags.with_option rawdebug Termops.print_constr x) -let ppterm = ppconstr let ppsconstr x = ppconstr (Mod_subst.force_constr x) let ppconstr_univ x = Constrextern.with_universes ppconstr x -let ppglob_constr = (fun x -> pp(pr_lglob_constr x)) -let pppattern = (fun x -> pp(pr_constr_pattern x)) -let pptype = (fun x -> try pp(pr_ltype x) with e -> pp (str (Printexc.to_string e))) +let ppglob_constr = (fun x -> pp(pr_lglob_constr_env (Global.env()) x)) +let pppattern = (fun x -> pp(envpp pr_constr_pattern_env x)) +let pptype = (fun x -> try pp(envpp pr_ltype_env x) with e -> pp (str (Printexc.to_string e))) let ppfconstr c = ppconstr (CClosure.term_of_fconstr c) let ppbigint n = pp (str (Bigint.to_string n));; let prset pr l = str "[" ++ hov 0 (prlist_with_sep spc pr l) ++ str "]" let ppintset l = pp (prset int (Int.Set.elements l)) -let ppidset l = pp (prset pr_id (Id.Set.elements l)) +let ppidset l = pp (prset Id.print (Id.Set.elements l)) let prset' pr l = str "[" ++ hov 0 (prlist_with_sep pr_comma pr l) ++ str "]" let pridmap pr l = - let pr (id,b) = pr_id id ++ str "=>" ++ pr id b in + let pr (id,b) = Id.print id ++ str "=>" ++ pr id b in prset' pr (Id.Map.fold (fun a b l -> (a,b)::l) l []) - let ppidmap pr l = pp (pridmap pr l) +let pridmapgen l = + let dom = Id.Set.elements (Id.Map.domain l) in + if dom = [] then str "[]" else + str "[domain= " ++ hov 0 (prlist_with_sep spc Id.print dom) ++ str "]" +let ppidmapgen l = pp (pridmapgen l) + let ppevarsubst = ppidmap (fun id0 -> prset (fun (c,copt,id) -> hov 0 - (Termops.print_constr c ++ + (Termops.print_constr (EConstr.of_constr c) ++ (match copt with None -> mt () | Some c -> spc () ++ str "") ++ + Termops.print_constr (EConstr.of_constr c) ++ str">") ++ (if id = id0 then mt () - else spc () ++ str "")))) + else spc () ++ str "")))) -let prididmap = pridmap (fun _ -> pr_id) -let ppididmap = ppidmap (fun _ -> pr_id) +let prididmap = pridmap (fun _ -> Id.print) +let ppididmap = ppidmap (fun _ -> Id.print) let prconstrunderbindersidmap = pridmap (fun _ (l,c) -> hov 1 (str"[" ++ prlist_with_sep spc Id.print l ++ str"]") @@ -113,10 +111,9 @@ let prconstrunderbindersidmap = pridmap (fun _ (l,c) -> let ppconstrunderbindersidmap l = pp (prconstrunderbindersidmap l) let ppunbound_ltac_var_map l = ppidmap (fun _ arg -> - str"") - -open Glob_term + str"") l +open Ltac_pretype let rec pr_closure {idents=idents;typed=typed;untyped=untyped} = hov 1 (str"{idents=" ++ prididmap idents ++ str";" ++ spc() ++ str"typed=" ++ prconstrunderbindersidmap typed ++ str";" ++ spc() ++ @@ -124,7 +121,7 @@ let rec pr_closure {idents=idents;typed=typed;untyped=untyped} = and pr_closed_glob_constr_idmap x = pridmap (fun _ -> pr_closed_glob_constr) x and pr_closed_glob_constr {closure=closure;term=term} = - pr_closure closure ++ pr_lglob_constr term + pr_closure closure ++ (pr_lglob_constr_env Global.(env ())) term let ppclosure x = pp (pr_closure x) let ppclosedglobconstr x = pp (pr_closed_glob_constr x) @@ -133,40 +130,40 @@ let ppclosedglobconstridmap x = pp (pr_closed_glob_constr_idmap x) let pP s = pp (hov 0 s) let safe_pr_global = function - | ConstRef kn -> pp (str "CONSTREF(" ++ debug_pr_con kn ++ str ")") - | IndRef (kn,i) -> pp (str "INDREF(" ++ debug_pr_mind kn ++ str "," ++ + | ConstRef kn -> pp (str "CONSTREF(" ++ Constant.debug_print kn ++ str ")") + | IndRef (kn,i) -> pp (str "INDREF(" ++ MutInd.debug_print kn ++ str "," ++ int i ++ str ")") - | ConstructRef ((kn,i),j) -> pp (str "INDREF(" ++ debug_pr_mind kn ++ str "," ++ + | ConstructRef ((kn,i),j) -> pp (str "INDREF(" ++ MutInd.debug_print kn ++ str "," ++ int i ++ str "," ++ int j ++ str ")") - | VarRef id -> pp (str "VARREF(" ++ pr_id id ++ str ")") + | VarRef id -> pp (str "VARREF(" ++ Id.print id ++ str ")") let ppglobal x = try pp(pr_global x) with _ -> safe_pr_global x let ppconst (sp,j) = - pp (str"#" ++ pr_kn sp ++ str"=" ++ pr_lconstr j.uj_val) + pp (str"#" ++ KerName.print sp ++ str"=" ++ envpp pr_lconstr_env j.uj_val) let ppvar ((id,a)) = - pp (str"#" ++ pr_id id ++ str":" ++ pr_lconstr a) + pp (str"#" ++ Id.print id ++ str":" ++ envpp pr_lconstr_env a) let genppj f j = let (c,t) = f j in (c ++ str " : " ++ t) -let ppj j = pp (genppj pr_ljudge j) +let ppj j = pp (genppj (envpp pr_ljudge_env) j) -let prsubst s = pp (Mod_subst.debug_pr_subst s) -let prdelta s = pp (Mod_subst.debug_pr_delta s) +let ppsubst s = pp (Mod_subst.debug_pr_subst s) +let ppdelta s = pp (Mod_subst.debug_pr_delta s) let pp_idpred s = pp (pr_idpred s) let pp_cpred s = pp (pr_cpred s) let pp_transparent_state s = pp (pr_transparent_state s) -let pp_stack_t n = pp (Reductionops.Stack.pr Termops.print_constr n) +let pp_stack_t n = pp (Reductionops.Stack.pr (EConstr.of_constr %> Termops.print_constr) n) let pp_cst_stack_t n = pp (Reductionops.Cst_stack.pr n) let pp_state_t n = pp (Reductionops.pr_state n) (* proof printers *) let pr_evar ev = Pp.int (Evar.repr ev) -let ppmetas metas = pp(pr_metaset metas) -let ppevm evd = pp(pr_evar_map ~with_univs:!Flags.univ_print (Some 2) evd) -let ppevmall evd = pp(pr_evar_map ~with_univs:!Flags.univ_print None evd) +let ppmetas metas = pp(Termops.pr_metaset metas) +let ppevm evd = pp(Termops.pr_evar_map ~with_univs:!Flags.univ_print (Some 2) evd) +let ppevmall evd = pp(Termops.pr_evar_map ~with_univs:!Flags.univ_print None evd) let pr_existentialset evars = prlist_with_sep spc pr_evar (Evar.Set.elements evars) let ppexistentialset evars = @@ -177,14 +174,14 @@ let ppexistentialfilter filter = match Evd.Filter.repr filter with let ppclenv clenv = pp(pr_clenv clenv) let ppgoalgoal gl = pp(Goal.pr_goal gl) let ppgoal g = pp(Printer.pr_goal g) -let ppgoalsigma g = pp(Printer.pr_goal g ++ pr_evar_map None (Refiner.project g)) -let pphintdb db = pp(Hints.pr_hint_db db) +let ppgoalsigma g = pp(Printer.pr_goal g ++ Termops.pr_evar_map None (Refiner.project g)) +let pphintdb db = pp(envpp Hints.pr_hint_db_env db) let ppproofview p = let gls,sigma = Proofview.proofview p in - pp(pr_enum Goal.pr_goal gls ++ fnl () ++ pr_evar_map (Some 1) sigma) + pp(pr_enum Goal.pr_goal gls ++ fnl () ++ Termops.pr_evar_map (Some 1) sigma) let ppopenconstr (x : Evd.open_constr) = - let (evd,c) = x in pp (pr_evar_map (Some 2) evd ++ pr_constr c) + let (evd,c) = x in pp (Termops.pr_evar_map (Some 2) evd ++ envpp pr_constr_env c) (* spiwack: deactivated until a replacement is found let pppftreestate p = pp(print_pftreestate p) *) @@ -200,11 +197,11 @@ let pppftreestate p = pp(print_pftreestate p) (* let ppsigmagoal g = pp(pr_goal (sig_it g)) *) (* let prgls gls = pp(pr_gls gls) *) (* let prglls glls = pp(pr_glls glls) *) -(* let pproof p = pp(print_proof Evd.empty empty_named_context p) *) -let ppuni u = pp(pr_uni u) +let pproof p = pp(Proof.pr_proof p) + +let ppuni u = pp(Universe.pr u) let ppuni_level u = pp (Level.pr u) -let ppuniverse u = pp (str"[" ++ Universe.pr u ++ str"]") let prlev = Universes.pr_with_global_universes let ppuniverse_set l = pp (LSet.pr prlev l) @@ -214,12 +211,14 @@ let ppuniverse_context_set l = pp (pr_universe_context_set prlev l) let ppuniverse_subst l = pp (Univ.pr_universe_subst l) let ppuniverse_opt_subst l = pp (Universes.pr_universe_opt_subst l) let ppuniverse_level_subst l = pp (Univ.pr_universe_level_subst l) -let ppevar_universe_context l = pp (Evd.pr_evar_universe_context l) +let ppevar_universe_context l = pp (Termops.pr_evar_universe_context l) let ppconstraints c = pp (pr_constraints Level.pr c) let ppuniverseconstraints c = pp (Universes.Constraints.pr c) let ppuniverse_context_future c = let ctx = Future.force c in ppuniverse_context ctx +let ppcumulativity_info c = pp (Univ.pr_cumulativity_info Univ.Level.pr c) +let ppabstract_cumulativity_info c = pp (Univ.pr_abstract_cumulativity_info Univ.Level.pr c) let ppuniverses u = pp (UGraph.pr_universes Level.pr u) let ppnamedcontextval e = pp (pr_named_context (Global.env ()) Evd.empty (named_context_of_val e)) @@ -231,9 +230,9 @@ let ppenv e = pp let ppenvwithcst e = pp (str "[" ++ pr_named_context_of e Evd.empty ++ str "]" ++ spc() ++ str "[" ++ pr_rel_context e Evd.empty (rel_context e) ++ str "]" ++ spc() ++ - str "{" ++ Cmap_env.fold (fun a _ s -> pr_con a ++ spc () ++ s) (Obj.magic e).Pre_env.env_globals.Pre_env.env_constants (mt ()) ++ str "}") + str "{" ++ Cmap_env.fold (fun a _ s -> Constant.print a ++ spc () ++ s) (Obj.magic e).Pre_env.env_globals.Pre_env.env_constants (mt ()) ++ str "}") -let pptac = (fun x -> pp(Pptactic.pr_glob_tactic (Global.env()) x)) +let pptac = (fun x -> pp(Ltac_plugin.Pptactic.pr_glob_tactic (Global.env()) x)) let ppobj obj = Format.print_string (Libobject.object_tag obj) @@ -247,7 +246,7 @@ let cast_kind_display k = | NATIVEcast -> "NATIVEcast" let constr_display csr = - let rec term_display c = match kind_of_term c with + let rec term_display c = match kind c with | Rel n -> "Rel("^(string_of_int n)^")" | Meta n -> "Meta("^(string_of_int n)^")" | Var id -> "Var("^(Id.to_string id)^")" @@ -262,14 +261,14 @@ let constr_display csr = "LetIn("^(name_display na)^","^(term_display b)^"," ^(term_display t)^","^(term_display c)^")" | App (c,l) -> "App("^(term_display c)^","^(array_display l)^")\n" - | Evar (e,l) -> "Evar("^(string_of_existential e)^","^(array_display l)^")" - | Const (c,u) -> "Const("^(string_of_con c)^","^(universes_display u)^")" + | Evar (e,l) -> "Evar("^(Pp.string_of_ppcmds (Evar.print e))^","^(array_display l)^")" + | Const (c,u) -> "Const("^(Constant.to_string c)^","^(universes_display u)^")" | Ind ((sp,i),u) -> - "MutInd("^(string_of_mind sp)^","^(string_of_int i)^","^(universes_display u)^")" + "MutInd("^(MutInd.to_string sp)^","^(string_of_int i)^","^(universes_display u)^")" | Construct (((sp,i),j),u) -> - "MutConstruct(("^(string_of_mind sp)^","^(string_of_int i)^")," + "MutConstruct(("^(MutInd.to_string sp)^","^(string_of_int i)^")," ^","^(universes_display u)^(string_of_int j)^")" - | Proj (p, c) -> "Proj("^(string_of_con (Projection.constant p))^","^term_display c ^")" + | Proj (p, c) -> "Proj("^(Constant.to_string (Projection.constant p))^","^term_display c ^")" | Case (ci,p,c,bl) -> "MutCase(,"^(term_display p)^","^(term_display c)^"," ^(array_display bl)^")" @@ -316,10 +315,12 @@ let constr_display csr = in pp (str (term_display csr) ++fnl ()) +let econstr_display c = constr_display EConstr.Unsafe.(to_constr c) ;; + open Format;; let print_pure_constr csr = - let rec term_display c = match kind_of_term c with + let rec term_display c = match Constr.kind c with | Rel n -> print_string "#"; print_int n | Meta n -> print_string "Meta("; print_int n; print_string ")" | Var id -> print_string (Id.to_string id) @@ -437,7 +438,7 @@ let print_pure_constr csr = | ("Coq"::_::l) -> l | l -> l in List.iter (fun x -> print_string x; print_string ".") ls;*) - print_string (debug_string_of_mind sp) + print_string (MutInd.debug_to_string sp) and sp_con_display sp = (* let dir,l = decode_kn sp in let ls = @@ -446,7 +447,7 @@ let print_pure_constr csr = | ("Coq"::_::l) -> l | l -> l in List.iter (fun x -> print_string x; print_string ".") ls;*) - print_string (debug_string_of_con sp) + print_string (Constant.debug_to_string sp) in try @@ -455,7 +456,7 @@ let print_pure_constr csr = print_string (Printexc.to_string e);print_flush (); raise e -let ppfconstr c = ppconstr (CClosure.term_of_fconstr c) +let print_pure_econstr c = print_pure_constr EConstr.Unsafe.(to_constr c) ;; let pploc x = let (l,r) = Loc.unloc x in print_string"(";print_int l;print_string",";print_int r;print_string")" @@ -490,7 +491,7 @@ let in_current_context f c = let (evmap,sign) = Pfedit.get_current_context () in f (fst (Constrintern.interp_constr sign evmap c))(*FIXME*) -(* We expand the result of preprocessing to be independent of camlp4 +(* We expand the result of preprocessing to be independent of camlp5 VERNAC COMMAND EXTEND PrintPureConstr | [ "PrintPureConstr" constr(c) ] -> [ in_current_context print_pure_constr c ] @@ -500,9 +501,8 @@ VERNAC COMMAND EXTEND PrintConstr END *) -open Pcoq open Genarg -open Constrarg +open Stdarg open Egramml let _ = @@ -511,7 +511,7 @@ let _ = (function [c] when genarg_tag c = unquote (topwit wit_constr) && true -> let c = out_gen (rawwit wit_constr) c in - (fun () -> in_current_context constr_display c) + (fun ~atts ~st -> in_current_context econstr_display c; st) | _ -> failwith "Vernac extension: cannot occur") with e -> pp (CErrors.print e) @@ -519,7 +519,7 @@ let _ = extend_vernac_command_grammar ("PrintConstr", 0) None [GramTerminal "PrintConstr"; GramNonTerminal - (Loc.ghost,rawwit wit_constr,Extend.Aentry Pcoq.Constr.constr)] + (Loc.tag (Some (rawwit wit_constr),Extend.Aentry Pcoq.Constr.constr))] let _ = try @@ -527,7 +527,7 @@ let _ = (function [c] when genarg_tag c = unquote (topwit wit_constr) && true -> let c = out_gen (rawwit wit_constr) c in - (fun () -> in_current_context print_pure_constr c) + (fun ~atts ~st -> in_current_context print_pure_econstr c; st) | _ -> failwith "Vernac extension: cannot occur") with e -> pp (CErrors.print e) @@ -535,47 +535,47 @@ let _ = extend_vernac_command_grammar ("PrintPureConstr", 0) None [GramTerminal "PrintPureConstr"; GramNonTerminal - (Loc.ghost,rawwit wit_constr,Extend.Aentry Pcoq.Constr.constr)] + (Loc.tag (Some (rawwit wit_constr),Extend.Aentry Pcoq.Constr.constr))] (* Setting printer of unbound global reference *) open Names open Libnames -let encode_path loc prefix mpdir suffix id = +let encode_path ?loc prefix mpdir suffix id = let dir = match mpdir with | None -> [] | Some (mp,dir) -> - (DirPath.repr (dirpath_of_string (string_of_mp mp))@ + (DirPath.repr (dirpath_of_string (ModPath.to_string mp))@ DirPath.repr dir) in - Qualid (loc, make_qualid + CAst.make ?loc @@ Qualid (make_qualid (DirPath.make (List.rev (Id.of_string prefix::dir@suffix))) id) -let raw_string_of_ref loc _ = function +let raw_string_of_ref ?loc _ = function | ConstRef cst -> - let (mp,dir,id) = repr_con cst in - encode_path loc "CST" (Some (mp,dir)) [] (Label.to_id id) + let (mp,dir,id) = Constant.repr3 cst in + encode_path ?loc "CST" (Some (mp,dir)) [] (Label.to_id id) | IndRef (kn,i) -> - let (mp,dir,id) = repr_mind kn in - encode_path loc "IND" (Some (mp,dir)) [Label.to_id id] + let (mp,dir,id) = MutInd.repr3 kn in + encode_path ?loc "IND" (Some (mp,dir)) [Label.to_id id] (Id.of_string ("_"^string_of_int i)) | ConstructRef ((kn,i),j) -> - let (mp,dir,id) = repr_mind kn in - encode_path loc "CSTR" (Some (mp,dir)) + let (mp,dir,id) = MutInd.repr3 kn in + encode_path ?loc "CSTR" (Some (mp,dir)) [Label.to_id id;Id.of_string ("_"^string_of_int i)] (Id.of_string ("_"^string_of_int j)) | VarRef id -> - encode_path loc "SECVAR" None [] id + encode_path ?loc "SECVAR" None [] id -let short_string_of_ref loc _ = function - | VarRef id -> Ident (loc,id) - | ConstRef cst -> Ident (loc,Label.to_id (pi3 (repr_con cst))) - | IndRef (kn,0) -> Ident (loc,Label.to_id (pi3 (repr_mind kn))) +let short_string_of_ref ?loc _ = function + | VarRef id -> CAst.make ?loc @@ Ident id + | ConstRef cst -> CAst.make ?loc @@ Ident (Label.to_id (pi3 (Constant.repr3 cst))) + | IndRef (kn,0) -> CAst.make ?loc @@ Ident (Label.to_id (pi3 (MutInd.repr3 kn))) | IndRef (kn,i) -> - encode_path loc "IND" None [Label.to_id (pi3 (repr_mind kn))] + encode_path ?loc "IND" None [Label.to_id (pi3 (MutInd.repr3 kn))] (Id.of_string ("_"^string_of_int i)) | ConstructRef ((kn,i),j) -> - encode_path loc "CSTR" None - [Label.to_id (pi3 (repr_mind kn));Id.of_string ("_"^string_of_int i)] + encode_path ?loc "CSTR" None + [Label.to_id (pi3 (MutInd.repr3 kn));Id.of_string ("_"^string_of_int i)] (Id.of_string ("_"^string_of_int j)) (* Anticipate that printers can be used from ocamldebug and that diff --git a/dev/top_printers.mli b/dev/top_printers.mli new file mode 100644 index 00000000..dad6dcc1 --- /dev/null +++ b/dev/top_printers.mli @@ -0,0 +1,175 @@ +(************************************************************************) +(* * The Coq Proof Assistant / The Coq Development Team *) +(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *) +(* unit +val pP : Pp.t -> unit (* with surrounding box *) + +val ppfuture : 'a Future.computation -> unit + +val ppid : Names.Id.t -> unit +val pplab : Names.Label.t -> unit +val ppmbid : Names.MBId.t -> unit +val ppdir : Names.DirPath.t -> unit +val ppmp : Names.ModPath.t -> unit +val ppcon : Names.Constant.t -> unit +val ppproj : Names.Projection.t -> unit +val ppkn : Names.KerName.t -> unit +val ppmind : Names.MutInd.t -> unit +val ppind : Names.inductive -> unit + +val ppsp : Libnames.full_path -> unit +val ppqualid : Libnames.qualid -> unit + +val ppclindex : Classops.cl_index -> unit + +val ppscheme : 'a Ind_tables.scheme_kind -> unit + +val prrecarg : Declarations.recarg -> Pp.t +val ppwf_paths : Declarations.recarg Rtree.t -> unit + +val pr_evar : Evar.t -> Pp.t +val ppevar : Evar.t -> unit + +(* Multiple printers for Constr.t *) +val ppconstr : Constr.t -> unit (* by Termops printer *) +val ppconstr_univ : Constr.t -> unit + +(* Extern as type *) +val pptype : Constr.types -> unit + +val ppsconstr : Constr.constr Mod_subst.substituted -> unit +val ppeconstr : EConstr.constr -> unit (* Termops printer *) +val ppconstr_expr : Constrexpr.constr_expr -> unit +val ppglob_constr : 'a Glob_term.glob_constr_g -> unit +val pppattern : Pattern.constr_pattern -> unit +val ppfconstr : CClosure.fconstr -> unit + +val ppbigint : Bigint.bigint -> unit + +val ppintset : Int.Set.t -> unit +val ppidset : Names.Id.Set.t -> unit + +val pridmap : (Names.Id.Map.key -> 'a -> Pp.t) -> 'a Names.Id.Map.t -> Pp.t +val ppidmap : (Names.Id.Map.key -> 'a -> Pp.t) -> 'a Names.Id.Map.t -> unit + +val pridmapgen : 'a Names.Id.Map.t -> Pp.t +val ppidmapgen : 'a Names.Id.Map.t -> unit + +val prididmap : Names.Id.t Names.Id.Map.t -> Pp.t +val ppididmap : Names.Id.t Names.Id.Map.t -> unit + +val prconstrunderbindersidmap : + (Names.Id.t list * EConstr.constr) Names.Id.Map.t -> Pp.t +val ppconstrunderbindersidmap : + (Names.Id.t list * EConstr.constr) Names.Id.Map.t -> unit + +val ppevarsubst : + (Constr.t * Constr.t option * Names.Id.Map.key) list Names.Id.Map.t -> unit + +val ppunbound_ltac_var_map : + 'a Genarg.generic_argument Names.Id.Map.t -> unit + +val pr_closure : Ltac_pretype.closure -> Pp.t +val pr_closed_glob_constr_idmap : + Ltac_pretype.closed_glob_constr Names.Id.Map.t -> Pp.t +val pr_closed_glob_constr : Ltac_pretype.closed_glob_constr -> Pp.t +val ppclosure : Ltac_pretype.closure -> unit +val ppclosedglobconstr : Ltac_pretype.closed_glob_constr -> unit +val ppclosedglobconstridmap : + Ltac_pretype.closed_glob_constr Names.Id.Map.t -> unit + +val ppglobal : Globnames.global_reference -> unit + +val ppconst : + Names.KerName.t * (Constr.constr, 'a) Environ.punsafe_judgment -> unit +val ppvar : Names.Id.t * Constr.constr -> unit + +val genppj : ('a -> Pp.t * Pp.t) -> 'a -> Pp.t +val ppj : EConstr.unsafe_judgment -> unit + +val ppsubst : Mod_subst.substitution -> unit +val ppdelta : Mod_subst.delta_resolver -> unit + +val pp_idpred : Names.Id.Pred.t -> unit +val pp_cpred : Names.Cpred.t -> unit +val pp_transparent_state : Names.transparent_state -> unit + +val pp_stack_t : Constr.t Reductionops.Stack.t -> unit +val pp_cst_stack_t : Reductionops.Cst_stack.t -> unit +val pp_state_t : Reductionops.state -> unit + +val ppmetas : Evd.Metaset.t -> unit +val ppevm : Evd.evar_map -> unit +val ppevmall : Evd.evar_map -> unit + +val pr_existentialset : Evar.Set.t -> Pp.t +val ppexistentialset : Evar.Set.t -> unit + +val ppexistentialfilter : Evd.Filter.t -> unit + +val ppclenv : Clenv.clausenv -> unit + +val ppgoalgoal : Goal.goal -> unit + +val ppgoal : Proof_type.goal Evd.sigma -> unit +(* also print evar map *) +val ppgoalsigma : Proof_type.goal Evd.sigma -> unit + +val pphintdb : Hints.Hint_db.t -> unit +val ppproofview : Proofview.proofview -> unit +val ppopenconstr : Evd.open_constr -> unit + +val pproof : Proof.t -> unit + +(* Universes *) +val ppuni : Univ.Universe.t -> unit +val ppuni_level : Univ.Level.t -> unit (* raw *) +val prlev : Univ.Level.t -> Pp.t (* with global names (does this work?) *) +val ppuniverse_set : Univ.LSet.t -> unit +val ppuniverse_instance : Univ.Instance.t -> unit +val ppuniverse_context : Univ.UContext.t -> unit +val ppuniverse_context_set : Univ.ContextSet.t -> unit +val ppuniverse_subst : Univ.universe_subst -> unit +val ppuniverse_opt_subst : Universes.universe_opt_subst -> unit +val ppuniverse_level_subst : Univ.universe_level_subst -> unit +val ppevar_universe_context : UState.t -> unit +val ppconstraints : Univ.Constraint.t -> unit +val ppuniverseconstraints : Universes.Constraints.t -> unit +val ppuniverse_context_future : Univ.UContext.t Future.computation -> unit +val ppcumulativity_info : Univ.CumulativityInfo.t -> unit +val ppabstract_cumulativity_info : Univ.ACumulativityInfo.t -> unit +val ppuniverses : UGraph.t -> unit + +val ppnamedcontextval : Environ.named_context_val -> unit +val ppenv : Environ.env -> unit +val ppenvwithcst : Environ.env -> unit + +val pptac : Ltac_plugin.Tacexpr.glob_tactic_expr -> unit + +val ppobj : Libobject.obj -> unit + +(* Some super raw printers *) +val cast_kind_display : Constr.cast_kind -> string +val constr_display : Constr.constr -> unit +val print_pure_constr : Constr.types -> unit + +val pploc : Loc.t -> unit + +val pp_argument_type : Genarg.argument_type -> unit +val pp_generic_argument : 'a Genarg.generic_argument -> unit + +val prgenarginfo : Geninterp.Val.t -> Pp.t +val ppgenarginfo : Geninterp.Val.t -> unit + +val ppgenargargt : ('a, 'b, 'c) Genarg.ArgT.tag -> unit + +val ppist : Geninterp.interp_sign -> unit diff --git a/dev/v8-syntax/syntax-v8.tex b/dev/v8-syntax/syntax-v8.tex index 64431ea1..6b7960c9 100644 --- a/dev/v8-syntax/syntax-v8.tex +++ b/dev/v8-syntax/syntax-v8.tex @@ -1158,7 +1158,7 @@ $$ \nlsep \TERM{Abort}~\NT{ident} \nlsep \TERM{Existential}~\NT{num}~\KWD{:=}~\NT{constr-body} \nlsep \TERM{Qed} -\nlsep \TERM{Save}~\OPTGR{\NT{thm-token}~\NT{ident}} +\nlsep \TERM{Save}~\NT{ident} \nlsep \TERM{Defined}~\OPT{\NT{ident}} \nlsep \TERM{Suspend} \nlsep \TERM{Resume}~\OPT{\NT{ident}} diff --git a/dev/vm_printers.ml b/dev/vm_printers.ml index afa94a63..2ddf927d 100644 --- a/dev/vm_printers.ml +++ b/dev/vm_printers.ml @@ -3,18 +3,18 @@ open Term open Names open Cbytecodes open Cemitcodes -open Vm +open Vmvalues let ppripos (ri,pos) = (match ri with | Reloc_annot a -> let sp,i = a.ci.ci_ind in print_string - ("annot : MutInd("^(string_of_mind sp)^","^(string_of_int i)^")\n") + ("annot : MutInd("^(MutInd.to_string sp)^","^(string_of_int i)^")\n") | Reloc_const _ -> print_string "structured constant\n" | Reloc_getglobal kn -> - print_string ("getglob "^(string_of_con kn)^"\n")); + print_string ("getglob "^(Constant.to_string kn)^"\n")); print_flush () let print_vfix () = print_string "vfix" @@ -32,10 +32,14 @@ let print_idkey idk = match idk with | ConstKey sp -> print_string "Cons("; - print_string (string_of_con sp); + print_string (Constant.to_string sp); print_string ")" | VarKey id -> print_string (Id.to_string id) | RelKey i -> print_string "~";print_int i + | EvarKey evk -> + print_string "Evar("; + print_int (Evar.repr evk); + print_string ")" let rec ppzipper z = match z with @@ -61,15 +65,14 @@ and ppstack s = and ppatom a = match a with | Aid idk -> print_idkey idk - | Atype u -> print_string "Type(...)" + | Asort u -> print_string "Sort(...)" | Aind(sp,i) -> print_string "Ind("; - print_string (string_of_mind sp); + print_string (MutInd.to_string sp); print_string ","; print_int i; print_string ")" and ppwhd whd = match whd with - | Vsort s -> ppsort s | Vprod _ -> print_string "product" | Vfun _ -> print_string "function" | Vfix _ -> print_vfix() -- cgit v1.2.3