uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,79 @@
{ lib, stdenv, fetchurl, fetchpatch, ncurses, xlibsWrapper }:
let
useX11 = !stdenv.isAarch32 && !stdenv.isMips;
useNativeCompilers = !stdenv.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
NIX_CFLAGS_COMPILE = "-fcommon";
prefixKey = "-prefix ";
configureFlags = [ "-no-tk" ] ++ optionals useX11 [ "-x11lib" xlibsWrapper ];
buildFlags = [ "world" ] ++ optionals useNativeCompilers [ "bootstrap" "world.opt" ];
buildInputs = [ ncurses ] ++ optional useX11 xlibsWrapper;
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;
};
}

View file

@ -0,0 +1,19 @@
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
NIX_CFLAGS_COMPILE = "-fcommon";
}

View file

@ -0,0 +1,19 @@
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"; }
];
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
NIX_CFLAGS_COMPILE = "-fcommon";
}

View file

@ -0,0 +1,18 @@
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"; }
];
# 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
NIX_CFLAGS_COMPILE = "-fcommon";
}

View file

@ -0,0 +1,21 @@
import ./generic.nix {
major_version = "4";
minor_version = "04";
patch_version = "2";
sha256 = "0bhgjzi78l10824qga85nlh18jg9lb6aiamf9dah1cs6jhzfsn6i";
# If the executable is stipped it does not work
dontStrip = true;
patches = [
# Compatibility with Glibc 2.34
{ url = "https://github.com/ocaml/ocaml/commit/6bcff7e6ce1a43e088469278eb3a9341e6a2ca5b.patch";
sha256 = "sha256:1hd45f7mwwrrym2y4dbcwklpv0g94avbz7qrn81l7w8mrrj3bngi"; }
];
# 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
NIX_CFLAGS_COMPILE = "-fcommon";
}

View file

@ -0,0 +1,21 @@
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"; }
];
# 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
NIX_CFLAGS_COMPILE = "-fcommon";
}

View file

@ -0,0 +1,21 @@
import ./generic.nix {
major_version = "4";
minor_version = "06";
patch_version = "1";
sha256 = "1n3pygfssd6nkrq876wszm5nm3v4605q4k16a66h1nmq9wvf01vg";
# If the executable is stipped 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
NIX_CFLAGS_COMPILE = "-fcommon";
}

View file

@ -0,0 +1,21 @@
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
NIX_CFLAGS_COMPILE = "-fcommon";
}

View file

@ -0,0 +1,24 @@
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
NIX_CFLAGS_COMPILE = "-fcommon";
}

View file

@ -0,0 +1,15 @@
import ./generic.nix {
major_version = "4";
minor_version = "09";
patch_version = "1";
sha256 = "1aq5505lpa39garky2icgfv4c7ylpx3j623cz9bsz5c466d2kqls";
# Breaks build with Clang
hardeningDisable = [ "strictoverflow" ];
patches = [
# Compatibility with Glibc 2.34
{ url = "https://github.com/ocaml/ocaml/commit/8eed2e441222588dc385a98ae8bd6f5820eb0223.patch";
sha256 = "sha256:1b3jc6sj2k23yvfwrv6nc1f4x2n2biqbhbbp74aqb6iyqyjsq35n"; }
];
}

View file

@ -0,0 +1,9 @@
import ./generic.nix {
major_version = "4";
minor_version = "10";
patch_version = "2";
sha256 = "sha256-locUYQeCgtXbAiB32JveJchfteN2YStE+MN9ToTwAOM=";
patches = [
./glibc-2.34-for-ocaml-4.10-and-11.patch
];
}

View file

@ -0,0 +1,9 @@
import ./generic.nix {
major_version = "4";
minor_version = "11";
patch_version = "2";
sha256 = "1m3wrgkkv3f77wvcymjm0i2srxzmx62y6jln3i0a2px07ng08l9z";
patches = [
./glibc-2.34-for-ocaml-4.10-and-11.patch
];
}

View file

@ -0,0 +1,11 @@
import ./generic.nix {
major_version = "4";
minor_version = "12";
patch_version = "1";
sha256 = "1jbjjnmqq6ymsy81x188i256bz4z5jrz1pws8g1qf59c32ganjkf";
patches = [
{ url = "https://src.fedoraproject.org/rpms/ocaml/raw/129153b85109944bf0b2922949f77ef8f32b39a1/f/0004-Dynamically-allocate-the-alternate-signal-stack-1026.patch";
sha256 = "sha256-FdQ1HkMKHU9QvgLPUBvMdPiEa7w7IL3+1F3SLv63Gog=";
}
];
}

