@@ -20,8 +20,6 @@
20, preHaddock ? component.preHaddock , postHaddock ? component.postHaddock
20, preHaddock ? component.preHaddock , postHaddock ? component.postHaddock
21, shellHook ? ""
21, shellHook ? ""
23−, doCheck ? component.doCheck || haskellLib.isTest componentId
24−, doCrossCheck ? component.doCrossCheck || false
25, dontPatchELF ? true
23, dontPatchELF ? true
26, dontStrip ? true
24, dontStrip ? true
@@ -128,13 +126,7 @@ let
129 exeExt = lib.optionalString stdenv.hostPlatform.isWindows ".exe";
127 exeExt = lib.optionalString stdenv.hostPlatform.isWindows ".exe";
130 testExecutable = "dist/build/${componentId.cname}/${componentId.cname}${exeExt}";
128 testExecutable = "dist/build/${componentId.cname}/${componentId.cname}${exeExt}";
131− # exe components are in /bin, but test and benchmarks are not. Perhaps to avoid
132− # them being from being added to the PATH when the all component added to an env.
133− # TODO revist this to find out why and document or maybe change this.
134− installedExeDir = if haskellLib.isTest componentId || haskellLib.isBenchmark componentId
137− installedExe = "${installedExeDir}/${componentId.cname}${exeExt}";
129+ installedExe = "bin/${componentId.cname}${exeExt}";
139in stdenv.lib.fix (drv:
131in stdenv.lib.fix (drv:
@@ -143,20 +135,20 @@ stdenv.mkDerivation ({
144 src = cleanSrc;
136 src = cleanSrc;
139+ doCrossCheck = false;
146− inherit doCheck doCrossCheck dontPatchELF dontStrip;
141+ inherit dontPatchELF dontStrip;
148 passthru = {
143 passthru = {
149 inherit (package) identifier;
144 inherit (package) identifier;
150 config = component;
145 config = component;
151− inherit configFiles executableToolDepends cleanSrc;
146+ inherit configFiles executableToolDepends cleanSrc installedExe;
152 env = shellWrappers;
147 env = shellWrappers;
154 # The directory containing the haddock documentation.
149 # The directory containing the haddock documentation.
155 # `null' if no haddock documentation was built.
150 # `null' if no haddock documentation was built.
156 haddockDir = if doHaddock' then "${docdir drv.doc}/html" else null;
151 haddockDir = if doHaddock' then "${docdir drv.doc}/html" else null;
157− run = runCommand (fullName + "-run") {} ''
158− ${toString component.testWrapper} ${drv}/${installedExe} | tee $out
@@ -217,13 +209,7 @@ stdenv.mkDerivation ({
217 runHook postBuild
209 runHook postBuild
220− checkPhase = ''
212+ checkPhase = "notice: Tests are only executed by building the .run sub-derivation of this component.";
223− ${toString component.testWrapper} ${testExecutable} ${lib.concatStringsSep " " component.testFlags}
228 haddockPhase = ''
214 haddockPhase = ''
229 runHook preHaddock
215 runHook preHaddock
@@ -281,25 +267,25 @@ stdenv.mkDerivation ({
283 ${(lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId || haskellLib.isAll componentId) ''
269 ${(lib.optionalString (haskellLib.isTest componentId || haskellLib.isBenchmark componentId || haskellLib.isAll componentId) ''
284− mkdir -p $out/${name}
270+ mkdir -p $out/bin
285 if [ -f ${testExecutable} ]; then
271 if [ -f ${testExecutable} ]; then
286− cp ${testExecutable} $out/${name}/
272+ cp ${testExecutable} $out/bin/
289 # In case `setup copy` did not creat this
275 # In case `setup copy` did not creat this
290 + (lib.optionalString enableSeparateDataOutput "mkdir -p $data")
276 + (lib.optionalString enableSeparateDataOutput "mkdir -p $data")
291 + (lib.optionalString (stdenv.hostPlatform.isWindows && (haskellLib.mayHaveExecutable componentId)) ''
277 + (lib.optionalString (stdenv.hostPlatform.isWindows && (haskellLib.mayHaveExecutable componentId)) ''
292− echo "Copying libffi and gmp .dlls ..."
278+ echo "Symlink libffi and gmp .dlls ..."
293 for p in ${lib.concatStringsSep " " [ libffi gmp ]}; do
279 for p in ${lib.concatStringsSep " " [ libffi gmp ]}; do
294− find "$p" -iname '*.dll' -exec cp {} $out/${installedExeDir} \;
280+ find "$p" -iname '*.dll' -exec ln -s {} $out/bin \;
296− # copy all .dlls into the local directory.
282+ # symlink all .dlls into the local directory.
297 # we ask ghc-pkg for *all* dynamic-library-dirs and then iterate over the unique set
283 # we ask ghc-pkg for *all* dynamic-library-dirs and then iterate over the unique set
298− # to copy over dlls as needed.
284+ # to symlink over dlls as needed.
299− echo "Copying library dependencies..."
285+ echo "Symlink library dependencies..."
300 for libdir in $(x86_64-pc-mingw32-ghc-pkg --package-db=$packageConfDir field "*" dynamic-library-dirs --simple-output|xargs|sed 's/ /\n/g'|sort -u); do
286 for libdir in $(x86_64-pc-mingw32-ghc-pkg --package-db=$packageConfDir field "*" dynamic-library-dirs --simple-output|xargs|sed 's/ /\n/g'|sort -u); do
301 if [ -d "$libdir" ]; then
287 if [ -d "$libdir" ]; then
302− find "$libdir" -iname '*.dll' -exec cp {} $out/${installedExeDir} \;
288+ find "$libdir" -iname '*.dll' -exec ln -s {} $out/bin \;
@@ -316,7 +302,7 @@ stdenv.mkDerivation ({
316// lib.optionalAttrs (patches != []) { patches = map (p: if builtins.isFunction p then p { inherit (package.identifier) version; inherit revision; } else p) patches; }
302// lib.optionalAttrs (patches != []) { patches = map (p: if builtins.isFunction p then p { inherit (package.identifier) version; inherit revision; } else p) patches; }
317// haskellLib.optionalHooks {
303// haskellLib.optionalHooks {
318 inherit preUnpack postUnpack preConfigure postConfigure
304 inherit preUnpack postUnpack preConfigure postConfigure
319− preBuild postBuild preCheck postCheck
305+ preBuild postBuild
320 preInstall postInstall preHaddock postHaddock;
306 preInstall postInstall preHaddock postHaddock;
322// lib.optionalAttrs (stdenv.buildPlatform.libc == "glibc"){ LOCALE_ARCHIVE = "${buildPackages.glibcLocales}/lib/locale/locale-archive"; }
308// lib.optionalAttrs (stdenv.buildPlatform.libc == "glibc"){ LOCALE_ARCHIVE = "${buildPackages.glibcLocales}/lib/locale/locale-archive"; }