summary refs log tree commit diff
path: root/pkgs/development/tools/ocaml/camlidl/default.nix
blob: dee605ced570dec92ca1b9d8de92b2c50d07a0ba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{stdenv, fetchurl, makeWrapper, gcc, ocaml, ncurses}:
let
  ocaml_version = (builtins.parseDrvName ocaml.name).version;
  pname = "camlidl";
  version = "1.05";
  webpage = "http://caml.inria.fr/pub/old_caml_site/camlidl/";
in
stdenv.mkDerivation {

  name = "${pname}-${version}";

  src = fetchurl {
    url = "http://caml.inria.fr/pub/old_caml_site/distrib/bazar-ocaml/${pname}-${version}.tar.gz";
    sha256 = "0483cs66zsxsavcllpw1qqvyhxb39ddil3h72clcd69g7fyxazl5";
  };

  buildInputs = [ ocaml ];

  preBuild = ''
    mv config/Makefile.unix config/Makefile
    substituteInPlace config/Makefile --replace BINDIR=/usr/local/bin BINDIR=$out
    substituteInPlace config/Makefile --replace OCAMLLIB=/usr/local/lib/ocaml OCAMLLIB=$out/lib/ocaml/${ocaml_version}/site-lib/camlidl
    substituteInPlace config/Makefile --replace CPP=/lib/cpp CPP=${gcc}/bin/cpp
    mkdir -p $out/lib/ocaml/${ocaml_version}/site-lib/camlidl/caml
  '';

  postInstall = ''
    cat >$out/lib/ocaml/${ocaml_version}/site-lib/camlidl/META <<EOF
    # Courtesy of GODI
    description = "Stub generator"
    version = "${version}"
    archive(byte) = "com.cma"
    archive(native) = "com.cmxa"
    EOF
    mkdir -p $out/bin
    ln -s $out/camlidl $out/bin
  '';

  meta = {
    description = "CamlIDL is a stub code generator and COM binding for Objective Caml";
    homepage = "${webpage}";
    license = "LGPL";
    maintainers = [ stdenv.lib.maintainers.roconnor ];
  };
}