View file

@ -0,0 +1,6 @@
import ./generic.nix {
major_version = "4";
minor_version = "13";
patch_version = "1";
sha256 = "sha256:1s7xwqidpjwfhnpfma4nb93gxfr7g9jfn03s1j03iyavmpgph7ck";
}

View file

@ -0,0 +1,6 @@
import ./generic.nix {
major_version = "4";
minor_version = "14";
patch_version = "0";
sha256 = "sha256:0axcc7c23pf4qinz4vxgkba6pwziwbp9i2ydwzar7x9zlp6diarn";
}

View file

@ -0,0 +1,16 @@
# ocaml build system does not allow for parallel building of some
# top-level targets like 'world', 'bootstrap', 'world.opt' as
# then spawn '$(MAKE) all' subprocesses that conflict among each
# other. But we would still like to run each target in parallel
# individually. This file defines such entry points.
# Re-export all existing phases to make 'make install' work as is.
include Makefile
nixpkgs_world:
$(MAKE) world
nixpkgs_world_bootstrap_world_opt:
$(MAKE) world
$(MAKE) bootstrap
$(MAKE) world.opt

View file

@ -0,0 +1,104 @@
{ lib, stdenv, fetchurl
, ncurses
, libX11, xorgproto, buildEnv
, fetchpatch
, useX11 ? stdenv.hostPlatform.isx86
}:
let
x11deps = [ libX11 xorgproto ];
inherit (lib) optionals;
baseOcamlBranch = "4.11";
baseOcamlVersion = "${baseOcamlBranch}.1";
metaocamlPatch = "111";
in
stdenv.mkDerivation rec {
pname = "ber-metaocaml";
version = metaocamlPatch;
src = fetchurl {
url = "https://caml.inria.fr/pub/distrib/ocaml-${baseOcamlBranch}/ocaml-${baseOcamlVersion}.tar.gz";
sha256 = "sha256-3Yi2OFvZLgrZInMuKMxoyHd4QXcOoAPCC9FS9dtEFc4=";
};
metaocaml = fetchurl {
url = "http://okmij.org/ftp/ML/ber-metaocaml-${metaocamlPatch}.tar.gz";
sha256 = "sha256-hDb0w0ZCm0hCz8jktZKmr/7gPSfBoKPT/cc7sPjt0yE=";
};
x11env = buildEnv { name = "x11env"; paths = x11deps; };
x11lib = "${x11env}/lib";
x11inc = "${x11env}/include";
prefixKey = "-prefix ";
configureFlags = optionals useX11 [ "--enable-flambda" ];
dontStrip = true;
buildInputs = [ ncurses ] ++ optionals useX11 x11deps;
patches = [
# glibc 2.34 changed SIGSTKSZ from a #define'd integer to an
# expression involving a function call. This broke all code that
# used SIGSTKSZ as the size of a statically-allocated array. This
# patch is also applied by the ocaml/4.07.nix expression.
(fetchpatch {
url = "https://github.com/ocaml/ocaml/commit/dd28ac0cf4365bd0ea1bcc374cbc5e95a6f39bea.patch";
sha256 = "sha256-OmyovAu+8sgg3n5YD29Cytx3u/9PO2ofMsmrwiKUxks=";
})
];
postConfigure = ''
tar -xvzf $metaocaml
cd ${pname}-${version}
make patch
cd ..
'';
buildPhase = ''
make world
make bootstrap
make opt.opt
make -i install
make installopt
mkdir -p $out/include
ln -sv $out/lib/ocaml/caml $out/include/caml
cd ${pname}-${version}
make all
'';
installPhase = ''
make install
make install.opt
'';
checkPhase = ''
cd ${pname}-${version}
make test
make test-compile
make test-native
cd ..
'';
passthru = {
nativeCompilers = true;
};
meta = with lib; {
description = "Multi-Stage Programming extension for OCaml";
homepage = "https://okmij.org/ftp/ML/MetaOCaml.html";
license = with licenses; [ /* compiler */ qpl /* library */ lgpl2 ];
maintainers = with maintainers; [ thoughtpolice ];
branch = baseOcamlBranch;
platforms = with platforms; linux ++ darwin;
broken = stdenv.isAarch64 || stdenv.isMips;
longDescription = ''
A simple extension of OCaml with the primitive type of code values, and
three basic multi-stage expression forms: Brackets, Escape, and Run.
'';
};
}

