Skip to content

Instantly share code, notes, and snippets.

@ericbmerritt
Last active August 29, 2015 14:21
Show Gist options
  • Save ericbmerritt/098b8fd34d9ab91f4b8e to your computer and use it in GitHub Desktop.
Save ericbmerritt/098b8fd34d9ab91f4b8e to your computer and use it in GitHub Desktop.
buildOcaml.nix
{ stdenv, ocaml, findlib, camlp4 }:
{ name, version, buildInputs ? [],
createFindlibDestdir ? true,
dontStrip ? true,
minimumSupportedOcamlVersion ? null,
meta ? {}, ...
}@args:
let
ocaml_version = (builtins.parseDrvName ocaml.name).version;
defaultMeta = {
platforms = ocaml.meta.platforms;
};
in
assert minimumSupportedOcamlVersion != null ->
stdenv.lib.versionOlder minimumSupportedOcamlVersion ocaml_version;
stdenv.mkDerivation (args // {
name = "ocaml-${name}-${version}";
buildInputs = [ ocaml findlib camlp4 ] ++ buildInputs;
meta = defaultMeta // meta;
})
emove a directory.: ................................. rm -rf
Turn ocaml debug flag on: ............................ true
Turn ocaml profile flag on: .......................... false
Compiler support generation of .cmxs.: ............... true
OCamlbuild additional flags: .........................
Create documentations: ............................... true
Compile tests executable and library and run them: ... false
camlp4o: ............................................. /nix/store/v3npw9fqi2mvyrq5kh1452q2025fvn8x-camlp4-4.02.0+1/bin/camlp4o
pkg_camlp4_lib: ...................................... /nix/store/v3npw9fqi2mvyrq5kh1452q2025fvn8x-camlp4-4.02.0+1/lib/ocaml/4.02.1/site-lib/camlp4
pkg_camlp4_quotations: ............................... /nix/store/v3npw9fqi2mvyrq5kh1452q2025fvn8x-camlp4-4.02.0+1/lib/ocaml/4.02.1/site-lib/camlp4
pkg_camlp4_extend: ................................... /nix/store/v3npw9fqi2mvyrq5kh1452q2025fvn8x-camlp4-4.02.0+1/lib/ocaml/4.02.1/site-lib/camlp4
./setup.exe -build
ocamlfind ocamlopt unix.cmxa -I /nix/store/s4rhzax2qli3kjf34qhnkdywrb2wwf6b-ocaml-4.02.1/lib/ocaml/ocamlbuild /nix/store/s4rhzax2qli3kjf34qhnkdywrb2wwf6b-ocaml-4.02.1/lib/ocaml/ocamlbuild/ocamlbuildlib.cmxa -linkpkg myocamlbuild.ml /nix/store/s4rhzax2qli3kjf34qhnkdywrb2wwf6b-ocaml-4.02.1/lib/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
ocamlfind ocamldep -syntax camlp4o -package camlp4.extend -package camlp4.quotations -package camlp4.lib -modules lib/here.ml > lib/here.ml.depends
ocamlfind ocamlc -c -g -syntax camlp4o -package camlp4.extend -package camlp4.quotations -package camlp4.lib -I lib -o lib/here.cmo lib/here.ml
ocamlfind ocamlc -a lib/here.cmo -o lib/herelib.cma
ocamlfind ocamlopt -c -g -syntax camlp4o -package camlp4.extend -package camlp4.quotations -package camlp4.lib -I lib -o lib/here.cmx lib/here.ml
ocamlfind ocamlopt -a lib/here.cmx -o lib/herelib.cmxa
ocamlfind ocamlopt -shared -linkall lib/herelib.cmxa -o lib/herelib.cmxs
ocamlfind ocamldep -syntax camlp4o -package camlp4.extend -package camlp4.quotations -package camlp4.lib -modules lib/pa_here.mli > lib/pa_here.mli.depends
ocamlfind ocamlc -c -g -syntax camlp4o -package camlp4.extend -package camlp4.quotations -package camlp4.lib -I lib -o lib/pa_here.cmi lib/pa_here.mli
ocamlfind ocamldep -syntax camlp4o -package camlp4.extend -package camlp4.quotations -package camlp4.lib -modules lib/pa_here.ml > lib/pa_here.ml.depends
ocamlfind ocamlc -c -g -syntax camlp4o -package camlp4.extend -package camlp4.quotations -package camlp4.lib -I lib -o lib/pa_here.cmo lib/pa_here.ml
ocamlfind ocamlc -a lib/pa_here.cmo -o lib/pa_herelib.cma
ocamlfind ocamlopt -c -g -syntax camlp4o -package camlp4.extend -package camlp4.quotations -package camlp4.lib -I lib -o lib/pa_here.cmx lib/pa_here.ml
ocamlfind ocamlopt -a lib/pa_here.cmx -o lib/pa_herelib.cmxa
ocamlfind ocamlopt -shared -linkall lib/pa_herelib.cmxa -o lib/pa_herelib.cmxs
installing
install flags: install SHELL=/nix/store/sl3scf6za8b9bpr4ynfkfh6sqn3rcdvl-bash-4.3-p33/bin/bash
./setup.exe -install
ocamlfind: Bad configuration: Cannot mkdir /nix/store/19df2k9ja3r536jp8gmm2j6ahcjaxfsw-ocaml-herelib-109.35.02/lib/ocaml/4.02.1/site-lib/herelib because a path component does not exist or is not a directory
E: Failure("Command ''/nix/store/x8hxrkz661d4di0sqzv6xcbyi8ssbrba-ocaml-findlib-1.5.3/bin/ocamlfind' install herelib lib/META _build/lib/pa_here.cmx _build/lib/pa_here.cmi _build/lib/pa_herelib.cmxs _build/lib/pa_herelib.a _build/lib/pa_herelib.cmxa _build/lib/pa_herelib.cma lib/pa_here.mli _build/lib/here.cmx _build/lib/here.cmi _build/lib/herelib.cmxs _build/lib/herelib.a _build/lib/herelib.cmxa _build/lib/herelib.cma lib/here.ml' terminated with error code 2")
Makefile:33: recipe for target 'install' failed
make: *** [install] Error 1
builder for ‘/nix/store/4kjvyj9qfvy5rhf091yqmd2x37814q2c-ocaml-herelib-109.35.02.drv’ failed with exit code 2
error: build of ‘/nix/store/4kjvyj9qfvy5rhf091yqmd2x37814q2c-ocaml-herelib-109.35.02.drv’ failed
{stdenv, buildOcaml, fetchurl}:
buildOcaml rec {
minimumSupportedOcamlVersion = "4.02";
version = "109.35.02";
name = "herelib";
src = fetchurl {
url = "https://github.com/janestreet/herelib/archive/${version}.tar.gz";
sha256 = "7f8394169cb63f6d41e91c9affa1b8ec240d5f6e9dfeda3fbb611df521d4b05a";
};
meta = with stdenv.lib; {
homepage = https://github.com/janestreet/herelib;
description = "Syntax extension for inserting the current location";
license = stdenv.lib.licenses.lgpl21;
maintainers = [ maintainers.ericbmerritt ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment