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

49 lines
1.6 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.
*/
2018-05-28 07:12:16 +01:00
{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, result, opaline }:
2016-07-17 16:26:22 +01:00
if !stdenv.lib.versionAtLeast ocaml.version "4.01"
then throw "topkg is not available for OCaml ${ocaml.version}"
else
2017-12-14 07:36:29 +00:00
let
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 16:26:22 +01:00
stdenv.mkDerivation rec {
name = "ocaml${ocaml.version}-topkg-${version}";
2017-10-27 08:36:40 +01:00
version = "0.9.1";
2016-07-17 16:26:22 +01:00
src = fetchurl {
url = "http://erratique.ch/software/topkg/releases/topkg-${version}.tbz";
2017-10-27 08:36:40 +01:00
sha256 = "1slrzbmyp81xhgsfwwqs2d6gxzvqx0gcp34rq00h5iblhcq7myx6";
2016-07-17 16:26:22 +01:00
};
buildInputs = [ ocaml findlib ocamlbuild ];
2016-07-17 16:26:22 +01:00
propagatedBuildInputs = [ result ];
2017-12-14 07:36:29 +00:00
buildPhase = "${run} build";
2016-07-17 16:26:22 +01:00
createFindlibDestdir = true;
2018-05-28 07:12:16 +01:00
installPhase = "${opaline}/bin/opaline -prefix $out -libdir $OCAMLFIND_DESTDIR";
2017-12-14 07:36:29 +00:00
passthru = { inherit run; };
2016-07-17 16:26:22 +01:00
meta = {
homepage = http://erratique.ch/software/topkg;
license = stdenv.lib.licenses.isc;
maintainers = [ stdenv.lib.maintainers.vbgl ];
description = "A packager for distributing OCaml software";
inherit (ocaml.meta) platforms;
};
}