View file

@ -0,0 +1,8 @@
source $stdenv/setup
configureFlags="-prefix $out $configureFlags"
genericBuild
#cd emacs/
#mkdir -p $out/share/ocaml/emacs
#make EMACSDIR=$out/share/ocaml/emacs install

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,20 @@
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

View file

@ -0,0 +1,143 @@
{ minor_version, major_version, patch_version, patches ? []
, ...}@args:
let
versionNoPatch = "${toString major_version}.${toString minor_version}";
version = "${versionNoPatch}.${toString patch_version}";
safeX11 = stdenv: !(stdenv.isAarch32 || stdenv.isMips || stdenv.hostPlatform.isStatic);
in
{ lib, stdenv, fetchurl, ncurses, buildEnv, libunwind, fetchpatch
, libX11, xorgproto, useX11 ? safeX11 stdenv && lib.versionOlder version "4.09"
, aflSupport ? false
, flambdaSupport ? false
, spaceTimeSupport ? false
}:
assert useX11 -> safeX11 stdenv;
assert aflSupport -> lib.versionAtLeast version "4.05";
assert flambdaSupport -> lib.versionAtLeast version "4.03";
assert spaceTimeSupport -> lib.versionAtLeast version "4.04";
let
src = args.src or (fetchurl {
url = args.url or "http://caml.inria.fr/pub/distrib/ocaml-${versionNoPatch}/ocaml-${version}.tar.xz";
inherit (args) sha256;
});
in
let
useNativeCompilers = !stdenv.isMips;
inherit (lib) optional optionals optionalString;
pname = "ocaml${optionalString aflSupport "+afl"}${optionalString spaceTimeSupport "+spacetime"}${optionalString flambdaSupport "+flambda"}";
in
let
x11env = buildEnv { name = "x11env"; paths = [libX11 xorgproto]; };
x11lib = x11env + "/lib";
x11inc = x11env + "/include";
fetchpatch' = x: if builtins.isAttrs x then fetchpatch x else x;
in
stdenv.mkDerivation (args // {
inherit pname version src;
patches = map fetchpatch' patches;
strictDeps = true;
prefixKey = "-prefix ";
configureFlags =
let flags = new: old:
if lib.versionAtLeast version "4.08"
then new else old
; in
optionals useX11 (flags
[ "--x-libraries=${x11lib}" "--x-includes=${x11inc}"]
[ "-x11lib" x11lib "-x11include" x11inc ])
++ optional aflSupport (flags "--with-afl" "-afl-instrument")
++ optional flambdaSupport (flags "--enable-flambda" "-flambda")
++ optional spaceTimeSupport (flags "--enable-spacetime" "-spacetime")
++ optional (stdenv.hostPlatform.isStatic && (lib.versionOlder version "4.08")) "-no-shared-libs"
++ optionals (stdenv.hostPlatform != stdenv.buildPlatform && lib.versionOlder version "4.08") [
"-host ${stdenv.hostPlatform.config}"
"-target ${stdenv.targetPlatform.config}"
];
dontAddStaticConfigureFlags = lib.versionOlder version "4.08";
# on aarch64-darwin using --host and --target causes the build to invoke
# `aarch64-apple-darwin-clang` while using assembler. However, such binary
# does not exist. So, disable these configure flags on `aarch64-darwin`.
# See #144785 for details.
configurePlatforms = lib.optionals (lib.versionAtLeast version "4.08" && !(stdenv.isDarwin && stdenv.isAarch64)) [ "host" "target" ];
# x86_64-unknown-linux-musl-ld: -r and -pie may not be used together
hardeningDisable = lib.optional (lib.versionAtLeast version "4.09" && stdenv.hostPlatform.isMusl) "pie"
++ lib.optionals (args ? hardeningDisable) args.hardeningDisable;
# Older versions have some race:
# cp: cannot stat 'boot/ocamlrun': No such file or directory
# make[2]: *** [Makefile:199: backup] Error 1
enableParallelBuilding = lib.versionAtLeast version "4.08";
# Workaround lack of parallelism support among top-level targets:
# we place nixpkgs-specific targets to a separate file and set
# sequential order among them as a single rule.
makefile = ./Makefile.nixpkgs;
buildFlags = if useNativeCompilers
then ["nixpkgs_world_bootstrap_world_opt"]
else ["nixpkgs_world"];
buildInputs = optional (lib.versionOlder version "4.07") ncurses
++ optionals useX11 [ libX11 xorgproto ];
propagatedBuildInputs = optional spaceTimeSupport libunwind;
installTargets = [ "install" ] ++ optional useNativeCompilers "installopt";
preConfigure = optionalString (lib.versionOlder version "4.04") ''
CAT=$(type -tp cat)
sed -e "s@/bin/cat@$CAT@" -i config/auto-aux/sharpbang
'' + optionalString (stdenv.isDarwin && lib.versionOlder version "4.13") ''
# Do what upstream does by default now: https://github.com/ocaml/ocaml/pull/10176
# This is required for aarch64-darwin, everything else works as is.
AS="${stdenv.cc}/bin/cc -c" ASPP="${stdenv.cc}/bin/cc -c"
'' + optionalString (lib.versionOlder version "4.08" && stdenv.hostPlatform.isStatic) ''
configureFlagsArray+=("-cc" "$CC" "-as" "$AS" "-partialld" "$LD -r")
'';
postBuild = ''
mkdir -p $out/include
ln -sv $out/lib/ocaml/caml $out/include/caml
'';
passthru = {
nativeCompilers = useNativeCompilers;
};
meta = with lib; {
homepage = "https://ocaml.org/";
branch = versionNoPatch;
license = with licenses; [
qpl /* compiler */
lgpl2 /* library */
];
description = "OCaml is an industrial-strength programming language supporting functional, imperative and object-oriented styles";
longDescription = ''
OCaml is a general purpose programming language with an emphasis on expressiveness and safety. Developed for more than 20 years at Inria by a group of leading researchers, it has an advanced type system that helps catch your mistakes without getting in your way. It's used in environments where a single mistake can cost millions and speed matters, is supported by an active community, and has a rich set of libraries and development tools. It's widely used in teaching for its power and simplicity.
Strengths:
* A powerful type system, equipped with parametric polymorphism and type inference. For instance, the type of a collection can be parameterized by the type of its elements. This allows defining some operations over a collection independently of the type of its elements: sorting an array is one example. Furthermore, type inference allows defining such operations without having to explicitly provide the type of their parameters and result.
* User-definable algebraic data types and pattern-matching. New algebraic data types can be defined as combinations of records and sums. Functions that operate over such data structures can then be defined by pattern matching, a generalized form of the well-known switch statement, which offers a clean and elegant way of simultaneously examining and naming data.
* Automatic memory management, thanks to a fast, unobtrusive, incremental garbage collector.
* Separate compilation of standalone applications. Portable bytecode compilers allow creating stand-alone applications out of Caml Light or OCaml programs. A foreign function interface allows OCaml code to interoperate with C code when necessary. Interactive use of OCaml is also supported via a read-evaluate-print loop.
In addition, OCaml features:
* A sophisticated module system, which allows organizing modules hierarchically and parameterizing a module over a number of other modules.
* An expressive object-oriented layer, featuring multiple inheritance, parametric and virtual classes.
* Efficient native code compilers. In addition to its bytecode compiler, OCaml offers a compiler that produces efficient machine code for many architectures.
Learn more at: https://ocaml.org/learn/description.html
'';
platforms = with platforms; linux ++ darwin;
broken = stdenv.isAarch64 && lib.versionOlder version "4.06";
};
})

