about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/ocaml-modules/topkg
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/development/ocaml-modules/topkg
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/development/ocaml-modules/topkg')
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/topkg/default.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/ocaml-modules/topkg/default.nix b/nixpkgs/pkgs/development/ocaml-modules/topkg/default.nix
new file mode 100644
index 000000000000..3e6b78a71719
--- /dev/null
+++ b/nixpkgs/pkgs/development/ocaml-modules/topkg/default.nix
@@ -0,0 +1,48 @@
+/* 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, fetchurl, ocaml, findlib, ocamlbuild, result, opaline }:
+
+if !stdenv.lib.versionAtLeast ocaml.version "4.01"
+then throw "topkg is not available for OCaml ${ocaml.version}"
+else
+
+let
+/* 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`.
+*/
+  run = "ocaml -I ${findlib}/lib/ocaml/${ocaml.version}/site-lib/ pkg/pkg.ml";
+in
+
+stdenv.mkDerivation rec {
+  name = "ocaml${ocaml.version}-topkg-${version}";
+  version = "0.9.1";
+
+  src = fetchurl {
+    url = "http://erratique.ch/software/topkg/releases/topkg-${version}.tbz";
+    sha256 = "1slrzbmyp81xhgsfwwqs2d6gxzvqx0gcp34rq00h5iblhcq7myx6";
+  };
+
+  buildInputs = [ ocaml findlib ocamlbuild ];
+  propagatedBuildInputs = [ result ];
+
+  buildPhase = "${run} build";
+  createFindlibDestdir = true;
+  installPhase = "${opaline}/bin/opaline -prefix $out -libdir $OCAMLFIND_DESTDIR";
+
+  passthru = { inherit run; };
+
+  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;
+  };
+}