From 092369cd6672e11e7a1f78b286264da8d3763fe2 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Sun, 15 Jul 2018 16:24:47 +0800 Subject: [PATCH 1/8] [cc-wrapper] no coreutils on with mingw --- pkgs/build-support/cc-wrapper/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index aca96f58ed97d..ed8d41be806a6 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -40,7 +40,7 @@ let libc_lib = if libc == null then null else getLib libc; cc_solib = getLib cc; # The wrapper scripts use 'cat' and 'grep', so we may need coreutils. - coreutils_bin = if nativeTools then "" else getBin coreutils; + coreutils_bin = if (nativeTools || targetPlatform.isWindows) then "" else getBin coreutils; default_cxx_stdlib_compile = optionalString (targetPlatform.isLinux && !(cc.isGNU or false) && !nativeTools && cc ? gcc) "-isystem $(echo -n ${cc.gcc}/include/c++/*) -isystem $(echo -n ${cc.gcc}/include/c++/*)/$(${cc.gcc}/bin/gcc -dumpmachine)"; From 36f4832ab5a5782af0aa6c36e7188954339f2182 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Sun, 15 Jul 2018 16:25:09 +0800 Subject: [PATCH 2/8] [ghc] assert gmp --- pkgs/development/compilers/ghc/8.4.3.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/compilers/ghc/8.4.3.nix b/pkgs/development/compilers/ghc/8.4.3.nix index 0f5a43d57eda4..a372ef3adc0a2 100644 --- a/pkgs/development/compilers/ghc/8.4.3.nix +++ b/pkgs/development/compilers/ghc/8.4.3.nix @@ -32,6 +32,8 @@ ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross" }: +assert !enableIntegerSimple -> gmp != null; + let inherit (bootPkgs) ghc; From e699a26e7c65f5ae1f04950db41b4c9aefad63e1 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Sun, 15 Jul 2018 16:25:31 +0800 Subject: [PATCH 3/8] [ghc] proper handling of integer libraries --- pkgs/development/compilers/ghc/8.4.3.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/ghc/8.4.3.nix b/pkgs/development/compilers/ghc/8.4.3.nix index a372ef3adc0a2..fae5dfce1cf3c 100644 --- a/pkgs/development/compilers/ghc/8.4.3.nix +++ b/pkgs/development/compilers/ghc/8.4.3.nix @@ -48,8 +48,7 @@ let include mk/flavours/\$(BuildFlavour).mk endif DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} - '' + stdenv.lib.optionalString enableIntegerSimple '' - INTEGER_LIBRARY = integer-simple + INTEGER_LIBRARY = ${if enableIntegerSimple then "integer-simple" else "integer-gmp"} '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"} CrossCompilePrefix = ${targetPrefix} @@ -135,9 +134,11 @@ stdenv.mkDerivation (rec { configureFlags = [ "--datadir=$doc/share/doc/ghc" "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" - ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [ + ] ++ (if (targetPlatform == hostPlatform && !enableIntegerSimple) then [ "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib" - ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [ + ] else [ + "--with-gmp-includes=${targetPackages.gmp.dev}/include" "--with-gmp-libraries=${targetPackages.gmp.out}/lib" + ]) ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [ "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" From 3192a9eccc7af2c52cf367d93da987134edf934e Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Sun, 15 Jul 2018 16:26:18 +0800 Subject: [PATCH 4/8] [haskell/generic-builder] stop the `lib` madness --- pkgs/development/haskell-modules/generic-builder.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index d1304c7969499..eb392f83f5f22 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -138,12 +138,12 @@ let buildFlagsString = optionalString (buildFlags != []) (" " + concatStringsSep " " buildFlags); defaultConfigureFlags = [ - "--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid" + "--verbose" "--prefix=$out" "--libdir=\\$prefix/\\$compiler" "--libsubdir=\\$pkgid" (optionalString enableSeparateDataOutput "--datadir=$data/share/${ghc.name}") (optionalString enableSeparateDocOutput "--docdir=${docdir "$doc"}") "--with-gcc=$CC" # Clang won't work without that extra information. "--package-db=$packageConfDir" - (optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.name}/${pname}-${version}") + (optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/${ghc.name}/${pname}-${version}") (optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names") (optionalString enableParallelBuilding "--ghc-option=-j$NIX_BUILD_CORES") (optionalString useCpphs "--with-cpphs=${cpphs}/bin/cpphs --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp") @@ -209,8 +209,8 @@ let nativeGhcCommand = "${nativeGhc.targetPrefix}ghc"; buildPkgDb = ghcName: packageConfDir: '' - if [ -d "$p/lib/${ghcName}/package.conf.d" ]; then - cp -f "$p/lib/${ghcName}/package.conf.d/"*.conf ${packageConfDir}/ + if [ -d "$p/${ghcName}/package.conf.d" ]; then + cp -f "$p/${ghcName}/package.conf.d/"*.conf ${packageConfDir}/ continue fi ''; @@ -379,7 +379,7 @@ stdenv.mkDerivation ({ ${if !hasActiveLibrary then "${setupCommand} install" else '' ${setupCommand} copy - local packageConfDir="$out/lib/${ghc.name}/package.conf.d" + local packageConfDir="$out/${ghc.name}/package.conf.d" local packageConfFile="$packageConfDir/${pname}-${version}.conf" mkdir -p "$packageConfDir" ${setupCommand} register --gen-pkg-config=$packageConfFile @@ -404,7 +404,7 @@ stdenv.mkDerivation ({ ${optionalString doCoverage "mkdir -p $out/share && cp -r dist/hpc $out/share"} ${optionalString (enableSharedExecutables && isExecutable && !isGhcjs && stdenv.isDarwin && stdenv.lib.versionOlder ghc.version "7.10") '' for exe in "$out/bin/"* ; do - install_name_tool -add_rpath "$out/lib/ghc-${ghc.version}/${pname}-${version}" "$exe" + install_name_tool -add_rpath "$out/ghc-${ghc.version}/${pname}-${version}" "$exe" done ''} From a8a7c55b99518b3fdb5e1c170a0c37fdbf271b0c Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Sun, 15 Jul 2018 16:27:26 +0800 Subject: [PATCH 5/8] [haskell/generic-builder] windows always has an active library This commit is not really correct. The `hasActiveLibrary` check is wrong. We can have an active library even if we do not ask for a static lirbary or dynamic one; we can still have just a set of objet files and archives. --- pkgs/development/haskell-modules/generic-builder.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index eb392f83f5f22..4f247fdb7aee3 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -112,7 +112,7 @@ let main = defaultMain ''; - hasActiveLibrary = isLibrary && (enableStaticLibraries || enableSharedLibraries || enableLibraryProfiling); + hasActiveLibrary = isLibrary && (enableStaticLibraries || enableSharedLibraries || enableLibraryProfiling || hostPlatform.isWindows); # We cannot enable -j parallelism for libraries because GHC is far more # likely to generate a non-determistic library ID in that case. Further From 3e4cd7f6812a3a93ba7894811305e1293a716ba1 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Sun, 15 Jul 2018 16:27:44 +0800 Subject: [PATCH 6/8] [coreutils] assert not msvcrt. --- pkgs/tools/misc/coreutils/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/tools/misc/coreutils/default.nix b/pkgs/tools/misc/coreutils/default.nix index 589c58d0acc02..b13ba656a8a91 100644 --- a/pkgs/tools/misc/coreutils/default.nix +++ b/pkgs/tools/misc/coreutils/default.nix @@ -10,6 +10,7 @@ assert aclSupport -> acl != null; assert selinuxSupport -> libselinux != null && libsepol != null; +assert hostPlatform.libc != "msvcrt"; with lib; From a7f208fc124ff718335a32fb586daecfbac0f7c8 Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Mon, 16 Jul 2018 20:10:57 +0800 Subject: [PATCH 7/8] Update generic-builder.nix --- pkgs/development/haskell-modules/generic-builder.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 4f247fdb7aee3..e9d95d5e3f52c 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -294,14 +294,14 @@ stdenv.mkDerivation ({ '' # 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 + # "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" + local dynamicLinksDir="$out/lib-links" mkdir -p $dynamicLinksDir for d in $(grep dynamic-library-dirs "$packageConfDir/"*|awk '{print $2}'|sort -u); do ln -s "$d/"*.dylib $dynamicLinksDir From 8ffb78ab7c6f21ff0bf74dfbbe5031a3fd29ad7c Mon Sep 17 00:00:00 2001 From: Moritz Angermann Date: Mon, 16 Jul 2018 20:12:11 +0800 Subject: [PATCH 8/8] Update lib.nix --- pkgs/development/haskell-modules/lib.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/haskell-modules/lib.nix b/pkgs/development/haskell-modules/lib.nix index c9dc7254800e8..d5e36981ba352 100644 --- a/pkgs/development/haskell-modules/lib.nix +++ b/pkgs/development/haskell-modules/lib.nix @@ -234,7 +234,7 @@ rec { enableSharedExecutables = false; isLibrary = false; doHaddock = false; - postFixup = "rm -rf $out/lib $out/nix-support $out/share/doc"; + postFixup = "rm -rf $out/ghc* $out/nix-support $out/share/doc"; }); /* Build a source distribution tarball instead of using the source files