push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,135 @@
{
lib,
stdenv,
fetchurl,
patchelf,
gmp,
}:
let
version = "20130715";
usr_prefix = if stdenv.hostPlatform.isDarwin then "usr/local" else "usr";
dynamic_linker = stdenv.cc.bintools.dynamicLinker;
in
stdenv.mkDerivation rec {
pname = "mlton";
inherit version;
binSrc =
if stdenv.hostPlatform.system == "i686-linux" then
(fetchurl {
url = "mirror://sourceforge/project/mlton/mlton/${version}/${pname}-${version}-1.x86-linux.tgz";
sha256 = "1kxjjmnw4xk2d9hpvz43w9dvyhb3025k4zvjx785c33nrwkrdn4j";
})
else if stdenv.hostPlatform.system == "x86_64-linux" then
(fetchurl {
url = "mirror://sourceforge/project/mlton/mlton/${version}/${pname}-${version}-1.amd64-linux.tgz";
sha256 = "0fyhwxb4nmpirjbjcvk9f6w67gmn2gkz7xcgz0xbfih9kc015ygn";
})
else if stdenv.hostPlatform.system == "x86_64-darwin" then
(fetchurl {
url = "mirror://sourceforge/project/mlton/mlton/${version}/${pname}-${version}-1.amd64-darwin.gmp-macports.tgz";
sha256 = "044wnh9hhg6if886xy805683k0as347xd37r0r1yi4x7qlxzzgx9";
})
else
throw "Architecture not supported";
codeSrc = fetchurl {
url = "mirror://sourceforge/project/mlton/mlton/${version}/${pname}-${version}.src.tgz";
sha256 = "0v1x2hrh9hiqkvnbq11kf34v4i5a2x0ffxbzqaa8skyl26nmfn11";
};
srcs = [
binSrc
codeSrc
];
sourceRoot = "${pname}-${version}";
buildInputs = [ gmp ];
nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux patchelf;
makeFlags = [ "all-no-docs" ];
configurePhase = ''
# Fix paths in the source.
find . -type f | grep -v -e '\.tgz''$' | xargs sed -i "s@/usr/bin/env bash@$(type -p bash)@"
substituteInPlace $(pwd)/Makefile --replace '/bin/cp' $(type -p cp)
substituteInPlace bin/mlton-script --replace gcc cc
substituteInPlace bin/regression --replace gcc cc
substituteInPlace lib/mlnlffi-lib/Makefile --replace gcc cc
substituteInPlace mlnlffigen/gen-cppcmd --replace gcc cc
substituteInPlace runtime/Makefile --replace gcc cc
substituteInPlace ../${usr_prefix}/bin/mlton --replace gcc cc
# Fix paths in the binary distribution.
BIN_DIST_DIR="$(pwd)/../${usr_prefix}"
for f in "bin/mlton" "lib/mlton/platform" "lib/mlton/static-library" ; do
substituteInPlace "$BIN_DIST_DIR/$f" --replace '/${usr_prefix}/bin/env bash' $(type -p bash)
done
substituteInPlace $(pwd)/../${usr_prefix}/bin/mlton --replace '/${usr_prefix}/lib/mlton' $(pwd)/../${usr_prefix}/lib/mlton
''
+ lib.optionalString stdenv.cc.isClang ''
sed -i "s_ patch -s -p0 <gdtoa.hide-public-fns.patch_ patch -s -p0 <gdtoa.hide-public-fns.patch\n\tsed -i 's|printf(emptyfmt|printf(\"\"|g' ./gdtoa/arithchk.c_" ./runtime/Makefile
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
sed -i 's|XCFLAGS += -I/usr/local/include -I/sw/include -I/opt/local/include||' ./runtime/Makefile
'';
preBuild = ''
# To build the source we have to put the binary distribution in the $PATH.
export PATH="$PATH:$(pwd)/../${usr_prefix}/bin/"
# Let the builder execute the binary distribution.
chmod u+x $(pwd)/../${usr_prefix}/bin/mllex
chmod u+x $(pwd)/../${usr_prefix}/bin/mlyacc
chmod u+x $(pwd)/../${usr_prefix}/bin/mlton
# So the builder runs the binary compiler with gmp.
export LD_LIBRARY_PATH=${gmp.out}/lib''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
# Patch ELF interpreter.
patchelf --set-interpreter ${dynamic_linker} $(pwd)/../${usr_prefix}/lib/mlton/mlton-compile
for e in mllex mlyacc ; do
patchelf --set-interpreter ${dynamic_linker} $(pwd)/../${usr_prefix}/bin/$e
done
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
# Patch libgmp linking
install_name_tool -change /opt/local/lib/libgmp.10.dylib ${gmp}/lib/libgmp.10.dylib $(pwd)/../${usr_prefix}/lib/mlton/mlton-compile
install_name_tool -change /opt/local/lib/libgmp.10.dylib ${gmp}/lib/libgmp.10.dylib $(pwd)/../${usr_prefix}/bin/mlyacc
install_name_tool -change /opt/local/lib/libgmp.10.dylib ${gmp}/lib/libgmp.10.dylib $(pwd)/../${usr_prefix}/bin/mllex
'';
doCheck = true;
installTargets = [ "install-no-docs" ];
postInstall = ''
# Fix path to mlton libraries.
substituteInPlace $(pwd)/install/${usr_prefix}/bin/mlton --replace '/${usr_prefix}/lib/mlton' $out/lib/mlton
# Path to libgmp.
substituteInPlace $(pwd)/install/${usr_prefix}/bin/mlton --replace "-link-opt '-lm -lgmp'" "-link-opt '-lm -lgmp -L${gmp.out}/lib'"
# Path to gmp.h.
substituteInPlace $(pwd)/install/${usr_prefix}/bin/mlton --replace "-cc-opt '-O1 -fno-common'" "-cc-opt '-O1 -fno-common -I${gmp.dev}/include'"
# Path to the same cc used in the build; needed at runtime.
substituteInPlace $(pwd)/install/${usr_prefix}/bin/mlton --replace "gcc='gcc'" "gcc='"$(type -p cc)"'"
# Copy files to final positions.
cp -r $(pwd)/install/${usr_prefix}/bin $out
cp -r $(pwd)/install/${usr_prefix}/lib $out
cp -r $(pwd)/install/${usr_prefix}/man $out
'';
meta = import ./meta.nix { inherit lib; };
}

