3
0
Fork 0
forked from mirrors/nixpkgs

mlton: darwin bootstrap fixes

Allow mlton to compile in a more barren sandbox. The bootstrapping
binaries for darwin have dynamic linking dependencies outside of the nix
store. This patch shifts them to point to the appropriate library within
the nix store.
This commit is contained in:
Anthony Cowley 2016-09-24 15:28:10 -04:00
parent 0593ad2b16
commit 3835a1917f

View file

@ -63,6 +63,8 @@ stdenv.mkDerivation rec {
substituteInPlace $(pwd)/../${usr_prefix}/bin/mlton --replace '/${usr_prefix}/lib/mlton' $(pwd)/../${usr_prefix}/lib/mlton
'' + stdenv.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
'' + stdenv.lib.optionalString stdenv.isDarwin ''
sed -i 's|XCFLAGS += -I/usr/local/include -I/sw/include -I/opt/local/include||' ./runtime/Makefile
'';
preBuild = ''
@ -83,6 +85,11 @@ stdenv.mkDerivation rec {
for e in mllex mlyacc ; do
patchelf --set-interpreter ${dynamic_linker} $(pwd)/../${usr_prefix}/bin/$e
done
'' + stdenv.lib.optionalString stdenv.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;