View file

@ -0,0 +1,37 @@
From dfb5e954a04f59b0456cc4c0ddf3acaf22e0ff07 Mon Sep 17 00:00:00 2001
From: Richard W.M. Jones <rjones@redhat.com>
Date: Feb 28 2021 20:45:47 +0000
Subject: Workaround for glibc non-constant SIGSTKSZ
https://github.com/ocaml/ocaml/issues/10250
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
---
diff --git a/runtime/signals_nat.c b/runtime/signals_nat.c
index 8b64ab4..7f0a975 100644
--- a/runtime/signals_nat.c
+++ b/runtime/signals_nat.c
@@ -181,7 +181,19 @@ DECLARE_SIGNAL_HANDLER(trap_handler)
#error "CONTEXT_SP is required if HAS_STACK_OVERFLOW_DETECTION is defined"
#endif
+#ifndef __GLIBC__
static char sig_alt_stack[SIGSTKSZ];
+#else
+/* glibc 2.34 has non-constant SIGSTKSZ */
+static char *sig_alt_stack;
+
+static void allocate_sig_alt_stack(void) __attribute__((constructor));
+static void
+allocate_sig_alt_stack(void)
+{
+ sig_alt_stack = malloc(SIGSTKSZ);
+}
+#endif
/* Code compiled with ocamlopt never accesses more than
EXTRA_STACK bytes below the stack pointer. */

