11 useX11 = !stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isMips;
12 useNativeCompilers = !stdenv.hostPlatform.isMips;
13 inherit (lib) optional optionals optionalString;
16 stdenv.mkDerivation rec {
21 url = "https://caml.inria.fr/pub/distrib/ocaml-4.00/${pname}-${version}.tar.bz2";
22 sha256 = "33c3f4acff51685f5bfd7c260f066645e767d4e865877bf1613c176a77799951";
25 # Compatibility with Glibc 2.34
28 url = "https://github.com/ocaml/ocaml/commit/60b0cdaf2519d881947af4175ac4c6ff68901be3.patch";
29 sha256 = "sha256:07g9q9sjk4xsbqix7jxggfp36v15pmqw4bms80g5car0hfbszirn";
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 ";
48 ++ optionals useNativeCompilers [
52 buildInputs = [ ncurses ] ++ optionals useX11 [ libX11 ];
53 installTargets = "install" + optionalString useNativeCompilers " installopt";
56 sed -e "s@/bin/cat@$CAT@" -i config/auto-aux/sharpbang
60 ln -sv $out/lib/ocaml/caml $out/include/caml
64 nativeCompilers = useNativeCompilers;
68 homepage = "http://caml.inria.fr/ocaml";
70 license = with licenses; [
74 description = "Most popular variant of the Caml language";
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
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).
94 platforms = with platforms; linux;