diff --git a/pkgs/development/compilers/smlnj/default.nix b/pkgs/development/compilers/smlnj/default.nix index a2b8d4f63b9..e4d4dc1ae10 100644 --- a/pkgs/development/compilers/smlnj/default.nix +++ b/pkgs/development/compilers/smlnj/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl }: +{ stdenv, fetchurl, darwin }: let version = "110.78"; baseurl = "http://smlnj.cs.uchicago.edu/dist/working/${version}"; @@ -34,7 +34,15 @@ in stdenv.mkDerivation { patchPhase = '' sed -i '/PATH=/d' config/_arch-n-opsys base/runtime/config/gen-posix-names.sh echo SRCARCHIVEURL="file:/$TMP" > config/srcarchiveurl - ''; + '' + stdenv.lib.optionalString stdenv.isDarwin (with darwin; '' + sed -i '/^[[:space:]]*\*x86-darwin\*)$/,/^[[:space:]]*\*) ;;/ c\ +\ \*x86-darwin\*)\ +\ INCLFILE=${osx_sdk}/Developer/SDKs/${osx_sdk.name}/usr/include/unistd.h\ +\ ;;\ +\ \*) ;; +' base/runtime/config/gen-posix-names.sh + sed -i 's|^AS =\([[:space:]]*\)/usr/bin/as|AS =\1as|' base/runtime/objs/mk.x86-darwin + ''); unpackPhase = '' for s in $sources; do @@ -64,7 +72,7 @@ in stdenv.mkDerivation { description = "Standard ML of New Jersey, a compiler"; homepage = http://smlnj.org; license = licenses.bsd3; - platforms = [ "i686-linux" ]; + platforms = [ "i686-linux" ] ++ platforms.darwin; maintainers = with maintainers; [ thoughtpolice ]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4cdb857db6b..94b281c8211 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4723,7 +4723,9 @@ let sdcc = callPackage ../development/compilers/sdcc { }; smlnjBootstrap = callPackage ../development/compilers/smlnj/bootstrap.nix { }; - smlnj = callPackage_i686 ../development/compilers/smlnj { }; + smlnj = if stdenv.isDarwin + then callPackage ../development/compilers/smlnj { } + else callPackage_i686 ../development/compilers/smlnj { }; sqldeveloper = callPackage ../development/tools/database/sqldeveloper { };