12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091(************************************************************************)(* * The Coq Proof Assistant / The Coq Development Team *)(* v * Copyright INRIA, CNRS and contributors *)(* <O___,, * (see version control and CREDITS file for authors & dates) *)(* \VV/ **************************************************************)(* // * This file is distributed under the terms of the *)(* * GNU Lesser General Public License Version 2.1 *)(* * (see LICENSE file for the text of the license) *)(************************************************************************)openUtilopenPp(* Recursively puts `.v` files in the LoadPath *)letbuild_stdlib_vo_path~unix_path~coq_path=letopenLoadpathin{unix_path;coq_path;has_ml=false;implicit=true;recursive=true}(* Note we don't use has_ml=true due to #12771 , we need to see if we
should just remove that option *)letbuild_userlib_path~unix_path=letopenLoadpathinifSys.file_existsunix_paththenletml_path=System.all_subdirs~unix_path|>List.mapfstinletvo_path={unix_path;coq_path=Libnames.default_root_prefix;has_ml=false;implicit=false;recursive=true}inml_path,[vo_path]else[],[]letlegacy_plugin_pathscoredir=letopenBootinletunix_path=Path.relativecoredir"plugins"in(* BOOTCOQC doesn't pass -boot to coqc, so this is too strong!
Reinstate when moving to coq_dune *)(* if not (Path.exists unix_path) then
* CErrors.user_err (Pp.str "Cannot find plugins directory"); *)letunix_path=Path.to_stringunix_pathinSystem.all_subdirs~unix_path|>List.mapfst(* LoadPath for Coq user libraries *)letinit_load_path~coqenv=letopenLoadpathinletuser_contrib=Boot.Env.user_contribcoqenv|>Boot.Path.to_stringinletxdg_dirs=Envars.xdg_dirs~warn:(funx->Feedback.msg_warning(strx))inletcoqpath=Envars.coqpathinletcoq_path=Names.DirPath.make[Libnames.coq_root]in(* ML includes *)letcore_dir=Boot.Env.corelibcoqenvin(* EJGA: We can clean this up when we the build systems do send the
right -I for us. Dune already does this, not sure about Coq
Makefile / findlib setup *)letplugins_dirs=legacy_plugin_pathscore_dirin(* EJGA: this needs clenaup, we must be deterministic *)letmeta_dir=ifBoot.Env.Path.(exists(relativecore_dir"META"))then[Boot.Env.Path.(to_string(relativecore_dir".."))]else[]inletstdlib=Boot.Env.stdlibcoqenv|>Boot.Path.to_stringinletcontrib_ml,contrib_vo=build_userlib_path~unix_path:user_contribinletmisc_ml,misc_vo=List.map(funs->build_userlib_path~unix_path:s)(xdg_dirs@coqpath)|>List.splitinletml_loadpath=plugins_dirs@meta_dir@contrib_ml@List.concatmisc_mlinletvo_loadpath=(* current directory (not recursively!) *)[{unix_path=".";coq_path=Libnames.default_root_prefix;implicit=false;has_ml=true;recursive=false}]@(* then standard library *)[build_stdlib_vo_path~unix_path:stdlib~coq_path]@(* then user-contrib *)contrib_vo@(* then directories in XDG_DATA_DIRS and XDG_DATA_HOME and COQPATH *)List.concatmisc_voinml_loadpath,vo_loadpath