From 9fdc5e10eea0b7f36d7712ae64a943787a807e00 Mon Sep 17 00:00:00 2001 From: Simon Chatterjee Date: Sat, 26 Jun 2021 14:52:53 +0100 Subject: [PATCH 1/2] smlnj: fix x86_64-darwin build --- pkgs/development/compilers/smlnj/default.nix | 14 ++++++++------ pkgs/top-level/all-packages.nix | 4 +++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pkgs/development/compilers/smlnj/default.nix b/pkgs/development/compilers/smlnj/default.nix index 3e987e8ccdaf..d6d50f0303f6 100644 --- a/pkgs/development/compilers/smlnj/default.nix +++ b/pkgs/development/compilers/smlnj/default.nix @@ -1,11 +1,9 @@ -{ lib, stdenv, fetchurl }: +{ lib, stdenv, fetchurl, Libsystem }: let version = "110.95"; baseurl = "http://smlnj.cs.uchicago.edu/dist/working/${version}"; - isArch64 = stdenv.system == "x86_64-linux"; - - arch = if isArch64 + arch = if stdenv.is64bit then "64" else "32"; @@ -14,7 +12,7 @@ let boot64 = { url = "${baseurl}/boot.amd64-unix.tgz"; sha256 = "1zn96a83kb6bn6228yfjsvb58m2qxw9k4j3qz0p9c8za479w4ch6"; }; - bootBinary = if isArch64 + bootBinary = if stdenv.is64bit then boot64 else boot32; @@ -53,6 +51,10 @@ in stdenv.mkDerivation { sed -i '/PATH=/d' config/_arch-n-opsys base/runtime/config/gen-posix-names.sh echo SRCARCHIVEURL="file:/$TMP" > config/srcarchiveurl patch --verbose config/_heap2exec ${./heap2exec.diff} + '' + lib.optionalString stdenv.isDarwin '' + # Locate standard headers like + substituteInPlace base/runtime/config/gen-posix-names.sh \ + --replace "\$SDK_PATH/usr" "${Libsystem}" ''; unpackPhase = '' @@ -83,7 +85,7 @@ in stdenv.mkDerivation { description = "Standard ML of New Jersey, a compiler"; homepage = "http://smlnj.org"; license = licenses.bsd3; - platforms = [ "x86_64-linux" "i686-linux" ]; + platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" ]; maintainers = with maintainers; [ thoughtpolice ]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c829a3210ebf..cc045d7d474d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12056,7 +12056,9 @@ in shmig = callPackage ../development/tools/database/shmig { }; smlnjBootstrap = callPackage ../development/compilers/smlnj/bootstrap.nix { }; - smlnj = callPackage ../development/compilers/smlnj { }; + smlnj = callPackage ../development/compilers/smlnj { + inherit (darwin) Libsystem; + }; smlpkg = callPackage ../tools/package-management/smlpkg { }; From 4a4fc6c9c91b895f39c0b402426751f2174b43d9 Mon Sep 17 00:00:00 2001 From: Simon Chatterjee Date: Sat, 26 Jun 2021 23:05:58 +0100 Subject: [PATCH 2/2] smlnjBootstrap: move dependents over to regular smlnj smlnjBootstrap seems to exist as a workaround for a failing x86_64-darwin build of regular smlnj. Now this is fixed, the workaround can be removed. (aarch64-darwin is being actively worked on by the smlnj project, and currently is supported by neither derivation.) --- .../development/compilers/smlnj/bootstrap.nix | 4 ++++ pkgs/top-level/all-packages.nix | 19 ++++--------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/pkgs/development/compilers/smlnj/bootstrap.nix b/pkgs/development/compilers/smlnj/bootstrap.nix index 91eb9fc84172..aacebd48e9e3 100644 --- a/pkgs/development/compilers/smlnj/bootstrap.nix +++ b/pkgs/development/compilers/smlnj/bootstrap.nix @@ -1,3 +1,7 @@ +# This derivation should be redundant, now that regular smlnj works on Darwin, +# and is preserved only for pre-existing direct usage. New use cases should +# just use the regular smlnj derivation. + { lib, stdenv, fetchurl, cpio, rsync, xar, makeWrapper }: stdenv.mkDerivation rec { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cc045d7d474d..0718e299a7bc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12055,6 +12055,7 @@ in shmig = callPackage ../development/tools/database/shmig { }; + # smlnjBootstrap should be redundant, now that smlnj works on Darwin natively smlnjBootstrap = callPackage ../development/compilers/smlnj/bootstrap.nix { }; smlnj = callPackage ../development/compilers/smlnj { inherit (darwin) Libsystem; @@ -30058,11 +30059,7 @@ in iprover = callPackage ../applications/science/logic/iprover { }; - jonprl = callPackage ../applications/science/logic/jonprl { - smlnj = if stdenv.isDarwin - then smlnjBootstrap - else smlnj; - }; + jonprl = callPackage ../applications/science/logic/jonprl { }; key = callPackage ../applications/science/logic/key { }; @@ -30121,19 +30118,11 @@ in tptp = callPackage ../applications/science/logic/tptp {}; - celf = callPackage ../applications/science/logic/celf { - smlnj = if stdenv.isDarwin - then smlnjBootstrap - else smlnj; - }; + celf = callPackage ../applications/science/logic/celf { }; fast-downward = callPackage ../applications/science/logic/fast-downward { }; - twelf = callPackage ../applications/science/logic/twelf { - smlnj = if stdenv.isDarwin - then smlnjBootstrap - else smlnj; - }; + twelf = callPackage ../applications/science/logic/twelf { }; verifast = callPackage ../applications/science/logic/verifast {};