Merge pull request #35981 from elts/fix/ccl

ccl: add MacOS version
This commit is contained in:
Michael Raskin 2018-02-28 10:01:05 +00:00 committed by GitHub
commit eb77c1b294
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@
let let
options = rec { options = rec {
/* TODO: there are also MacOS, FreeBSD and Windows versions */ /* TODO: there are also FreeBSD and Windows versions */
x86_64-linux = { x86_64-linux = {
arch = "linuxx86"; arch = "linuxx86";
sha256 = "0hs1f3z7crgzvinpj990kv9gvbsipxvcvwbmk54n51nasvc5025q"; sha256 = "0hs1f3z7crgzvinpj990kv9gvbsipxvcvwbmk54n51nasvc5025q";
@ -21,6 +21,18 @@ let
runtime = "armcl"; runtime = "armcl";
kernel = "linuxarm"; 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; armv6l-linux = armv7l-linux;
}; };
cfg = options.${stdenv.system}; cfg = options.${stdenv.system};
@ -37,12 +49,22 @@ stdenv.mkDerivation rec {
sha256 = cfg.sha256; sha256 = cfg.sha256;
}; };
buildInputs = [ gcc glibc m4 ]; buildInputs = if stdenv.isDarwin then [ m4 ] else [ gcc glibc m4 ];
CCL_RUNTIME = cfg.runtime; CCL_RUNTIME = cfg.runtime;
CCL_KERNEL = cfg.kernel; 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 \ substituteInPlace lisp-kernel/${CCL_KERNEL}/Makefile \
--replace "/bin/rm" "${coreutils}/bin/rm" \ --replace "/bin/rm" "${coreutils}/bin/rm" \
--replace "/bin/echo" "${coreutils}/bin/echo" --replace "/bin/echo" "${coreutils}/bin/echo"
@ -63,7 +85,7 @@ stdenv.mkDerivation rec {
cp -r . "$out/share/ccl-installation" cp -r . "$out/share/ccl-installation"
mkdir -p "$out/bin" 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}" chmod a+x "$out"/bin/"${CCL_RUNTIME}"
ln -s "$out"/bin/"${CCL_RUNTIME}" "$out"/bin/ccl ln -s "$out"/bin/"${CCL_RUNTIME}" "$out"/bin/ccl
''; '';