diff --git a/pkgs/development/compilers/ccl/default.nix b/pkgs/development/compilers/ccl/default.nix index 696728e6f32c..087f74700214 100644 --- a/pkgs/development/compilers/ccl/default.nix +++ b/pkgs/development/compilers/ccl/default.nix @@ -2,7 +2,7 @@ let options = rec { - /* TODO: there are also MacOS, FreeBSD and Windows versions */ + /* TODO: there are also FreeBSD and Windows versions */ x86_64-linux = { arch = "linuxx86"; sha256 = "0hs1f3z7crgzvinpj990kv9gvbsipxvcvwbmk54n51nasvc5025q"; @@ -21,6 +21,18 @@ let runtime = "armcl"; kernel = "linuxarm"; }; + x86_64-darwin = { + arch = "darwinx86"; + sha256 = "5adbea3d8b4a2e29af30d141f781c6613844f468c0ccfa11bae908c3e9641939"; + runtime = "dx86cl64"; + kernel = "darwinx8664"; + }; + i686-darwin = { + arch = "darwinx86"; + sha256 = x86_64-darwin.sha256; + runtime = "dx86cl"; + kernel = "darwinx8632"; + }; armv6l-linux = armv7l-linux; }; cfg = options.${stdenv.system}; @@ -37,12 +49,22 @@ stdenv.mkDerivation rec { sha256 = cfg.sha256; }; - buildInputs = [ gcc glibc m4 ]; + buildInputs = if stdenv.isDarwin then [ m4 ] else [ gcc glibc m4 ]; CCL_RUNTIME = cfg.runtime; CCL_KERNEL = cfg.kernel; - postPatch = '' + postPatch = if stdenv.isDarwin then '' + substituteInPlace lisp-kernel/${CCL_KERNEL}/Makefile \ + --replace "M4 = gm4" "M4 = m4" \ + --replace "dtrace" "/usr/sbin/dtrace" \ + --replace "mig" "/usr/bin/mig" \ + --replace "/bin/rm" "${coreutils}/bin/rm" \ + --replace "/bin/echo" "${coreutils}/bin/echo" + + substituteInPlace lisp-kernel/m4macros.m4 \ + --replace "/bin/pwd" "${coreutils}/bin/pwd" + '' else '' substituteInPlace lisp-kernel/${CCL_KERNEL}/Makefile \ --replace "/bin/rm" "${coreutils}/bin/rm" \ --replace "/bin/echo" "${coreutils}/bin/echo" @@ -63,7 +85,7 @@ stdenv.mkDerivation rec { cp -r . "$out/share/ccl-installation" mkdir -p "$out/bin" - echo -e '#!/bin/sh\n'"$out/share/ccl-installation/${CCL_RUNTIME}"' "$@"\n' > "$out"/bin/"${CCL_RUNTIME}" + echo -e '#!${stdenv.shell}\n'"$out/share/ccl-installation/${CCL_RUNTIME}"' "$@"\n' > "$out"/bin/"${CCL_RUNTIME}" chmod a+x "$out"/bin/"${CCL_RUNTIME}" ln -s "$out"/bin/"${CCL_RUNTIME}" "$out"/bin/ccl '';