nixpkgs/pkgs/development/ocaml-modules/topkg/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
1.9 KiB
Nix
Raw Normal View History

2017-12-15 06:33:56 +00:00
/* Topkg is a packager for distributing OCaml software. This derivation
provides facilities to describe derivations for OCaml libraries
using topkg.
The `buildPhase` and `installPhase` attributes can be reused directly
in many cases. When more fine-grained control on how to run the topkg
build system is required, the attribute `run` can be used.
*/
{ stdenv, lib, fetchurl, ocaml, findlib, ocamlbuild, result, opaline }:
2016-07-17 15:26:22 +00:00
2017-12-14 07:36:29 +00:00
let
2020-09-26 17:10:51 +00:00
param =
2023-01-26 04:28:49 +00:00
if lib.versionAtLeast ocaml.version "4.05" then {
2024-03-18 05:11:16 +00:00
version = "1.0.7";
sha256 = "sha256-X8Iq0/OtbRJ8sSRdGFgIgUeNotbeULIxXm3UWGxSvhk=";
2023-01-26 04:28:49 +00:00
} else if lib.versionAtLeast ocaml.version "4.03" then {
2020-09-26 17:10:51 +00:00
version = "1.0.3";
sha256 = "0b77gsz9bqby8v77kfi4lans47x9p2lmzanzwins5r29maphb8y6";
} else {
version = "1.0.0";
sha256 = "1df61vw6v5bg2mys045682ggv058yqkqb67w7r2gz85crs04d5fw";
propagatedBuildInputs = [ result ];
};
2017-12-15 06:33:56 +00:00
/* This command allows to run the topkg build system.
* It is usually called with `build` or `test` as argument.
* Packages that use `topkg` may call this command as part of
* their `buildPhase` or `checkPhase`.
*/
2017-12-14 07:36:29 +00:00
run = "ocaml -I ${findlib}/lib/ocaml/${ocaml.version}/site-lib/ pkg/pkg.ml";
in
2016-07-17 15:26:22 +00:00
stdenv.mkDerivation rec {
2022-02-06 22:35:27 +00:00
pname = "ocaml${ocaml.version}-topkg";
2020-09-26 17:10:51 +00:00
inherit (param) version;
2016-07-17 15:26:22 +00:00
src = fetchurl {
url = "https://erratique.ch/software/topkg/releases/topkg-${version}.tbz";
2020-09-26 17:10:51 +00:00
inherit (param) sha256;
2016-07-17 15:26:22 +00:00
};
nativeBuildInputs = [ ocaml findlib ocamlbuild ];
2020-09-26 17:10:51 +00:00
propagatedBuildInputs = param.propagatedBuildInputs or [];
2016-07-17 15:26:22 +00:00
strictDeps = true;
2017-12-14 07:36:29 +00:00
buildPhase = "${run} build";
2016-07-17 15:26:22 +00:00
createFindlibDestdir = true;
2018-05-28 06:12:16 +00:00
installPhase = "${opaline}/bin/opaline -prefix $out -libdir $OCAMLFIND_DESTDIR";
2017-12-14 07:36:29 +00:00
passthru = { inherit run; };
2016-07-17 15:26:22 +00:00
meta = {
homepage = "https://erratique.ch/software/topkg";
license = lib.licenses.isc;
maintainers = [ lib.maintainers.vbgl ];
2016-07-17 15:26:22 +00:00
description = "Packager for distributing OCaml software";
inherit (ocaml.meta) platforms;
};
}