Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coqPackages.mathcomp: etc #115417

Merged
merged 3 commits into from Mar 15, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 26 additions & 6 deletions pkgs/development/coq-modules/mathcomp/default.nix
Expand Up @@ -10,7 +10,7 @@
# See the documentation at doc/languages-frameworks/coq.section.md. #
############################################################################

{ lib, ncurses, which, graphviz, lua,
{ lib, ncurses, which, graphviz, lua, fetchzip,
mkCoqDerivation, recurseIntoAttrs, withDoc ? false, single ? false,
coqPackages, coq, ocamlPackages, version ? null }@args:
with builtins // lib;
Expand Down Expand Up @@ -55,27 +55,47 @@ let
derivation = mkCoqDerivation ({
inherit version pname defaultVersion release releaseRev repo owner;

nativeBuildInputs = optional withDoc graphviz;
nativeBuildInputs = optionals withDoc [ graphviz lua ];
mlPlugin = versions.isLe "8.6" coq.coq-version;
extraBuildInputs = [ ncurses which ] ++ optional withDoc lua;
extraBuildInputs = [ ncurses which ];
propagatedBuildInputs = mathcomp-deps;

buildFlags = optional withDoc "doc";

preBuild = ''
patchShebangs etc/utils/ssrcoqdep || true
patchShebangs etc/buildlibgraph || true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should that fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure old versions of mathcomp contain this script, in which case make doc would not rely on it. I did not check though. Moreover if in the future we start using another tool to build the graph (or remove this one), the build would still go through, hence I prefer to leave the possibility for this patch to fail, while proceeding to the next steps in the build.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the build would still go through

That should be avoided. It could silently break the package and cost a lot more debugging afterwards.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, right, I pushed a more robust script

'' + ''
cd ${pkgpath}
'' + optionalString (package == "all") pkgallMake;

installTargets = "install" + optionalString withDoc " doc";

meta = {
homepage = "https://math-comp.github.io/";
license = licenses.cecill-b;
maintainers = with maintainers; [ vbgl jwiegley cohencyril ];
};
} // optionalAttrs (package != "single") { passthru = genAttrs packages mathcomp_; });
} // optionalAttrs (package != "single")
{ passthru = genAttrs packages mathcomp_; }
// optionalAttrs withDoc {
htmldoc_template =
fetchzip {
url = "https://github.com/math-comp/math-comp.github.io/archive/doc-1.12.0.zip";
sha256 = "0y1352ha2yy6k2dl375sb1r68r1qi9dyyy7dyzj5lp9hxhhq69x8";
};
postBuild = ''
cp -rf _build_doc/* .
rm -rf _build_doc
CohenCyril marked this conversation as resolved.
Show resolved Hide resolved
'';
postInstall =
let tgt = "$out/share/coq/${coq.coq-version}/"; in
optionalString withDoc ''
mkdir -p ${tgt}
cp -r htmldoc ${tgt}
cp -r $htmldoc_template/htmldoc_template/* ${tgt}/htmldoc/
'';
buildTargets = "doc";
extraInstallFlags = [ "-f Makefile.coq" ];
});
patched-derivation1 = derivation.overrideAttrs (o:
optionalAttrs (o.pname != null && o.pname == "mathcomp-all" &&
o.version != null && o.version != "dev" && versions.isLt "1.7" o.version)
Expand Down