View File

@@ -0,0 +1,68 @@
{
lib,
stdenv,
fetchurl,
patchelf,
gmp,
}:
let
dynamic-linker = stdenv.cc.bintools.dynamicLinker;
in
stdenv.mkDerivation rec {
pname = "mlton";
version = "20180207";
src =
if stdenv.hostPlatform.system == "x86_64-linux" then
(fetchurl {
url = "https://github.com/MLton/mlton/releases/download/on-${version}-release/${pname}-${version}-1.amd64-linux.tgz";
sha256 = "0f4q575yfm5dpg4a2wsnqn4l2zrar96p6rlsk0dw10ggyfwvsjlf";
})
else if stdenv.hostPlatform.system == "x86_64-darwin" then
(fetchurl {
url = "https://github.com/MLton/mlton/releases/download/on-${version}-release/${pname}-${version}-1.amd64-darwin.gmp-static.tgz";
sha256 = "1cw7yhw48qp12q0adwf8srpjzrgkp84kmlkqw3pz8vkxz4p9hbdv";
})
else
throw "Architecture not supported";
buildInputs = [ gmp ];
nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux patchelf;
buildPhase = ''
make update \
CC="$(type -p cc)" \
WITH_GMP_INC_DIR="${gmp.dev}/include" \
WITH_GMP_LIB_DIR="${gmp}/lib"
'';
installPhase = ''
make install PREFIX=$out
'';
postFixup =
lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf --set-interpreter ${dynamic-linker} $out/lib/mlton/mlton-compile
patchelf --set-rpath ${gmp}/lib $out/lib/mlton/mlton-compile
for e in mllex mlnlffigen mlprof mlyacc; do
patchelf --set-interpreter ${dynamic-linker} $out/bin/$e
patchelf --set-rpath ${gmp}/lib $out/bin/$e
done
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
install_name_tool -change \
/opt/local/lib/libgmp.10.dylib \
${gmp}/lib/libgmp.10.dylib \
$out/lib/mlton/mlton-compile
for e in mllex mlnlffigen mlprof mlyacc; do
install_name_tool -change \
/opt/local/lib/libgmp.10.dylib \
${gmp}/lib/libgmp.10.dylib \
$out/bin/$e
done
'';
meta = import ./meta.nix { inherit lib; };
}

View File

