tutanota-desktop: 259.250108.1 -> 266.250202.0 (#377234)
[NixPkgs.git] / pkgs / development / compilers / ocaml / 4.00.1.nix
blob337bf3c4dafd48931f57947e12eafde388abd242
2   lib,
3   stdenv,
4   fetchurl,
5   fetchpatch,
6   ncurses,
7   libX11,
8 }:
10 let
11   useX11 = !stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isMips;
12   useNativeCompilers = !stdenv.hostPlatform.isMips;
13   inherit (lib) optional optionals optionalString;
16 stdenv.mkDerivation rec {
17   pname = "ocaml";
18   version = "4.00.1";
20   src = fetchurl {
21     url = "https://caml.inria.fr/pub/distrib/ocaml-4.00/${pname}-${version}.tar.bz2";
22     sha256 = "33c3f4acff51685f5bfd7c260f066645e767d4e865877bf1613c176a77799951";
23   };
25   # Compatibility with Glibc 2.34
26   patches = [
27     (fetchpatch {
28       url = "https://github.com/ocaml/ocaml/commit/60b0cdaf2519d881947af4175ac4c6ff68901be3.patch";
29       sha256 = "sha256:07g9q9sjk4xsbqix7jxggfp36v15pmqw4bms80g5car0hfbszirn";
30     })
31   ];
33   # Workaround build failure on -fno-common toolchains like upstream
34   # gcc-10. Otherwise build fails as:
35   #   ld: libcamlrun.a(startup.o):(.bss+0x800): multiple definition of
36   #     `caml_code_fragments_table'; libcamlrun.a(backtrace.o):(.bss+0x20): first defined here
37   env.NIX_CFLAGS_COMPILE = "-fcommon";
39   prefixKey = "-prefix ";
40   configureFlags =
41     [ "-no-tk" ]
42     ++ optionals useX11 [
43       "-x11lib"
44       libX11
45     ];
46   buildFlags =
47     [ "world" ]
48     ++ optionals useNativeCompilers [
49       "bootstrap"
50       "world.opt"
51     ];
52   buildInputs = [ ncurses ] ++ optionals useX11 [ libX11 ];
53   installTargets = "install" + optionalString useNativeCompilers " installopt";
54   preConfigure = ''
55     CAT=$(type -tp cat)
56     sed -e "s@/bin/cat@$CAT@" -i config/auto-aux/sharpbang
57   '';
58   postBuild = ''
59     mkdir -p $out/include
60     ln -sv $out/lib/ocaml/caml $out/include/caml
61   '';
63   passthru = {
64     nativeCompilers = useNativeCompilers;
65   };
67   meta = with lib; {
68     homepage = "http://caml.inria.fr/ocaml";
69     branch = "4.00";
70     license = with licenses; [
71       qpl # compiler
72       lgpl2 # library
73     ];
74     description = "Most popular variant of the Caml language";
76     longDescription = ''
77       OCaml is the most popular variant of the Caml language.  From a
78       language standpoint, it extends the core Caml language with a
79       fully-fledged object-oriented layer, as well as a powerful module
80       system, all connected by a sound, polymorphic type system featuring
81       type inference.
83       The OCaml system is an industrial-strength implementation of this
84       language, featuring a high-performance native-code compiler (ocamlopt)
85       for 9 processor architectures (IA32, PowerPC, AMD64, Alpha, Sparc,
86       Mips, IA64, HPPA, StrongArm), as well as a bytecode compiler (ocamlc)
87       and an interactive read-eval-print loop (ocaml) for quick development
88       and portability.  The OCaml distribution includes a comprehensive
89       standard library, a replay debugger (ocamldebug), lexer (ocamllex) and
90       parser (ocamlyacc) generators, a pre-processor pretty-printer (camlp4)
91       and a documentation generator (ocamldoc).
92     '';
94     platforms = with platforms; linux;
95   };