diff --git a/pkgs/development/tools/ocaml/camlidl/default.nix b/pkgs/development/tools/ocaml/camlidl/default.nix index 5c3153a8849..a97ce8499b2 100644 --- a/pkgs/development/tools/ocaml/camlidl/default.nix +++ b/pkgs/development/tools/ocaml/camlidl/default.nix @@ -1,16 +1,17 @@ -{ lib, stdenv, fetchurl, ocaml, writeText }: +{ lib, stdenv, fetchFromGitHub, ocaml, writeText }: + +lib.throwIfNot (lib.versionAtLeast ocaml.version "4.03") + "camlidl is not available for OCaml ${ocaml.version}" -let - pname = "camlidl"; - webpage = "https://caml.inria.fr/pub/old_caml_site/camlidl/"; -in stdenv.mkDerivation rec { - name = "${pname}-${version}"; - version = "1.05"; + pname = "ocaml${ocaml.version}-camlidl"; + version = "1.11"; - src = fetchurl { - url = "http://caml.inria.fr/pub/old_caml_site/distrib/bazar-ocaml/${pname}-${version}.tar.gz"; - sha256 = "0483cs66zsxsavcllpw1qqvyhxb39ddil3h72clcd69g7fyxazl5"; + src = fetchFromGitHub { + owner = "xavierleroy"; + repo = "camlidl"; + rev = "camlidl111"; + sha256 = "sha256-8m0zem/6nvpEJtjJNP/+vafeVLlMvNQGdl8lyf/OeBg="; }; nativeBuildInputs = [ ocaml ]; @@ -21,10 +22,10 @@ stdenv.mkDerivation rec { 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=${stdenv.cc}/bin/cpp - substituteInPlace config/Makefile --replace "OCAMLC=ocamlc -g" "OCAMLC=ocamlc -g -warn-error -31" + substituteInPlace config/Makefile --replace 'OCAMLLIB=$(shell $(OCAMLC) -where)' OCAMLLIB=$out/lib/ocaml/${ocaml.version}/site-lib/camlidl + substituteInPlace config/Makefile --replace CPP=cpp CPP=${stdenv.cc}/bin/cpp mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/camlidl/caml + mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/camlidl/stublibs ''; postInstall = '' @@ -40,15 +41,14 @@ stdenv.mkDerivation rec { ''; setupHook = writeText "setupHook.sh" '' - export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}/" export NIX_CFLAGS_COMPILE+=" -isystem $1/lib/ocaml/${ocaml.version}/site-lib/camlidl" export NIX_LDFLAGS+=" -L $1/lib/ocaml/${ocaml.version}/site-lib/camlidl" ''; meta = { description = "A stub code generator and COM binding for Objective Caml"; - homepage = webpage; - license = "LGPL"; + homepage = "https://xavierleroy.org/camlidl/"; + license = lib.licenses.lgpl21; maintainers = [ lib.maintainers.roconnor ]; }; }