View file

@ -0,0 +1,9 @@
diff -Nuar ocaml-3.11.1/ocamldoc/remove_DEBUG ocaml-3.11.1-nixpkgs/ocamldoc/remove_DEBUG
--- ocaml-3.11.1/ocamldoc/remove_DEBUG 2004-04-15 18:18:52.000000000 +0200
+++ ocaml-3.11.1-nixpkgs/ocamldoc/remove_DEBUG 2011-01-01 17:37:07.000000000 +0100
@@ -18,4 +18,4 @@
# respecting the cpp # line annotation conventions
echo "# 1 \"$1\""
-LC_ALL=C sed -e '/DEBUG/s/.*//' "$1"
+grep -v 'DEBUG' "$1"

View file

@ -0,0 +1,240 @@
http://caml.inria.fr/mantis/view.php?id=4849
diff -bur ocaml-3.11.1/asmcomp/mips/arch.ml my_ocaml/asmcomp/mips/arch.ml
--- asmcomp/mips/arch.ml 2002-11-29 16:03:36.000000000 +0100
+++ asmcomp/mips/arch.ml 2009-08-09 23:18:31.000000000 +0200
@@ -35,7 +35,7 @@
let big_endian =
match Config.system with
- "ultrix" -> false
+ "ultrix" | "gnu" -> false
| "irix" -> true
| _ -> fatal_error "Arch_mips.big_endian"
diff -bur ocaml-3.11.1/asmcomp/mips/emit.mlp my_ocaml/asmcomp/mips/emit.mlp
--- asmcomp/mips/emit.mlp 2004-01-05 21:25:56.000000000 +0100
+++ asmcomp/mips/emit.mlp 2009-08-23 12:11:58.000000000 +0200
@@ -58,7 +58,7 @@
!stack_offset +
4 * num_stack_slots.(0) + 8 * num_stack_slots.(1) +
(if !contains_calls then if !uses_gp then 8 else 4 else 0) in
- Misc.align size 16
+ Misc.align size 16 (* n32 require quadword alignment *)
let slot_offset loc cl =
match loc with
@@ -252,7 +252,7 @@
| Lop(Icall_ind) ->
` move $25, {emit_reg i.arg.(0)}\n`;
liveregs i live_25;
- ` jal {emit_reg i.arg.(0)}\n`;
+ ` jal $25\n`; (* {emit_reg i.arg.(0)}\n; Equivalent but avoids "Warning: MIPS PIC call to register other than $25" on GNU as *)
`{record_frame i.live}\n`
| Lop(Icall_imm s) ->
liveregs i 0;
@@ -269,7 +269,7 @@
liveregs i 0;
` move $25, {emit_reg i.arg.(0)}\n`;
liveregs i live_25;
- ` j {emit_reg i.arg.(0)}\n`
+ ` j $25\n`
| Lop(Itailcall_imm s) ->
if s = !function_name then begin
` b {emit_label !tailrec_entry_point}\n`
@@ -277,11 +277,11 @@
let n = frame_size() in
if !contains_calls then
` lw $31, {emit_int(n - 4)}($sp)\n`;
+ ` la $25, {emit_symbol s}\n`; (* Rxd: put before gp restore *)
if !uses_gp then
` lw $gp, {emit_int(n - 8)}($sp)\n`;
if n > 0 then
` addu $sp, $sp, {emit_int n}\n`;
- ` la $25, {emit_symbol s}\n`;
liveregs i live_25;
` j $25\n`
end
@@ -305,8 +305,13 @@
begin match chunk with
Double_u ->
(* Destination is not 8-aligned, hence cannot use l.d *)
+ if big_endian then begin
` ldl $24, {emit_addressing addr i.arg 0}\n`;
- ` ldr $24, {emit_addressing (offset_addressing addr 7) i.arg 0}\n`;
+ ` ldr $24, {emit_addressing (offset_addressing addr 7) i.arg 0}\n`
+ end else begin
+ ` ldl $24, {emit_addressing (offset_addressing addr 7) i.arg 0}\n`;
+ ` ldr $24, {emit_addressing addr i.arg 0}\n`
+ end;
` dmtc1 $24, {emit_reg dest}\n`
| Single ->
` l.s {emit_reg dest}, {emit_addressing addr i.arg 0}\n`;
@@ -328,8 +333,13 @@
Double_u ->
(* Destination is not 8-aligned, hence cannot use l.d *)
` dmfc1 $24, {emit_reg src}\n`;
+ if big_endian then begin
` sdl $24, {emit_addressing addr i.arg 1}\n`;
` sdr $24, {emit_addressing (offset_addressing addr 7) i.arg 1}\n`
+ end else begin
+ ` sdl $24, {emit_addressing (offset_addressing addr 7) i.arg 1}\n`;
+ ` sdr $24, {emit_addressing addr i.arg 1}\n`
+ end
| Single ->
` cvt.s.d $f31, {emit_reg src}\n`;
` s.s $f31, {emit_addressing addr i.arg 1}\n`
@@ -552,6 +562,7 @@
(* There are really two groups of registers:
$sp and $30 always point to stack locations
$2 - $21 never point to stack locations. *)
+ if Config.system = "irix" then begin
` .noalias $2,$sp; .noalias $2,$30; .noalias $3,$sp; .noalias $3,$30\n`;
` .noalias $4,$sp; .noalias $4,$30; .noalias $5,$sp; .noalias $5,$30\n`;
` .noalias $6,$sp; .noalias $6,$30; .noalias $7,$sp; .noalias $7,$30\n`;
@@ -561,7 +572,8 @@
` .noalias $14,$sp; .noalias $14,$30; .noalias $15,$sp; .noalias $15,$30\n`;
` .noalias $16,$sp; .noalias $16,$30; .noalias $17,$sp; .noalias $17,$30\n`;
` .noalias $18,$sp; .noalias $18,$30; .noalias $19,$sp; .noalias $19,$30\n`;
- ` .noalias $20,$sp; .noalias $20,$30; .noalias $21,$sp; .noalias $21,$30\n\n`;
+ ` .noalias $20,$sp; .noalias $20,$30; .noalias $21,$sp; .noalias $21,$30\n\n`
+ end;
let lbl_begin = Compilenv.make_symbol (Some "data_begin") in
` .data\n`;
` .globl {emit_symbol lbl_begin}\n`;
diff -bur ocaml-3.11.1/asmrun/mips.s my_ocaml/asmrun/mips.s
--- asmrun/mips.s 2004-07-13 14:18:53.000000000 +0200
+++ asmrun/mips.s 2009-08-20 09:34:36.000000000 +0200
@@ -187,7 +187,7 @@
sw $30, caml_exception_pointer
/* Call C function */
move $25, $24
- jal $24
+ jal $25 /* Rxd: $24 replaced by $25 to avoid this "Warning: MIPS PIC call to register other than $25" ? */
/* Reload return address, alloc ptr, alloc limit */
lw $31, 0($16) /* caml_last_return_address */
lw $22, 0($17) /* caml_young_ptr */
@@ -254,7 +254,7 @@
sw $0, caml_last_return_address
/* Call the Caml code */
move $25, $24
- jal $24
+ jal $25 /* Rxd: 24 replaced by 25 */
$104:
/* Pop the trap frame, restoring caml_exception_pointer */
lw $24, 0($sp)
@@ -384,3 +384,8 @@
.word $104 /* return address into callback */
.half -1 /* negative frame size => use callback link */
.half 0 /* no roots here */
+
+#if defined(SYS_linux)
+ /* Mark stack as non-executable, PR#4564 */
+ .section .note.GNU-stack,"",%progbits
+#endif
diff -bur ocaml-3.11.1/configure my_ocaml/configure
--- configure 2009-05-20 17:33:09.000000000 +0200
+++ configure 2009-08-23 10:55:44.000000000 +0200
@@ -40,7 +40,7 @@
verbose=no
withcurses=yes
withsharedlibs=yes
-gcc_warnings="-Wall"
+gcc_warnings="-W -Wall"
partialld="ld -r"
# Try to turn internationalization off, can cause config.guess to malfunction!
@@ -292,6 +292,9 @@
# (For those who want to force "cc -64")
# Turn off warning "unused library"
bytecclinkopts="-Wl,-woff,84";;
+ gcc*,mips64el-*)
+ bytecccompopts=""
+ bytecclinkopts="-fno-defer-pop $gcc_warnings -Wl,-O1 -Wl,--as-needed";;
*,alpha*-*-unicos*)
# For the Cray T3E
bytecccompopts="-DUMK";;
@@ -468,6 +471,8 @@
echo "64-bit integers must be doubleword-aligned."
echo "#define ARCH_ALIGN_INT64" >> m.h
fi;;
+ mips64el-*)
+ echo "#define ARCH_ALIGN_INT64" >> m.h;;
*)
sh ./runtest int64align.c
case $? in
@@ -636,6 +641,7 @@
fi;;
i[3456]86-*-gnu*) arch=i386; system=gnu;;
mips-*-irix6*) arch=mips; system=irix;;
+ mips*-gnu*) arch=mips; system=gnu;;
hppa1.1-*-hpux*) arch=hppa; system=hpux;;
hppa2.0*-*-hpux*) arch=hppa; system=hpux;;
hppa*-*-linux*) arch=hppa; system=linux;;
@@ -672,7 +678,7 @@
if test -z "$ccoption"; then
case "$arch,$system,$cc" in
alpha,digital,gcc*) nativecc=cc;;
- mips,*,gcc*) nativecc=cc;;
+ mips,irix,gcc*) nativecc=cc;;
*) nativecc="$bytecc";;
esac
else
@@ -687,6 +693,9 @@
alpha,cc*,digital,*) nativecccompopts=-std1;;
mips,cc*,irix,*) nativecccompopts=-n32
nativecclinkopts="-n32 -Wl,-woff,84";;
+ mips,gcc*,gnu,mips64el-*)
+ nativecccompopts="$gcc_warnings -fPIC"
+ nativecclinkopts="--as-needed";;
*,*,nextstep,*) nativecccompopts="$gcc_warnings -U__GNUC__ -posix"
nativecclinkopts="-posix";;
*,*,rhapsody,*darwin[1-5].*)
@@ -725,6 +734,8 @@
aspp='gcc -c -Wa,-xexplicit';;
mips,*,irix) as='as -n32 -O2 -nocpp -g0'
aspp='as -n32 -O2';;
+ mips,*,gnu) as='as -KPIC'
+ aspp='gcc -c -fPIC';; # got bus error without fPIC ?
power,*,elf) as='as -u -m ppc'
aspp='gcc -c';;
power,*,bsd) as='as'
@@ -756,6 +767,7 @@
case "$nativecc" in gcc*) ;; *) cc_profile='-xpg';; esac;;
amd64,*,linux) profiling='prof';;
amd64,*,gnu) profiling='prof';;
+ mips,*,gnu) profiling='prof';;
*) profiling='noprof';;
esac
diff -bur ocaml-3.11.1/asmcomp/mips/proc.ml my_ocaml/asmcomp/mips/proc.ml
--- asmcomp/mips/proc.ml 2007-10-30 13:37:16.000000000 +0100
+++ asmcomp/mips/proc.ml 2010-03-18 08:08:06.000000000 +0100
@@ -114,7 +114,7 @@
incr int
end else begin
loc.(i) <- stack_slot (make_stack !ofs) ty;
- ofs := !ofs + size_int
+ ofs := !ofs + 8
end
| Float ->
if !float <= last_float then begin
@@ -143,7 +143,7 @@
or float regs $f12...$f19. Each argument "consumes" both one slot
in the int register file and one slot in the float register file.
Extra arguments are passed on stack, in a 64-bits slot, right-justified
- (i.e. at +4 from natural address). *)
+ (i.e. at +4 from natural address for big endians). *)
let loc_external_arguments arg =
let loc = Array.create (Array.length arg) Reg.dummy in
@@ -158,7 +158,7 @@
end else begin
begin match arg.(i).typ with
Float -> loc.(i) <- stack_slot (Outgoing !ofs) Float
- | ty -> loc.(i) <- stack_slot (Outgoing (!ofs + 4)) ty
+ | ty -> loc.(i) <- stack_slot (Outgoing (!ofs + (if big_endian then 4 else 0))) ty
end;
ofs := !ofs + 8
end

View file

@ -0,0 +1,45 @@
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");;