ocaml-ng: drop ocaml <=4.08 (#427222)

This commit is contained in:
Wolfgang Walther
2025-10-15 17:12:42 +00:00
committed by GitHub
12 changed files with 19 additions and 414 deletions
@@ -1,99 +0,0 @@
{
lib,
stdenv,
fetchurl,
fetchpatch,
ncurses,
libX11,
}:
let
useX11 = !stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isMips;
useNativeCompilers = !stdenv.hostPlatform.isMips;
inherit (lib) optional optionals optionalString;
in
stdenv.mkDerivation rec {
pname = "ocaml";
version = "4.00.1";
src = fetchurl {
url = "https://caml.inria.fr/pub/distrib/ocaml-4.00/${pname}-${version}.tar.bz2";
sha256 = "33c3f4acff51685f5bfd7c260f066645e767d4e865877bf1613c176a77799951";
};
# Compatibility with Glibc 2.34
patches = [
(fetchpatch {
url = "https://github.com/ocaml/ocaml/commit/60b0cdaf2519d881947af4175ac4c6ff68901be3.patch";
sha256 = "sha256:07g9q9sjk4xsbqix7jxggfp36v15pmqw4bms80g5car0hfbszirn";
})
];
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: libcamlrun.a(startup.o):(.bss+0x800): multiple definition of
# `caml_code_fragments_table'; libcamlrun.a(backtrace.o):(.bss+0x20): first defined here
env.NIX_CFLAGS_COMPILE = "-fcommon";
prefixKey = "-prefix ";
configureFlags = [
"-no-tk"
]
++ optionals useX11 [
"-x11lib"
libX11
];
buildFlags = [
"world"
]
++ optionals useNativeCompilers [
"bootstrap"
"world.opt"
];
buildInputs = [ ncurses ] ++ optionals useX11 [ libX11 ];
installTargets = "install" + optionalString useNativeCompilers " installopt";
preConfigure = ''
CAT=$(type -tp cat)
sed -e "s@/bin/cat@$CAT@" -i config/auto-aux/sharpbang
'';
postBuild = ''
mkdir -p $out/include
ln -sv $out/lib/ocaml/caml $out/include/caml
'';
passthru = {
nativeCompilers = useNativeCompilers;
};
meta = with lib; {
homepage = "http://caml.inria.fr/ocaml";
branch = "4.00";
license = with licenses; [
qpl # compiler
lgpl2 # library
];
description = "Most popular variant of the Caml language";
longDescription = ''
OCaml is the most popular variant of the Caml language. From a
language standpoint, it extends the core Caml language with a
fully-fledged object-oriented layer, as well as a powerful module
system, all connected by a sound, polymorphic type system featuring
type inference.
The OCaml system is an industrial-strength implementation of this
language, featuring a high-performance native-code compiler (ocamlopt)
for 9 processor architectures (IA32, PowerPC, AMD64, Alpha, Sparc,
Mips, IA64, HPPA, StrongArm), as well as a bytecode compiler (ocamlc)
and an interactive read-eval-print loop (ocaml) for quick development
and portability. The OCaml distribution includes a comprehensive
standard library, a replay debugger (ocamldebug), lexer (ocamllex) and
parser (ocamlyacc) generators, a pre-processor pretty-printer (camlp4)
and a documentation generator (ocamldoc).
'';
platforms = with platforms; linux;
};
}
@@ -1,21 +0,0 @@
import ./generic.nix {
major_version = "4";
minor_version = "01";
patch_version = "0";
patches = [
./fix-clang-build-on-osx.diff
# Compatibility with Glibc 2.34
{
url = "https://github.com/ocaml/ocaml/commit/d111407bf4ff71171598d30825c8e59ed5f75fd6.patch";
sha256 = "sha256:08mpy7lsiwv8m5qrqc4xzyiv2hri5713gz2qs1nfz02hz1bd79mc";
}
];
sha256 = "03d7ida94s1gpr3gadf4jyhmh5rrszd5s4m4z59daaib25rvfyv7";
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: libcamlrun.a(startup.o):(.bss+0x800): multiple definition of
# `caml_code_fragments_table'; libcamlrun.a(backtrace.o):(.bss+0x20): first defined here
env.NIX_CFLAGS_COMPILE = "-fcommon";
}
-26
View File
@@ -1,26 +0,0 @@
import ./generic.nix {
major_version = "4";
minor_version = "02";
patch_version = "3";
patches = [
./ocamlbuild.patch
# Compatibility with Glibc 2.34
{
url = "https://github.com/ocaml/ocaml/commit/9de2b77472aee18a94b41cff70caee27fb901225.patch";
sha256 = "sha256:12sw512kpwk0xf2g6j0h5vqgd8xcmgrvgyilx6fxbd6bnfv1yib9";
}
# Compatibility with Binutils 2.29
{
url = "https://github.com/ocaml/ocaml/commit/bcc7a767279ff70518b3f4219cc0b9bffec7dd43.patch";
sha256 = "sha256-z3xrqN6bh/EW9dkPg6Hz8mT79DFm26yGRoPbE+RMYi0=";
}
];
sha256 = "1qwwvy8nzd87hk8rd9sm667nppakiapnx4ypdwcrlnav2dz6kil3";
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: libcamlrun.a(startup.o):(.bss+0x800): multiple definition of
# `caml_code_fragments_table'; libcamlrun.a(backtrace.o):(.bss+0x20): first defined here
env.NIX_CFLAGS_COMPILE = "-fcommon";
}
-25
View File
@@ -1,25 +0,0 @@
import ./generic.nix {
major_version = "4";
minor_version = "03";
patch_version = "0";
sha256 = "09p3iwwi55r6rbrpyp8f0wmkb0ppcgw67yxw6yfky60524wayp39";
patches = [
# Compatibility with Glibc 2.34
{
url = "https://github.com/ocaml/ocaml/commit/a8b2cc3b40f5269ce8525164ec2a63b35722b22b.patch";
sha256 = "sha256:1rrknmrk86xrj2k3hznnjk1gwnliyqh125zabg1hvy6dlvml9b0x";
}
# Compatibility with Binutils 2.29
{
url = "https://github.com/ocaml/ocaml/commit/c204f07bfb20174f9e1c9ff586fb7b2f42b8bf18.patch";
sha256 = "sha256-AAXyMZ7ujO67SGz+tGXKZkVcINAwvccHlFHmKnUt848=";
}
];
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: libcamlrun.a(startup.o):(.bss+0x800): multiple definition of
# `caml_code_fragments_table'; libcamlrun.a(backtrace.o):(.bss+0x20): first defined here
env.NIX_CFLAGS_COMPILE = "-fcommon";
}
-28
View File
@@ -1,28 +0,0 @@
import ./generic.nix {
major_version = "4";
minor_version = "04";
patch_version = "2";
sha256 = "0bhgjzi78l10824qga85nlh18jg9lb6aiamf9dah1cs6jhzfsn6i";
# If the executable is stripped it does not work
dontStrip = true;
patches = [
# Compatibility with Glibc 2.34
{
url = "https://github.com/ocaml/ocaml/commit/6bcff7e6ce1a43e088469278eb3a9341e6a2ca5b.patch";
sha256 = "sha256:1hd45f7mwwrrym2y4dbcwklpv0g94avbz7qrn81l7w8mrrj3bngi";
}
# Compatibility with Binutils 2.29
{
url = "https://github.com/ocaml/ocaml/commit/db11f141a0e35c7fbaec419a33c4c39d199e2635.patch";
sha256 = "sha256-oIwmbXOCzDGyASpbQ7hd7SCs4YHjd9hBBksJ74V3GiY=";
}
];
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: libcamlrun.a(startup.o):(.bss+0x800): multiple definition of
# `caml_code_fragments_table'; libcamlrun.a(backtrace.o):(.bss+0x20): first defined here
env.NIX_CFLAGS_COMPILE = "-fcommon";
}
-28
View File
@@ -1,28 +0,0 @@
import ./generic.nix {
major_version = "4";
minor_version = "05";
patch_version = "0";
sha256 = "1y9fw1ci9pwnbbrr9nwr8cq8vypcxwdf4akvxard3mxl2jx2g984";
# If the executable is stipped it does not work
dontStrip = true;
patches = [
# Compatibility with Glibc 2.34
{
url = "https://github.com/ocaml/ocaml/commit/50c2d1275e537906ea144bd557fde31e0bf16e5f.patch";
sha256 = "sha256:0ck9b2dpgg5k2p9ndbgniql24h35pn1bbpxjvk69j715lswzy4mh";
}
# Compatibility with Binutils 2.29
{
url = "https://github.com/ocaml/ocaml/commit/b00000c6679804731692362b0baac27fa3fddfd5.patch";
sha256 = "sha256-CuEXGK3EsOevyUrc9TmSZo9DVBwjunQX7mKnDVHFpkY=";
}
];
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: libcamlrun.a(startup.o):(.bss+0x800): multiple definition of
# `caml_code_fragments_table'; libcamlrun.a(backtrace.o):(.bss+0x20): first defined here
env.NIX_CFLAGS_COMPILE = "-fcommon";
}
-23
View File
@@ -1,23 +0,0 @@
import ./generic.nix {
major_version = "4";
minor_version = "06";
patch_version = "1";
sha256 = "1n3pygfssd6nkrq876wszm5nm3v4605q4k16a66h1nmq9wvf01vg";
# If the executable is stripped it does not work
dontStrip = true;
patches = [
# Compatibility with Glibc 2.34
{
url = "https://github.com/ocaml/ocaml/commit/137a4ad167f25fe1bee792977ed89f30d19bcd74.patch";
sha256 = "sha256:0izsf6rm3677vbbx0snkmn9pkfcsayrdwz3ipiml5wjiaysnchjz";
}
];
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: libcamlrun.a(startup.o):(.bss+0x800): multiple definition of
# `caml_code_fragments_table'; libcamlrun.a(backtrace.o):(.bss+0x20): first defined here
env.NIX_CFLAGS_COMPILE = "-fcommon";
}
-23
View File
@@ -1,23 +0,0 @@
import ./generic.nix {
major_version = "4";
minor_version = "07";
patch_version = "1";
sha256 = "1f07hgj5k45cylj1q3k5mk8yi02cwzx849b1fwnwia8xlcfqpr6z";
# If the executable is stripped it does not work
dontStrip = true;
patches = [
# Compatibility with Glibc 2.34
{
url = "https://github.com/ocaml/ocaml/commit/00b8c4d503732343d5d01761ad09650fe50ff3a0.patch";
sha256 = "sha256:02cfya5ff5szx0fsl5x8ax76jyrla9zmf3qxavf3adhwq5ssrfcv";
}
];
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: libcamlrun.a(startup.o):(.bss+0x800): multiple definition of
# `caml_code_fragments_table'; libcamlrun.a(backtrace.o):(.bss+0x20): first defined here
env.NIX_CFLAGS_COMPILE = "-fcommon";
}
-26
View File
@@ -1,26 +0,0 @@
import ./generic.nix {
major_version = "4";
minor_version = "08";
patch_version = "1";
sha256 = "18sycl3zmgb8ghpxymriy5d72gvw7m5ra65v51hcrmzzac21hkyd";
# If the executable is stripped it does not work
dontStrip = true;
# Breaks build with Clang
hardeningDisable = [ "strictoverflow" ];
patches = [
# Compatibility with Glibc 2.34
{
url = "https://github.com/ocaml/ocaml/commit/17df117b4939486d3285031900587afce5262c8c.patch";
sha256 = "sha256:1b3jc6sj2k23yvfwrv6nc1f4x2n2biqbhbbp74aqb6iyqyjsq35n";
}
];
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: libcamlrun.a(startup.o):(.bss+0x800): multiple definition of
# `caml_code_fragments_table'; libcamlrun.a(backtrace.o):(.bss+0x20): first defined here
env.NIX_CFLAGS_COMPILE = "-fcommon";
}
@@ -1,20 +0,0 @@
diff --git a/configure b/configure
index d45e88f..25d872b 100755
--- a/configure
+++ b/configure
@@ -322,7 +322,14 @@ case "$bytecc,$target" in
bytecccompopts="-fno-defer-pop $gcc_warnings -DSHRINKED_GNUC"
mathlib="";;
*,*-*-darwin*)
- bytecccompopts="-fno-defer-pop $gcc_warnings"
+ # On recent version of OSX, gcc is a symlink to clang
+ if $bytecc --version | grep -q clang; then
+ # -fno-defer-pop is not supported by clang, and make recent
+ # versions of clang to fail
+ bytecccompopts="$gcc_warnings"
+ else
+ bytecccompopts="-fno-defer-pop $gcc_warnings"
+ fi
mathlib=""
mkexe="$mkexe -Wl,-no_compact_unwind"
# Tell gcc that we can use 32-bit code addresses for threaded code
@@ -1,45 +0,0 @@
Author: Vincent Laporte <Vincent.Laporte@gmail.com>
Date: Sun Feb 1 11:19:50 2015 +0100
ocamlbuild: use ocamlfind to discover camlp4 path
and default to `+camlp4`
diff --git a/ocamlbuild/ocaml_specific.ml b/ocamlbuild/ocaml_specific.ml
index b902810..a73b7a5 100644
--- a/ocamlbuild/ocaml_specific.ml
+++ b/ocamlbuild/ocaml_specific.ml
@@ -698,15 +698,25 @@ ocaml_lib ~extern:true ~tag_name:"use_toplevel" "toplevellib";;
ocaml_lib ~extern:true ~dir:"+ocamldoc" "ocamldoc";;
ocaml_lib ~extern:true ~dir:"+ocamlbuild" ~tag_name:"use_ocamlbuild" "ocamlbuildlib";;
-ocaml_lib ~extern:true ~dir:"+camlp4" ~tag_name:"use_camlp4" "camlp4lib";;
-ocaml_lib ~extern:true ~dir:"+camlp4" ~tag_name:"use_old_camlp4" "camlp4";;
-ocaml_lib ~extern:true ~dir:"+camlp4" ~tag_name:"use_camlp4_full" "camlp4fulllib";;
+let camlp4dir =
+ Findlib.(
+ try
+ if sys_command "sh -c 'ocamlfind list >/dev/null' 2>/dev/null" != 0
+ then raise (Findlib_error Cannot_run_ocamlfind);
+ (query "camlp4").location
+ with Findlib_error _ ->
+ "+camlp4"
+ );;
+
+ocaml_lib ~extern:true ~dir:camlp4dir ~tag_name:"use_camlp4" "camlp4lib";;
+ocaml_lib ~extern:true ~dir:camlp4dir ~tag_name:"use_old_camlp4" "camlp4";;
+ocaml_lib ~extern:true ~dir:camlp4dir ~tag_name:"use_camlp4_full" "camlp4fulllib";;
flag ["ocaml"; "compile"; "use_camlp4_full"]
- (S[A"-I"; A"+camlp4/Camlp4Parsers";
- A"-I"; A"+camlp4/Camlp4Printers";
- A"-I"; A"+camlp4/Camlp4Filters"]);;
-flag ["ocaml"; "use_camlp4_bin"; "link"; "byte"] (A"+camlp4/Camlp4Bin.cmo");;
-flag ["ocaml"; "use_camlp4_bin"; "link"; "native"] (A"+camlp4/Camlp4Bin.cmx");;
+ (S[A"-I"; A(camlp4dir^"/Camlp4Parsers");
+ A"-I"; A(camlp4dir^"/Camlp4Printers");
+ A"-I"; A(camlp4dir^"/Camlp4Filters")]);;
+flag ["ocaml"; "use_camlp4_bin"; "link"; "byte"] (A(camlp4dir^"/Camlp4Bin.cmo"));;
+flag ["ocaml"; "use_camlp4_bin"; "link"; "native"] (A(camlp4dir^"/Camlp4Bin.cmx"));;
flag ["ocaml"; "debug"; "compile"; "byte"] (A "-g");;
flag ["ocaml"; "debug"; "link"; "byte"; "program"] (A "-g");;
+19 -50
View File
@@ -2247,56 +2247,6 @@ in
rec {
inherit mkOcamlPackages;
ocamlPackages_4_00_1 = mkOcamlPackages (
callPackage ../development/compilers/ocaml/4.00.1.nix {
stdenv = pkgs.gcc13Stdenv;
}
);
ocamlPackages_4_01_0 = mkOcamlPackages (
callPackage ../development/compilers/ocaml/4.01.0.nix {
stdenv = pkgs.gcc13Stdenv;
}
);
ocamlPackages_4_02 = mkOcamlPackages (
callPackage ../development/compilers/ocaml/4.02.nix {
stdenv = pkgs.gcc13Stdenv;
}
);
ocamlPackages_4_03 = mkOcamlPackages (
callPackage ../development/compilers/ocaml/4.03.nix {
stdenv = pkgs.gcc13Stdenv;
}
);
ocamlPackages_4_04 = mkOcamlPackages (
callPackage ../development/compilers/ocaml/4.04.nix {
stdenv = pkgs.gcc13Stdenv;
}
);
ocamlPackages_4_05 = mkOcamlPackages (
callPackage ../development/compilers/ocaml/4.05.nix {
stdenv = pkgs.gcc13Stdenv;
}
);
ocamlPackages_4_06 = mkOcamlPackages (
callPackage ../development/compilers/ocaml/4.06.nix {
stdenv = pkgs.gcc13Stdenv;
}
);
ocamlPackages_4_07 = mkOcamlPackages (
callPackage ../development/compilers/ocaml/4.07.nix {
stdenv = pkgs.gcc13Stdenv;
}
);
ocamlPackages_4_08 = mkOcamlPackages (callPackage ../development/compilers/ocaml/4.08.nix { });
ocamlPackages_4_09 = mkOcamlPackages (callPackage ../development/compilers/ocaml/4.09.nix { });
ocamlPackages_4_10 = mkOcamlPackages (callPackage ../development/compilers/ocaml/4.10.nix { });
@@ -2331,3 +2281,22 @@ rec {
}
);
}
// lib.optionalAttrs config.allowAliases {
ocamlPackages_4_00_1 = throw "ocamlPackages_4_00_1 has been removed. Please use a newer version of OCaml.";
ocamlPackages_4_01_0 = throw "ocamlPackages_4_01_0 has been removed. Please use a newer version of OCaml.";
ocamlPackages_4_02 = throw "ocamlPackages_4_02 has been removed. Please use a newer version of OCaml.";
ocamlPackages_4_03 = throw "ocamlPackages_4_03 has been removed. Please use a newer version of OCaml.";
ocamlPackages_4_04 = throw "ocamlPackages_4_04 has been removed. Please use a newer version of OCaml.";
ocamlPackages_4_05 = throw "ocamlPackages_4_05 has been removed. Please use a newer version of OCaml.";
ocamlPackages_4_06 = throw "ocamlPackages_4_06 has been removed. Please use a newer version of OCaml.";
ocamlPackages_4_07 = throw "ocamlPackages_4_07 has been removed. Please use a newer version of OCaml.";
ocamlPackages_4_08 = throw "ocamlPackages_4_08 has been removed. Please use a newer version of OCaml.";
}