diff options
author | Cyril Cohen <cohen@crans.org> | 2021-02-19 19:34:30 +0100 |
---|---|---|
committer | Vincent Laporte <vbgl@users.noreply.github.com> | 2022-05-12 06:11:43 +0200 |
commit | 7e589a45ef86abf9a6a737d9730925b81ee663b4 (patch) | |
tree | eda31fd68603f623bdbb845f091a7e1c03b663d3 /pkgs/build-support | |
parent | a34b9c1f1cac783ca27ac2ee8bb63beb7b915287 (diff) |
coqPackages: etc
- use propagatedBuildInputs to make sure ocaml plugin stuff is in path - updated coqPackage.heq (broken url) - fixed use of `DESTDIR` and `COQMF_COQLIB` in mkCoqDerivation - adding `COQCORELIB` environement variable to put ocaml plugin files in the right place - make metaFetch available from `coqPackages`
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/coq/default.nix | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/pkgs/build-support/coq/default.nix b/pkgs/build-support/coq/default.nix index a681bbda5575d..70c62c659a2d2 100644 --- a/pkgs/build-support/coq/default.nix +++ b/pkgs/build-support/coq/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, coqPackages, coq, fetchzip }@args: +{ lib, stdenv, coqPackages, coq, which, fetchzip }@args: let lib = import ./extra-lib.nix {inherit (args) lib;}; in with builtins; with lib; let @@ -15,8 +15,12 @@ in releaseRev ? (v: v), displayVersion ? {}, release ? {}, + buildInputs ? [], + nativeBuildInputs ? [], extraBuildInputs ? [], extraNativeBuildInputs ? [], + overrideBuildInputs ? [], + overrideNativeBuildInputs ? [], namePrefix ? [ "coq" ], enableParallelBuilding ? true, extraInstallFlags ? [], @@ -35,7 +39,11 @@ let args-to-remove = foldl (flip remove) ([ "version" "fetcher" "repo" "owner" "domain" "releaseRev" "displayVersion" "defaultVersion" "useMelquiondRemake" - "release" "extraBuildInputs" "extraNativeBuildInputs" "extraPropagatedBuildInputs" "namePrefix" + "release" + "buildInputs" "nativeBuildInputs" + "extraBuildInputs" "extraNativeBuildInputs" + "overrideBuildInputs" "overrideNativeBuildInputs" + "namePrefix" "meta" "useDune2ifVersion" "useDune2" "opam-name" "extraInstallFlags" "setCOQBIN" "mlPlugin" "dropAttrs" "dropDerivationAttrs" "keepAttrs" ] ++ dropAttrs) keepAttrs; @@ -57,9 +65,16 @@ let ] "") + optionalString (v == null) "-broken"; append-version = p: n: p + display-pkg n "" coqPackages.${n}.version + "-"; prefix-name = foldl append-version "" namePrefix; - var-coqlib-install = - (optionalString (versions.isGe "8.7" coq.coq-version || coq.coq-version == "dev") "COQMF_") + "COQLIB"; useDune2 = args.useDune2 or (useDune2ifVersion fetched.version); + coqlib-flags = switch coq.coq-version [ + { case = v: versions.isLe "8.6" v && v != "dev" ; + out = [ "COQLIB=$(out)/lib/coq/${coq.coq-version}/" ]; } + ] [ "COQLIBINSTALL=$(out)/lib/coq/${coq.coq-version}/user-contrib" + "COQPLUGININSTALL=$(OCAMLFIND_DESTDIR)" ]; + docdir-flags = switch coq.coq-version [ + { case = v: versions.isLe "8.6" v && v != "dev"; + out = [ "DOCDIR=$(out)/share/coq/${coq.coq-version}/" ]; } + ] [ "COQDOCINSTALL=$(out)/share/coq/${coq.coq-version}/user-contrib" ]; in stdenv.mkDerivation (removeAttrs ({ @@ -68,12 +83,12 @@ stdenv.mkDerivation (removeAttrs ({ inherit (fetched) version src; - nativeBuildInputs = [ coq ] - ++ optionals useDune2 [coq.ocaml coq.ocamlPackages.dune_2] - ++ optionals mlPlugin coq.ocamlNativeBuildInputs - ++ extraNativeBuildInputs; - buildInputs = optionals mlPlugin coq.ocamlBuildInputs - ++ extraBuildInputs; + nativeBuildInputs = args.overrideNativeBuildInputs + or ([ which ] ++ optional useDune2 coq.ocamlPackages.dune_2 + ++ optional (useDune2 || mlPlugin) coq.ocaml + ++ (args.nativeBuildInputs or []) ++ extraNativeBuildInputs); + buildInputs = args.overrideBuildInputs + or ([ coq ] ++ (args.buildInputs or []) ++ extraBuildInputs); inherit enableParallelBuilding; meta = ({ platforms = coq.meta.platforms; } // @@ -88,9 +103,7 @@ stdenv.mkDerivation (removeAttrs ({ // (optionalAttrs setCOQBIN { COQBIN = "${coq}/bin/"; }) // (optionalAttrs (!args?installPhase && !args?useMelquiondRemake) { installFlags = - [ "${var-coqlib-install}=$(out)/lib/coq/${coq.coq-version}/" ] ++ - optional (match ".*doc$" (args.installTargets or "") != null) - "DOCDIR=$(out)/share/coq/${coq.coq-version}/" ++ + [ "DESTDIR=$(out)" ] ++ coqlib-flags ++ docdir-flags ++ extraInstallFlags; }) // (optionalAttrs useDune2 { |