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 all commits
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
38 changes: 31 additions & 7 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,51 @@ 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
if [[ -f etc/utils/ssrcoqdep ]]
then patchShebangs etc/utils/ssrcoqdep
fi
if [[ -f etc/buildlibgraph ]]
then patchShebangs etc/buildlibgraph
fi
'' + ''
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 -r _build_doc
'';
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