|
34 | 34 | # Start with a ghc and remove all of the package directories
|
35 | 35 | + ''
|
36 | 36 | mkdir -p $wrappedGhc/bin
|
37 |
| - ${lndir}/bin/lndir -silent ${ghc} $wrappedGhc |
| 37 | + ${lndir}/bin/lndir -silent $unwrappedGhc $wrappedGhc |
38 | 38 | rm -rf ${libDir}/*/
|
39 | 39 | ''
|
40 | 40 | # ... but retain the lib/ghc/bin directory. This contains `unlit' and friends.
|
41 | 41 | + ''
|
42 |
| - ln -s ${ghc}/lib/${ghcCommand}-${ghc.version}/bin ${libDir} |
| 42 | + ln -s $unwrappedGhc/lib/${ghcCommand}-${ghc.version}/bin ${libDir} |
43 | 43 | ''
|
44 | 44 | # ... and the ghcjs shim's if they are available ...
|
45 | 45 | + ''
|
46 |
| - if [ -d ${ghc}/lib/${ghcCommand}-${ghc.version}/shims ]; then |
47 |
| - ln -s ${ghc}/lib/${ghcCommand}-${ghc.version}/shims ${libDir} |
| 46 | + if [ -d $unwrappedGhc/lib/${ghcCommand}-${ghc.version}/shims ]; then |
| 47 | + ln -s $unwrappedGhc/lib/${ghcCommand}-${ghc.version}/shims ${libDir} |
48 | 48 | fi
|
49 | 49 | ''
|
50 | 50 | # ... and node modules ...
|
51 | 51 | + ''
|
52 |
| - if [ -d ${ghc}/lib/${ghcCommand}-${ghc.version}/ghcjs-node ]; then |
53 |
| - ln -s ${ghc}/lib/${ghcCommand}-${ghc.version}/ghcjs-node ${libDir} |
| 52 | + if [ -d $unwrappedGhc/lib/${ghcCommand}-${ghc.version}/ghcjs-node ]; then |
| 53 | + ln -s $unwrappedGhc/lib/${ghcCommand}-${ghc.version}/ghcjs-node ${libDir} |
54 | 54 | fi
|
55 | 55 | ''
|
56 | 56 | # Replace the package database with the one from target package config.
|
|
69 | 69 | GHC_PLUGINS="["
|
70 | 70 | LIST_PREFIX=""
|
71 | 71 | ${builtins.concatStringsSep "\n" (map (plugin: ''
|
72 |
| - id=$(${ghc}/bin/ghc-pkg --package-db ${plugin.library}/package.conf.d field ${plugin.library.package.identifier.name} id --simple-output) |
73 |
| - lib_dir=$(${ghc}/bin/ghc-pkg --package-db ${plugin.library}/package.conf.d field ${plugin.library.package.identifier.name} dynamic-library-dirs --simple-output) |
74 |
| - lib_base=$(${ghc}/bin/ghc-pkg --package-db ${plugin.library}/package.conf.d field ${plugin.library.package.identifier.name} hs-libraries --simple-output) |
| 72 | + id=$($unwrappedGhc/bin/ghc-pkg --package-db ${plugin.library}/package.conf.d field ${plugin.library.package.identifier.name} id --simple-output) |
| 73 | + lib_dir=$($unwrappedGhc/bin/ghc-pkg --package-db ${plugin.library}/package.conf.d field ${plugin.library.package.identifier.name} dynamic-library-dirs --simple-output) |
| 74 | + lib_base=$($unwrappedGhc/bin/ghc-pkg --package-db ${plugin.library}/package.conf.d field ${plugin.library.package.identifier.name} hs-libraries --simple-output) |
75 | 75 | lib="$(echo ''${lib_dir}/lib''${lib_base}*)"
|
76 | 76 | GHC_PLUGINS="''${GHC_PLUGINS}''${LIST_PREFIX}(\"''${lib}\",\"''${id}\",\"${plugin.moduleName}\",["
|
77 | 77 | LIST_PREFIX=""
|
|
95 | 95 | # The NIX_ variables are used by the patched Paths_ghc module.
|
96 | 96 | + ''
|
97 | 97 | for prg in ${ghcCommand} ${ghcCommand}i ${ghcCommand}-${ghc.version} ${ghcCommand}i-${ghc.version}; do
|
98 |
| - if [[ -x "${ghc}/bin/$prg" ]]; then |
| 98 | + if [[ -x "$unwrappedGhc/bin/$prg" ]]; then |
99 | 99 | rm -f $wrappedGhc/bin/$prg
|
100 |
| - makeWrapper ${ghc}/bin/$prg $wrappedGhc/bin/$prg \ |
| 100 | + makeWrapper $unwrappedGhc/bin/$prg $wrappedGhc/bin/$prg \ |
101 | 101 | --add-flags '"-B$NIX_${ghcCommandCaps}_LIBDIR"' \
|
102 | 102 | --set "NIX_${ghcCommandCaps}" "$wrappedGhc/bin/${ghcCommand}" \
|
103 | 103 | --set "NIX_${ghcCommandCaps}PKG" "$wrappedGhc/bin/${ghcCommand}-pkg" \
|
|
108 | 108 | done
|
109 | 109 |
|
110 | 110 | for prg in "${targetPrefix}runghc" "${targetPrefix}runhaskell"; do
|
111 |
| - if [[ -x "${ghc}/bin/$prg" ]]; then |
| 111 | + if [[ -x "$unwrappedGhc/bin/$prg" ]]; then |
112 | 112 | rm -f $wrappedGhc/bin/$prg
|
113 |
| - makeWrapper ${ghc}/bin/$prg $wrappedGhc/bin/$prg \ |
| 113 | + makeWrapper $unwrappedGhc/bin/$prg $wrappedGhc/bin/$prg \ |
114 | 114 | --add-flags "-f $wrappedGhc/bin/${ghcCommand}" \
|
115 | 115 | --set "NIX_${ghcCommandCaps}" "$wrappedGhc/bin/${ghcCommand}" \
|
116 | 116 | --set "NIX_${ghcCommandCaps}PKG" "$wrappedGhc/bin/${ghcCommand}-pkg" \
|
|
135 | 135 | # --global-package-db flag.
|
136 | 136 | + ''
|
137 | 137 | for prg in ${ghcCommand}-pkg ${ghcCommand}-pkg-${ghc.version}; do
|
138 |
| - if [[ -x "${ghc}/bin/$prg" ]]; then |
| 138 | + if [[ -x "$unwrappedGhc/bin/$prg" ]]; then |
139 | 139 | rm -f $wrappedGhc/bin/$prg
|
140 |
| - makeWrapper ${ghc}/bin/$prg $wrappedGhc/bin/$prg --add-flags "--global-package-db=$wrappedGhc/${packageCfgDir}" |
| 140 | + makeWrapper $unwrappedGhc/bin/$prg $wrappedGhc/bin/$prg --add-flags "--global-package-db=$wrappedGhc/${packageCfgDir}" |
141 | 141 | fi
|
142 | 142 | done
|
143 | 143 |
|
|
0 commit comments