biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / development / tools / ocaml / opam / default.nix
bloba60b12667fa7bb26d69cbf04f7958a01072a5a2a
1 { stdenv, lib, fetchurl, makeWrapper, getconf,
2   ocaml, unzip, ncurses, curl, bubblewrap, Foundation
3 }:
5 assert lib.versionAtLeast ocaml.version "4.02.3";
7 let
8   srcs = {
9     "0install-solver" = fetchurl {
10       url = "https://github.com/0install/0install/releases/download/v2.17/0install-v2.17.tbz";
11       sha256 = "08q95mzmf9pyyqs68ff52422f834hi313cxmypwrxmxsabcfa10p";
12     };
13     "base64" = fetchurl {
14       url = "https://github.com/mirage/ocaml-base64/releases/download/v3.5.0/base64-v3.5.0.tbz";
15       sha256 = "19735bvb3k263hzcvdhn4d5lfv2qscc9ib4q85wgxsvq0p0fk7aq";
16     };
17     "cmdliner" = fetchurl {
18       url = "http://erratique.ch/software/cmdliner/releases/cmdliner-1.0.4.tbz";
19       sha256 = "1h04q0zkasd0mw64ggh4y58lgzkhg6yhzy60lab8k8zq9ba96ajw";
20     };
21     "cppo" = fetchurl {
22       url = "https://github.com/ocaml-community/cppo/archive/v1.6.8.tar.gz";
23       sha256 = "0lxy4xkkkwgs1cj6d9lyzsqi9f6fc9r6cir5imi7yjqrpd86s1by";
24     };
25     "cudf" = fetchurl {
26       url = "https://gitlab.com/irill/cudf/-/archive/v0.10/cudf-v0.10.tar.gz";
27       sha256 = "0l7vzvlrk4x4vw1lkd1wzarxz3h82r3835singcay8m8zj8777bv";
28     };
29     "dose3" = fetchurl {
30       url = "https://gitlab.com/irill/dose3/-/archive/7.0.0/dose3-7.0.0.tar.gz";
31       sha256 = "0ab0llqdmy82ljh8xdf57y00c9jvf1vnxiq9hczli0r6vc263nq2";
32     };
33     "dune-local" = fetchurl {
34       url = "https://github.com/ocaml/dune/releases/download/3.5.0/dune-3.5.0.tbz";
35       sha256 = "041n16sn41wwj6fgi7l10hvbl5x5swygqv33d4csx7rm0iklrgbp";
36     };
37     "extlib" = fetchurl {
38       url = "https://github.com/ygrek/ocaml-extlib/releases/download/1.7.9/extlib-1.7.9.tar.gz";
39       sha256 = "1jydzw2n84cfiz9y6lk4gih4wbr8jybanmiryfs01svd07g4vpjq";
40     };
41     "mccs" = fetchurl {
42       url = "https://github.com/AltGr/ocaml-mccs/archive/1.1+13.tar.gz";
43       sha256 = "05nnji9h8mss3hzjr5faid2v3xfr7rcv2ywmpcxxp28y6h2kv9gv";
44     };
45     "ocamlgraph" = fetchurl {
46       url = "https://github.com/backtracking/ocamlgraph/releases/download/2.0.0/ocamlgraph-2.0.0.tbz";
47       sha256 = "029692bvdz3hxpva9a2jg5w5381fkcw55ysdi8424lyyjxvjdzi0";
48     };
49     "opam-0install-cudf" = fetchurl {
50       url = "https://github.com/ocaml-opam/opam-0install-solver/releases/download/v0.4.2/opam-0install-cudf-v0.4.2.tbz";
51       sha256 = "10wma4hh9l8hk49rl8nql6ixsvlz3163gcxspay5fwrpbg51fmxr";
52     };
53     "opam-file-format" = fetchurl {
54       url = "https://github.com/ocaml/opam-file-format/archive/2.1.4.tar.gz";
55       sha256 = "0xbdlpxb0348pbwijna2x6nbi8fcxdh63cwrznn4q4zzbv9zsy02";
56     };
57     "re" = fetchurl {
58       url = "https://github.com/ocaml/ocaml-re/releases/download/1.10.3/re-1.10.3.tbz";
59       sha256 = "1fqfg609996bgxr14yyfxhvl6hm9c1j0mm2xjdjigqrzgyb4crc4";
60     };
61     "result" = fetchurl {
62       url = "https://github.com/janestreet/result/releases/download/1.5/result-1.5.tbz";
63       sha256 = "0cpfp35fdwnv3p30a06wd0py3805qxmq3jmcynjc3x2qhlimwfkw";
64     };
65     "seq" = fetchurl {
66       url = "https://github.com/c-cube/seq/archive/0.2.2.tar.gz";
67       sha256 = "1ck15v3pg8bacdg6d6iyp2jc3kgrzxk5jsgzx3287x2ycb897j53";
68     };
69     "stdlib-shims" = fetchurl {
70       url = "https://github.com/ocaml/stdlib-shims/releases/download/0.3.0/stdlib-shims-0.3.0.tbz";
71       sha256 = "0jnqsv6pqp5b5g7lcjwgd75zqqvcwcl5a32zi03zg1kvj79p5gxs";
72     };
73     opam = fetchurl {
74       url = "https://github.com/ocaml/opam/archive/2.1.5.zip";
75       sha256 = "0s8r5gfs2zsyfn3jzqnvns3g0rkik3pw628n0dik55fwq3zjgg4a";
76     };
77   };
78 in stdenv.mkDerivation {
79   pname = "opam";
80   version = "2.1.5";
82   strictDeps = true;
84   nativeBuildInputs = [ makeWrapper unzip ocaml curl ];
85   buildInputs = [ ncurses getconf ]
86     ++ lib.optionals stdenv.isLinux [ bubblewrap ]
87     ++ lib.optionals stdenv.isDarwin [ Foundation ];
89   src = srcs.opam;
91   postUnpack = ''
92     ln -sv ${srcs."0install-solver"} $sourceRoot/src_ext/0install-solver.tbz
93     ln -sv ${srcs."base64"} $sourceRoot/src_ext/base64.tbz
94     ln -sv ${srcs."cmdliner"} $sourceRoot/src_ext/cmdliner.tbz
95     ln -sv ${srcs."cppo"} $sourceRoot/src_ext/cppo.tar.gz
96     ln -sv ${srcs."cudf"} $sourceRoot/src_ext/cudf.tar.gz
97     ln -sv ${srcs."dose3"} $sourceRoot/src_ext/dose3.tar.gz
98     ln -sv ${srcs."dune-local"} $sourceRoot/src_ext/dune-local.tbz
99     ln -sv ${srcs."extlib"} $sourceRoot/src_ext/extlib.tar.gz
100     ln -sv ${srcs."mccs"} $sourceRoot/src_ext/mccs.tar.gz
101     ln -sv ${srcs."ocamlgraph"} $sourceRoot/src_ext/ocamlgraph.tbz
102     ln -sv ${srcs."opam-0install-cudf"} $sourceRoot/src_ext/opam-0install-cudf.tbz
103     ln -sv ${srcs."opam-file-format"} $sourceRoot/src_ext/opam-file-format.tar.gz
104     ln -sv ${srcs."re"} $sourceRoot/src_ext/re.tbz
105     ln -sv ${srcs."result"} $sourceRoot/src_ext/result.tbz
106     ln -sv ${srcs."seq"} $sourceRoot/src_ext/seq.tar.gz
107     ln -sv ${srcs."stdlib-shims"} $sourceRoot/src_ext/stdlib-shims.tbz
108   '';
110   patches = [ ./opam-shebangs.patch ];
112   preConfigure = ''
113     substituteInPlace ./src_ext/Makefile --replace "%.stamp: %.download" "%.stamp:"
114     patchShebangs src/state/shellscripts
115   '';
117   postConfigure = "make lib-ext";
119   # Dirty, but apparently ocp-build requires a TERM
120   makeFlags = ["TERM=screen"];
122   outputs = [ "out" "installer" ];
123   setOutputFlags = false;
125   # change argv0 to "opam" as a workaround for
126   # https://github.com/ocaml/opam/issues/2142
127   postInstall = ''
128     mv $out/bin/opam $out/bin/.opam-wrapped
129     makeWrapper $out/bin/.opam-wrapped $out/bin/opam \
130       --argv0 "opam" \
131       --suffix PATH : ${unzip}/bin:${curl}/bin:${lib.optionalString stdenv.isLinux "${bubblewrap}/bin:"}${getconf}/bin \
132       --set OPAM_USER_PATH_RO /run/current-system/sw/bin:/nix/
133     $out/bin/opam-installer --prefix=$installer opam-installer.install
134   '';
136   doCheck = false;
138   meta = with lib; {
139     description = "A package manager for OCaml";
140     homepage = "https://opam.ocaml.org/";
141     changelog = "https://github.com/ocaml/opam/raw/${version}/CHANGES";
142     maintainers = [ maintainers.marsam ];
143     license = licenses.lgpl21Only;
144     platforms = platforms.all;
145   };
147 # Generated by: ./opam.nix.pl -v 2.1.5 -p opam-shebangs.patch