nixpkgs/pkgs/development/tools/ocaml/opam/default.nix

115 lines
4.3 KiB
Nix
Raw Normal View History

2018-09-06 17:18:34 +00:00
{ stdenv, lib, fetchurl, makeWrapper, getconf,
ocaml, unzip, ncurses, curl, aspcud, bubblewrap
}:
2014-11-03 16:55:33 +00:00
2018-09-06 17:18:34 +00:00
assert lib.versionAtLeast ocaml.version "4.02.3";
2014-11-03 16:55:33 +00:00
let
srcs = {
2018-09-06 17:18:34 +00:00
cmdliner = fetchurl {
url = "http://erratique.ch/software/cmdliner/releases/cmdliner-1.0.2.tbz";
sha256 = "18jqphjiifljlh9jg8zpl6310p3iwyaqphdkmf89acyaix0s4kj1";
};
cppo = fetchurl {
url = "https://github.com/mjambon/cppo/archive/v1.6.4.tar.gz";
sha256 = "0jdb7d21lfa3ck4k59mrqs5pljzq5rb504jq57nnrc6klljm42j7";
};
2014-11-03 16:55:33 +00:00
cudf = fetchurl {
2018-09-06 17:18:34 +00:00
url = "https://gforge.inria.fr/frs/download.php/36602/cudf-0.9.tar.gz";
sha256 = "0771lwljqwwn3cryl0plny5a5dyyrj4z6bw66ha5n8yfbpcy8clr";
};
dose3 = fetchurl {
url = "https://gforge.inria.fr/frs/download.php/file/36063/dose3-5.0.1.tar.gz";
sha256 = "00yvyfm4j423zqndvgc1ycnmiffaa2l9ab40cyg23pf51qmzk2jm";
2014-11-03 16:55:33 +00:00
};
extlib = fetchurl {
2018-09-06 17:18:34 +00:00
url = "http://ygrek.org.ua/p/release/ocaml-extlib/extlib-1.7.5.tar.gz";
sha256 = "19slqf5bdj0rrph2w41giwmn6df2qm07942jn058pjkjrnk30d4s";
2014-11-03 16:55:33 +00:00
};
2018-09-06 17:18:34 +00:00
jbuilder = fetchurl {
url = "https://github.com/ocaml/dune/releases/download/1.0+beta20/jbuilder-1.0.beta20.tbz";
sha256 = "07hl9as5llffgd6hbw41rs76i1ibgn3n9r0dba5h0mdlkapcwb10";
2014-11-03 16:55:33 +00:00
};
2018-09-06 17:18:34 +00:00
mccs = fetchurl {
url = "https://github.com/AltGr/ocaml-mccs/archive/1.1+8.tar.gz";
sha256 = "0xavfvxfrcf3lmry8ymma1yzy0hw3ijbx94c9zq3pzlwnylrapa4";
2014-11-03 16:55:33 +00:00
};
2018-09-06 17:18:34 +00:00
ocamlgraph = fetchurl {
url = "http://ocamlgraph.lri.fr/download/ocamlgraph-1.8.8.tar.gz";
sha256 = "0m9g16wrrr86gw4fz2fazrh8nkqms0n863w7ndcvrmyafgxvxsnr";
2014-11-03 16:55:33 +00:00
};
2018-09-06 17:18:34 +00:00
opam-file-format = fetchurl {
url = "https://github.com/ocaml/opam-file-format/archive/2.0.0-rc2.tar.gz";
sha256 = "1mgk08msp7hxn0hs0m82vky3yv6hcq4pw5402b3vhx4c49431jsb";
2014-11-03 16:55:33 +00:00
};
2018-09-06 17:18:34 +00:00
re = fetchurl {
url = "https://github.com/ocaml/ocaml-re/releases/download/1.7.3/re-1.7.3.tbz";
sha256 = "0nv933qfl8y9i19cqvhsalwzif3dkm28vg478rpnr4hgfqjlfryr";
2014-11-03 16:55:33 +00:00
};
2018-09-06 17:18:34 +00:00
result = fetchurl {
url = "https://github.com/janestreet/result/releases/download/1.3/result-1.3.tbz";
sha256 = "1lrnbxdq80gbhnp85mqp1kfk0bkh6q1c93sfz2qgnq2qyz60w4sk";
2014-11-03 16:55:33 +00:00
};
opam = fetchurl {
2018-09-06 17:18:34 +00:00
url = "https://github.com/ocaml/opam/archive/2.0.0.zip";
sha256 = "0m4ilsldrfkkn0vlvl119bk76j2pwvqvdi8mpg957z4kqflfbfp8";
2014-11-03 16:55:33 +00:00
};
};
2015-03-22 20:31:25 +00:00
in stdenv.mkDerivation rec {
name = "opam-${version}";
2018-09-06 17:18:34 +00:00
version = "2.0.0";
2014-11-03 16:55:33 +00:00
2018-09-06 17:18:34 +00:00
buildInputs = [ unzip curl ncurses ocaml makeWrapper getconf ] ++ lib.optional stdenv.isLinux bubblewrap;
2014-11-03 16:55:33 +00:00
src = srcs.opam;
postUnpack = ''
2018-09-06 17:18:34 +00:00
ln -sv ${srcs.cmdliner} $sourceRoot/src_ext/cmdliner.tbz
ln -sv ${srcs.cppo} $sourceRoot/src_ext/cppo.tar.gz
ln -sv ${srcs.cudf} $sourceRoot/src_ext/cudf.tar.gz
ln -sv ${srcs.dose3} $sourceRoot/src_ext/dose3.tar.gz
ln -sv ${srcs.extlib} $sourceRoot/src_ext/extlib.tar.gz
ln -sv ${srcs.jbuilder} $sourceRoot/src_ext/jbuilder.tbz
ln -sv ${srcs.mccs} $sourceRoot/src_ext/mccs.tar.gz
ln -sv ${srcs.ocamlgraph} $sourceRoot/src_ext/ocamlgraph.tar.gz
ln -sv ${srcs.opam-file-format} $sourceRoot/src_ext/opam-file-format.tar.gz
ln -sv ${srcs.re} $sourceRoot/src_ext/re.tbz
ln -sv ${srcs.result} $sourceRoot/src_ext/result.tbz
2014-11-03 16:55:33 +00:00
'';
2018-09-06 17:18:34 +00:00
patches = [ ./opam-pull-3487.patch ./opam-shebangs.patch ./opam-mccs-darwin.patch ];
2015-03-22 20:31:25 +00:00
preConfigure = ''
substituteInPlace ./src_ext/Makefile --replace "%.stamp: %.download" "%.stamp:"
2018-09-06 17:18:34 +00:00
patchShebangs src/state/shellscripts
2015-03-22 20:31:25 +00:00
'';
2014-11-03 16:55:33 +00:00
postConfigure = "make lib-ext";
# Dirty, but apparently ocp-build requires a TERM
makeFlags = ["TERM=screen"];
2018-09-06 17:18:34 +00:00
outputs = [ "out" "installer" ];
setOutputFlags = false;
2018-06-04 19:22:07 +00:00
# change argv0 to "opam" as a workaround for
# https://github.com/ocaml/opam/issues/2142
postInstall = ''
2018-06-04 19:22:07 +00:00
mv $out/bin/opam $out/bin/.opam-wrapped
makeWrapper $out/bin/.opam-wrapped $out/bin/opam \
--argv0 "opam" \
2018-09-06 17:18:34 +00:00
--suffix PATH : ${aspcud}/bin:${unzip}/bin:${curl}/bin:${lib.optionalString stdenv.isLinux "${bubblewrap}/bin:"}${getconf}/bin
$out/bin/opam-installer --prefix=$installer opam-installer.install
'';
2014-11-03 16:55:33 +00:00
doCheck = false;
2015-03-22 20:31:25 +00:00
meta = with stdenv.lib; {
2014-11-03 16:55:33 +00:00
description = "A package manager for OCaml";
2015-03-22 20:31:25 +00:00
homepage = http://opam.ocamlpro.com/;
maintainers = [ maintainers.henrytill ];
platforms = platforms.all;
2014-11-03 16:55:33 +00:00
};
}
2018-09-06 17:18:34 +00:00
# Generated by: ./opam.nix.pl -v 2.0.0 -p opam-pull-3487.patch,opam-shebangs.patch,opam-mccs-darwin.patch