@@ -0,0 +1,88 @@
{
lib,
stdenv,
fetchpatch,
fetchurl,
patchelf,
bash,
gmp,
}:
let
dynamic-linker = stdenv.cc.bintools.dynamicLinker;
in
stdenv.mkDerivation rec {
pname = "mlton";
version = "20210117";
src =
if stdenv.hostPlatform.system == "x86_64-linux" then
(fetchurl {
url = "https://github.com/MLton/mlton/releases/download/on-${version}-release/${pname}-${version}-1.amd64-linux-glibc2.31.tgz";
sha256 = "1lj51xg9p75qj1x5036lvjvd4a2j21kfi6vh8d0n9kdcdffvb73l";
})
else if stdenv.hostPlatform.system == "x86_64-darwin" then
(fetchurl {
url = "https://github.com/MLton/mlton/releases/download/on-${version}-release/${pname}-${version}-1.amd64-darwin-19.6.gmp-static.tgz";
sha256 = "0xndr2awlxdqr81j6snl9zqjx8r6f5fy9x65j1w899kf2dh9zsjv";
})
else if stdenv.hostPlatform.system == "aarch64-darwin" then
(fetchurl {
url = "https://projects.laas.fr/tina/software/mlton-${version}-1.arm64-darwin-21.6-gmp-static.tgz";
sha256 = "1s61ayk3yj2xw8ilqk3fhb03x5x1wcakkmbhhvcsfb2hdw2c932x";
})
else
throw "Architecture not supported";
patches = [
(fetchpatch {
name = "remove-duplicate-if.patch";
url = "https://github.com/MLton/mlton/commit/22002cd0a53a1ab84491d74cb8dc6a4e50c1f7b7.patch";
decode = "sed -e 's|Makefile\\.binary|Makefile|g'";
hash = "sha256-Gtmc+OIh+m7ordSn74fpOKVDQDtYyLHe6Le2snNCBYQ=";
})
];
buildInputs = [
bash
gmp
];
nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux patchelf;
strictDeps = true;
buildPhase = ''
make update \
CC="$(type -p cc)" \
WITH_GMP_INC_DIR="${gmp.dev}/include" \
WITH_GMP_LIB_DIR="${gmp}/lib"
'';
installPhase = ''
make install PREFIX=$out
'';
postFixup =
lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf --set-interpreter ${dynamic-linker} $out/lib/mlton/mlton-compile
patchelf --set-rpath ${gmp}/lib $out/lib/mlton/mlton-compile
for e in mllex mlnlffigen mlprof mlyacc; do
patchelf --set-interpreter ${dynamic-linker} $out/bin/$e
patchelf --set-rpath ${gmp}/lib $out/bin/$e
done
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
install_name_tool -change \
/opt/local/lib/libgmp.10.dylib \
${gmp}/lib/libgmp.10.dylib \
$out/lib/mlton/mlton-compile
for e in mllex mlnlffigen mlprof mlyacc; do
install_name_tool -change \
/opt/local/lib/libgmp.10.dylib \
${gmp}/lib/libgmp.10.dylib \
$out/bin/$e
done
'';
meta = import ./meta.nix { inherit lib; };
}

View File

@@ -0,0 +1,30 @@
{ callPackage }:
rec {
mlton20130715 = callPackage ./20130715.nix { };
mlton20180207Binary = callPackage ./20180207-binary.nix { };
mlton20180207 = callPackage ./from-git-source.nix {
mltonBootstrap = mlton20180207Binary;
version = "20180207";
rev = "on-20180207-release";
sha256 = "00rdd2di5x1dzac64il9z05m3fdzicjd3226wwjyynv631jj3q2a";
};
mlton20210117Binary = callPackage ./20210117-binary.nix { };
mlton20210117 = callPackage ./from-git-source.nix {
mltonBootstrap = mlton20210117Binary;
version = "20210117";
rev = "on-20210117-release";
sha256 = "sha256-rqL8lnzVVR+5Hc7sWXK8dCXN92dU76qSoii3/4StODM=";
};
mltonHEAD = callPackage ./from-git-source.nix {
mltonBootstrap = mlton20210117Binary;
version = "HEAD";
rev = "875f7912a0b135a9a7e86a04ecac9cacf0bfe5e5";
sha256 = "sha256-/MIoVqqv8qrJPehU7VRFpXtAAo8UUzE3waEvB7WnS9A=";
};
}

View File

@@ -0,0 +1,50 @@
{
lib,
fetchgit,
gmp,
mltonBootstrap,
url ? "https://github.com/mlton/mlton",
rev,
sha256,
stdenv,
version,
which,
}:
stdenv.mkDerivation {
pname = "mlton";
inherit version;
src = fetchgit {
inherit url rev sha256;
};
nativeBuildInputs = [
which
mltonBootstrap
];
buildInputs = [ gmp ];
strictDeps = true;
# build fails otherwise
enableParallelBuilding = false;
preBuild = ''
find . -type f | grep -v -e '\.tgz''$' | xargs sed -i "s@/usr/bin/env bash@$(type -p bash)@"
sed -i "s|/tmp|$TMPDIR|" bin/regression
makeFlagsArray=(
MLTON_VERSION="${version} ${rev}"
CC="$(type -p cc)"
PREFIX="$out"
WITH_GMP_INC_DIR="${gmp.dev}/include"
WITH_GMP_LIB_DIR="${gmp}/lib"
)
'';
doCheck = true;
meta = import ./meta.nix { inherit lib; };
}

View File

@@ -0,0 +1,23 @@
{
lib,
}:
{
description = "Open-source, whole-program, optimizing Standard ML compiler";
longDescription = ''
MLton is an open source, whole-program optimizing compiler for the Standard ML programming language.
MLton aims to produce fast executables, and to encourage rapid prototyping and modular programming
by eliminating performance penalties often associated with the use of high-level language features.
MLton development began in 1997, and continues to this day with a growing worldwide community of
developers and users, who have helped to port MLton to a number of platforms.
Description taken from http://en.wikipedia.org/wiki/Mlton .
'';
homepage = "http://mlton.org/";
license = lib.licenses.smlnj;
platforms = [
"i686-linux"
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
}