Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at haskell-updates 69 lines 1.3 kB view raw
1{ 2 stdenv, 3 lib, 4 python3, 5 cmake, 6 libllvm, 7 ocaml, 8 findlib, 9 ctypes, 10}: 11 12let 13 version = lib.getVersion libllvm; 14in 15 16stdenv.mkDerivation { 17 pname = "ocaml-llvm"; 18 inherit version; 19 20 inherit (libllvm) src; 21 22 nativeBuildInputs = [ 23 cmake 24 python3 25 ocaml 26 findlib 27 ]; 28 buildInputs = [ ctypes ]; 29 propagatedBuildInputs = [ libllvm ]; 30 31 strictDeps = true; 32 33 preConfigure = lib.optionalString (lib.versionAtLeast version "13.0.0") '' 34 cd llvm 35 ''; 36 37 cmakeFlags = [ 38 "-DBUILD_SHARED_LIBS=YES" # fixes bytecode builds 39 "-DLLVM_OCAML_OUT_OF_TREE=TRUE" 40 "-DLLVM_OCAML_INSTALL_PATH=${placeholder "out"}/ocaml" 41 "-DLLVM_OCAML_EXTERNAL_LLVM_LIBDIR=${lib.getLib libllvm}/lib" 42 ]; 43 44 buildFlags = [ "ocaml_all" ]; 45 46 installFlags = [ 47 "-C" 48 "bindings/ocaml" 49 ]; 50 51 postInstall = '' 52 mkdir -p $OCAMLFIND_DESTDIR/ 53 mv $out/ocaml $OCAMLFIND_DESTDIR/llvm 54 mv $OCAMLFIND_DESTDIR/llvm/META{.llvm,} 55 mv $OCAMLFIND_DESTDIR/llvm/stublibs $OCAMLFIND_DESTDIR/stublibs 56 ''; 57 58 passthru = { 59 inherit libllvm; 60 }; 61 62 meta = { 63 inherit (libllvm.meta) license homepage; 64 inherit (ocaml.meta) platforms; 65 description = "OCaml bindings distributed with LLVM"; 66 maintainers = with lib.maintainers; [ vbgl ]; 67 }; 68 69}