-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Feature/mingw fixes #43559
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
Feature/mingw fixes #43559
Changes from all commits
092369c
36f4832
e699a26
3192a9e
a8a7c55
3e4cd7f
a7f208f
8ffb78a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,8 @@ | |
| ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross" | ||
| }: | ||
|
|
||
| assert !enableIntegerSimple -> gmp != null; | ||
|
|
||
| let | ||
| inherit (bootPkgs) ghc; | ||
|
|
||
|
|
@@ -46,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"} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is definitely a good change! This really confused me with cross-built always pulling in GMP but not ever using it (on android at least).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (might be worth backporting too)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes agreed heartily with both. Great change and please back-port! |
||
| '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' | ||
| Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"} | ||
| CrossCompilePrefix = ${targetPrefix} | ||
|
|
@@ -133,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" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can just be stdenv.lib.optional (!enableIntegerSimple) [
"--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" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,7 +112,7 @@ let | |
| main = defaultMain | ||
| ''; | ||
|
|
||
| hasActiveLibrary = isLibrary && (enableStaticLibraries || enableSharedLibraries || enableLibraryProfiling); | ||
| hasActiveLibrary = isLibrary && (enableStaticLibraries || enableSharedLibraries || enableLibraryProfiling || hostPlatform.isWindows); | ||
|
|
||
| # We cannot enable -j<n> parallelism for libraries because GHC is far more | ||
| # likely to generate a non-determistic library ID in that case. Further | ||
|
|
@@ -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" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems weird. Is this a windows things?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This and the following is @angerman's change to avoid making cc-wrapper and ld-wrapper inject flags. But please don't do this as part of this PR; even if we end up going this route it should be done separately. |
||
| (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}") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the purpose of this change? |
||
| (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}/ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dito. Why are you changing this? |
||
| continue | ||
| fi | ||
| ''; | ||
|
|
@@ -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" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ẁhy? |
||
| mkdir -p $dynamicLinksDir | ||
| for d in $(grep dynamic-library-dirs "$packageConfDir/"*|awk '{print $2}'|sort -u); do | ||
| ln -s "$d/"*.dylib $dynamicLinksDir | ||
|
|
@@ -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 | ||
| ''} | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
coreutilsfor the build platform, not host platform, so why disable it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ends up trying to build
coreutilsformingw32when cross compilinggcc.And
coreutilscan't be built onmingw32.