Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

haskellPackages.mkDerivation: Remove Darwin dynamic libraries workaround #203963

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 0 additions & 31 deletions pkgs/development/haskell-modules/generic-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -375,37 +375,6 @@ stdenv.mkDerivation ({
fi
'' + ''
done
''
# only use the links hack if we're actually building dylibs. otherwise, the
# "dynamic-library-dirs" point to nonexistent paths, and the ln command becomes
# "ln -s $out/lib/links", which tries to recreate the links dir and fails
+ (optionalString (stdenv.isDarwin && (enableSharedLibraries || enableSharedExecutables)) ''
# Work around a limit in the macOS Sierra linker on the number of paths
# referenced by any one dynamic library:
#
# Create a local directory with symlinks of the *.dylib (macOS shared
# libraries) from all the dependencies.
local dynamicLinksDir="$out/lib/links"
mkdir -p $dynamicLinksDir

# Unprettify all package conf files before reading/writing them
for d in "$packageConfDir/"*; do
# gawk -i inplace seems to strip the last newline
gawk -f ${unprettyConf} "$d" > tmp
mv tmp "$d"
done

for d in $(grep '^dynamic-library-dirs:' "$packageConfDir"/* | cut -d' ' -f2- | tr ' ' '\n' | sort -u); do
for lib in "$d/"*.{dylib,so}; do
# Allow overwriting because C libs can be pulled in multiple times.
ln -sf "$lib" "$dynamicLinksDir"
done
done
# Edit the local package DB to reference the links directory.
for f in "$packageConfDir/"*.conf; do
sed -i "s,dynamic-library-dirs: .*,dynamic-library-dirs: $dynamicLinksDir," "$f"
done
'') + ''
${ghcCommand}-pkg --${packageDbFlag}="$packageConfDir" recache

runHook postSetupCompilerEnvironment
Expand Down