From 0e0894c37d398c9c0fe8bf52815c7cef127ac583 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Tue, 16 Oct 2018 21:48:43 -0500 Subject: [PATCH 01/17] lib/systems: add uname attrs --- lib/systems/default.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 5eacc9eb23e..6c6ce5c6ef6 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -46,6 +46,24 @@ rec { # Misc boolean options useAndroidPrebuilt = false; useiOSPrebuilt = false; + + # Output from uname + uname = { + # uname -s + system = if final.isLinux then "Linux" + else if final.isDarwin then "Darwin" + else if final.isWindows then "Windows" + else if final.isFreeBSD then "FreeBSD" + else if final.isNetBSD then "NetBSD" + else if final.isOpenBSD then "OpenBSD" + else null; + + # uname -p + processor = final.parsed.cpu.name; + + # uname -r + release = null; + }; } // mapAttrs (n: v: v final.parsed) inspect.predicates // args; in assert final.useAndroidPrebuilt -> final.isAndroid; From b3041b44552f50109760e7fa41a16636e4b4d5c0 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Tue, 16 Oct 2018 21:50:37 -0500 Subject: [PATCH 02/17] make-derivation: set CMAKE_SYSTEM_* when cross compiling Uses uname data to find what to set these variables: - CMAKE_SYSTEM_NAME - CMAKE_SYSTEM_PROCESSOR - CMAKE_SYSTEM_VERSION - CMAKE_HOST_SYSTEM_NAME - CMAKE_HOST_SYSTEM_PROCESSOR - CMAKE_HOST_SYSTEM_VERSION --- pkgs/stdenv/generic/make-derivation.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 2db40fc43e3..e06faed30a1 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -41,6 +41,7 @@ rec { # Configure Phase , configureFlags ? [] + , cmakeFlags ? [] , # Target is not included by default because most programs don't care. # Including it then would cause needless mass rebuilds. # @@ -225,6 +226,17 @@ rec { inherit doCheck doInstallCheck; inherit outputs; + } // lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) { + cmakeFlags = + (/**/ if lib.isString cmakeFlags then [cmakeFlags] + else if cmakeFlags == null then [] + else cmakeFlags) + ++ lib.optional (stdenv.hostPlatform.uname.system != null) "-DCMAKE_SYSTEM_NAME=${stdenv.hostPlatform.uname.system}" + ++ lib.optional (stdenv.hostPlatform.uname.processor != null) "-DCMAKE_SYSTEM_PROCESSOR=${stdenv.hostPlatform.uname.processor}" + ++ lib.optional (stdenv.hostPlatform.uname.release != null) "-DCMAKE_SYSTEM_VERSION=${stdenv.hostPlatform.release}" + ++ lib.optional (stdenv.buildPlatform.uname.system != null) "-DCMAKE_HOST_SYSTEM_NAME=${stdenv.buildPlatform.uname.system}" + ++ lib.optional (stdenv.buildPlatform.uname.processor != null) "-DCMAKE_HOST_SYSTEM_PROCESSOR=${stdenv.buildPlatform.uname.processor}" + ++ lib.optional (stdenv.buildPlatform.uname.release != null) "-DCMAKE_HOST_SYSTEM_VERSION=${stdenv.buildPlatform.uname.release}"; } // lib.optionalAttrs (attrs.enableParallelBuilding or false) { enableParallelChecking = attrs.enableParallelChecking or true; } // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != []) { From 0397453f1a8145d68e9627ad7f2e39d57732c651 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Tue, 16 Oct 2018 21:51:48 -0500 Subject: [PATCH 03/17] boost: remove broken patch the boost url is broken - remove for now --- pkgs/development/libraries/boost/generic.nix | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix index 1ab0718e796..609e240e0c2 100644 --- a/pkgs/development/libraries/boost/generic.nix +++ b/pkgs/development/libraries/boost/generic.nix @@ -101,21 +101,15 @@ stdenv.mkDerivation { inherit src; - patchFlags = optionalString (stdenv.hostPlatform.libc == "msvcrt") "-p0"; patches = patches - ++ optional stdenv.isDarwin ./darwin-no-system-python.patch - ++ optional (stdenv.hostPlatform.libc == "msvcrt") (fetchurl { - url = "https://svn.boost.org/trac/boost/raw-attachment/tickaet/7262/" - + "boost-mingw.patch"; - sha256 = "0s32kwll66k50w6r5np1y5g907b7lcpsjhfgr7rsw7q5syhzddyj"; - }); + ++ optional stdenv.isDarwin ./darwin-no-system-python.patch; meta = { homepage = http://boost.org/; description = "Collection of C++ libraries"; license = stdenv.lib.licenses.boost; - platforms = (if versionOlder version "1.59" then remove "aarch64-linux" else id) platforms.unix; + platforms = (if versionOlder version "1.59" then remove "aarch64-linux" else id) platforms.all; maintainers = with maintainers; [ peti wkennington ]; }; From 51e5f8af42cd51bcf3cb5c86796bca4c5af02365 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Tue, 16 Oct 2018 21:52:38 -0500 Subject: [PATCH 04/17] =?UTF-8?q?treewide:=20don=E2=80=99t=20set=20CMAKE?= =?UTF-8?q?=5FSYSTEM=5FNAME?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkgs/development/libraries/msgpack/generic.nix | 2 -- pkgs/development/libraries/nlohmann_json/default.nix | 2 -- pkgs/tools/compression/brotli/default.nix | 4 ---- pkgs/tools/text/html-tidy/default.nix | 3 --- 4 files changed, 11 deletions(-) diff --git a/pkgs/development/libraries/msgpack/generic.nix b/pkgs/development/libraries/msgpack/generic.nix index 306becf0c18..de277329961 100644 --- a/pkgs/development/libraries/msgpack/generic.nix +++ b/pkgs/development/libraries/msgpack/generic.nix @@ -15,8 +15,6 @@ stdenv.mkDerivation rec { cmakeFlags = [] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "-DMSGPACK_BUILD_EXAMPLES=OFF" - ++ stdenv.lib.optional (stdenv.hostPlatform.libc == "msvcrt") - "-DCMAKE_SYSTEM_NAME=Windows" ; meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/nlohmann_json/default.nix b/pkgs/development/libraries/nlohmann_json/default.nix index ffb735e725a..25d4386cec2 100644 --- a/pkgs/development/libraries/nlohmann_json/default.nix +++ b/pkgs/development/libraries/nlohmann_json/default.nix @@ -18,8 +18,6 @@ stdenv.mkDerivation rec { cmakeFlags = [ "-DBuildTests=${if doCheck then "ON" else "OFF"}" - ] ++ stdenv.lib.optionals (stdenv.hostPlatform.libc == "msvcrt") [ - "-DCMAKE_SYSTEM_NAME=Windows" ]; doCheck = stdenv.hostPlatform == stdenv.buildPlatform; diff --git a/pkgs/tools/compression/brotli/default.nix b/pkgs/tools/compression/brotli/default.nix index 754c0e58156..3b4d5519028 100644 --- a/pkgs/tools/compression/brotli/default.nix +++ b/pkgs/tools/compression/brotli/default.nix @@ -15,9 +15,6 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ]; - cmakeFlags = stdenv.lib.optional - (stdenv.hostPlatform.libc == "msvcrt") "-DCMAKE_SYSTEM_NAME=Windows"; - outputs = [ "out" "dev" "lib" ]; doCheck = true; @@ -59,4 +56,3 @@ stdenv.mkDerivation rec { platforms = platforms.all; }; } - diff --git a/pkgs/tools/text/html-tidy/default.nix b/pkgs/tools/text/html-tidy/default.nix index 51ce4baa0be..fcdba6cbba4 100644 --- a/pkgs/tools/text/html-tidy/default.nix +++ b/pkgs/tools/text/html-tidy/default.nix @@ -13,9 +13,6 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake libxslt/*manpage*/ ]; - cmakeFlags = stdenv.lib.optional - (stdenv.hostPlatform.libc or null == "msvcrt") "-DCMAKE_SYSTEM_NAME=Windows"; - # ATM bin/tidy is statically linked, as upstream provides no other option yet. # https://github.com/htacg/tidy-html5/issues/326#issuecomment-160322107 From 8652631b138b7cfd1f25a6e72a6e971dc232290a Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Tue, 16 Oct 2018 21:56:58 -0500 Subject: [PATCH 05/17] systems/doubles.nix: add mingw doubles this makes it easier to show what supports windows vs. unix. --- lib/systems/doubles.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index a00165db171..3d45935bc07 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -15,6 +15,8 @@ let "x86_64-cygwin" "x86_64-darwin" "x86_64-freebsd" "x86_64-linux" "x86_64-netbsd" "x86_64-openbsd" "x86_64-solaris" + + "x86_64-mingw32" "i686-mingw32" ]; allParsed = map parse.mkSystemFromString all; @@ -43,6 +45,7 @@ in rec { netbsd = filterDoubles predicates.isNetBSD; openbsd = filterDoubles predicates.isOpenBSD; unix = filterDoubles predicates.isUnix; + windows = filterDoubles predicates.isWindows; mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" "powerpc64le-linux"]; } From b4917105425e0927a12fca794290308b4caa9d0f Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Tue, 16 Oct 2018 21:57:53 -0500 Subject: [PATCH 06/17] sqlite: supports windows --- pkgs/development/libraries/sqlite/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/sqlite/default.nix b/pkgs/development/libraries/sqlite/default.nix index 166ea39493b..92574091558 100644 --- a/pkgs/development/libraries/sqlite/default.nix +++ b/pkgs/development/libraries/sqlite/default.nix @@ -79,6 +79,6 @@ stdenv.mkDerivation rec { homepage = http://www.sqlite.org/; license = licenses.publicDomain; maintainers = with maintainers; [ eelco np ]; - platforms = platforms.unix; + platforms = platforms.unix ++ platforms.windows; }; } From 007faf02cadc9c88b1c04bbe1efaa601fa3a061b Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Tue, 16 Oct 2018 22:03:09 -0500 Subject: [PATCH 07/17] boost: use correct platform MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "platforms.all" could include any possible os (even a machine with no OS at all!). We can’t possible hope to support all of that, so need to be more specific. --- pkgs/development/libraries/boost/generic.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix index 609e240e0c2..35703c282af 100644 --- a/pkgs/development/libraries/boost/generic.nix +++ b/pkgs/development/libraries/boost/generic.nix @@ -109,7 +109,7 @@ stdenv.mkDerivation { description = "Collection of C++ libraries"; license = stdenv.lib.licenses.boost; - platforms = (if versionOlder version "1.59" then remove "aarch64-linux" else id) platforms.all; + platforms = (if versionOlder version "1.59" then remove "aarch64-linux" else id) (platforms.unix ++ platforms.windows); maintainers = with maintainers; [ peti wkennington ]; }; From a5de0ca963288ea3b227f28c9b4522f342e9faeb Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Tue, 16 Oct 2018 23:19:34 -0500 Subject: [PATCH 08/17] treewide: preserve hashes avoid mass rebuild from the last commits --- pkgs/development/libraries/boost/generic.nix | 2 ++ pkgs/tools/compression/brotli/default.nix | 2 ++ pkgs/tools/text/html-tidy/default.nix | 2 ++ 3 files changed, 6 insertions(+) diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix index 35703c282af..bb8dff83d32 100644 --- a/pkgs/development/libraries/boost/generic.nix +++ b/pkgs/development/libraries/boost/generic.nix @@ -101,6 +101,8 @@ stdenv.mkDerivation { inherit src; + patchFlags = ""; + patches = patches ++ optional stdenv.isDarwin ./darwin-no-system-python.patch; diff --git a/pkgs/tools/compression/brotli/default.nix b/pkgs/tools/compression/brotli/default.nix index 3b4d5519028..7047eeeefa6 100644 --- a/pkgs/tools/compression/brotli/default.nix +++ b/pkgs/tools/compression/brotli/default.nix @@ -15,6 +15,8 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ]; + cmakeFlags = []; + outputs = [ "out" "dev" "lib" ]; doCheck = true; diff --git a/pkgs/tools/text/html-tidy/default.nix b/pkgs/tools/text/html-tidy/default.nix index fcdba6cbba4..1974c0aa4f3 100644 --- a/pkgs/tools/text/html-tidy/default.nix +++ b/pkgs/tools/text/html-tidy/default.nix @@ -13,6 +13,8 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake libxslt/*manpage*/ ]; + cmakeFlags = []; + # ATM bin/tidy is statically linked, as upstream provides no other option yet. # https://github.com/htacg/tidy-html5/issues/326#issuecomment-160322107 From 845a364564b2829b3813d5887b85cf98049f4f72 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 17 Oct 2018 12:43:07 -0500 Subject: [PATCH 09/17] zlib: skip configure in windows configure spits out an error when running on windows --- pkgs/development/libraries/zlib/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix index d348f877f72..fe1c275aeda 100644 --- a/pkgs/development/libraries/zlib/default.nix +++ b/pkgs/development/libraries/zlib/default.nix @@ -82,4 +82,6 @@ stdenv.mkDerivation (rec { preConfigure = '' export CHOST=${stdenv.hostPlatform.config} ''; +} // stdenv.lib.optionalAttrs (stdenv.hostPlatform.libc == "msvcrt") { + configurePhase = ":"; }) From b7e17a2efd26f653b8b2a1097d86931d15407689 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 17 Oct 2018 12:43:37 -0500 Subject: [PATCH 10/17] c-ares: disable shared, enable static only static will build for me --- pkgs/development/libraries/c-ares/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/c-ares/default.nix b/pkgs/development/libraries/c-ares/default.nix index 1835356e627..099d02c8263 100644 --- a/pkgs/development/libraries/c-ares/default.nix +++ b/pkgs/development/libraries/c-ares/default.nix @@ -9,6 +9,8 @@ stdenv.mkDerivation rec { sha256 = "0vnwmbvymw677k780kpb6sb8i3szdp89rzy8mz1fwg1657yw3ls5"; }; + configureFlags = if stdenv.hostPlatform.isWindows then [ "--disable-shared" "--enable-static" ] else null; + # ares_android.h header is missing # see issue https://github.com/c-ares/c-ares/issues/216 postPatch = if stdenv.hostPlatform.isAndroid then '' From a7c8e30782ee6b6dd35bc63350b4d55dc589fbc3 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 17 Oct 2018 12:44:23 -0500 Subject: [PATCH 11/17] nghttp2: make app optional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit windows just needs the libraries & the app won’t build --- pkgs/development/libraries/nghttp2/default.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/nghttp2/default.nix b/pkgs/development/libraries/nghttp2/default.nix index 68bffd4032d..471684ea7dd 100644 --- a/pkgs/development/libraries/nghttp2/default.nix +++ b/pkgs/development/libraries/nghttp2/default.nix @@ -6,6 +6,7 @@ , enableAsioLib ? false, boost ? null , enableGetAssets ? false, libxml2 ? null , enableJemalloc ? false, jemalloc ? null +, enableApp ? !stdenv.hostPlatform.isWindows }: assert enableHpack -> jansson != null; @@ -35,8 +36,12 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - configureFlags = [ "--with-spdylay=no" "--disable-examples" "--disable-python-bindings" "--enable-app" ] - ++ optional enableAsioLib "--enable-asio-lib --with-boost-libdir=${boost}/lib"; + configureFlags = [ + "--with-spdylay=no" + "--disable-examples" + "--disable-python-bindings" + (stdenv.lib.enableFeature enableApp "app") + ] ++ optional enableAsioLib "--enable-asio-lib --with-boost-libdir=${boost}/lib"; #doCheck = true; # requires CUnit ; currently failing at test_util_localtime_date in util_test.cc From c86495c79892782d97c913d8da460f32a793b4e9 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 17 Oct 2018 13:44:41 -0500 Subject: [PATCH 12/17] curl: disable gss on windows --- pkgs/top-level/all-packages.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index aaa8da74333..3b819911e7d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2075,7 +2075,7 @@ with pkgs; zlibSupport = true; sslSupport = zlibSupport; scpSupport = zlibSupport && !stdenv.isSunOS && !stdenv.isCygwin; - gssSupport = true; + gssSupport = !stdenv.hostPlatform.isWindows; }; curl = callPackage ../tools/networking/curl rec { @@ -2084,7 +2084,7 @@ with pkgs; zlibSupport = true; sslSupport = zlibSupport; scpSupport = zlibSupport && !stdenv.isSunOS && !stdenv.isCygwin; - gssSupport = true; + gssSupport = !stdenv.hostPlatform.isWindows; }; curl_unix_socket = callPackage ../tools/networking/curl-unix-socket rec { }; From e3de8a92325620e65039d98281047a83fa07c9dd Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 17 Oct 2018 14:10:49 -0500 Subject: [PATCH 13/17] boost: use correct c compiler for bootstrapping we need a c compiler that runs on the build machine for boost to work --- pkgs/development/libraries/boost/generic.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix index bb8dff83d32..c79b874ecb6 100644 --- a/pkgs/development/libraries/boost/generic.nix +++ b/pkgs/development/libraries/boost/generic.nix @@ -135,7 +135,8 @@ stdenv.mkDerivation { enableParallelBuilding = true; - nativeBuildInputs = [ which buildPackages.stdenv.cc ]; + nativeBuildInputs = [ which ]; + depsBuildBuild = [ buildPackages.stdenv.cc ]; buildInputs = [ expat zlib bzip2 libiconv ] ++ optional (stdenv.hostPlatform == stdenv.buildPlatform) icu ++ optional stdenv.isDarwin fixDarwinDylibNames From 45cc6e2a4286276387d0bcb768a1e45086719210 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 17 Oct 2018 14:43:49 -0500 Subject: [PATCH 14/17] lib/systems: use lookup for uname.system This is a little bit cleaner and avoids the if ... else if ... chain. --- lib/systems/default.nix | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 6c6ce5c6ef6..8f5ef44ae72 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -50,13 +50,14 @@ rec { # Output from uname uname = { # uname -s - system = if final.isLinux then "Linux" - else if final.isDarwin then "Darwin" - else if final.isWindows then "Windows" - else if final.isFreeBSD then "FreeBSD" - else if final.isNetBSD then "NetBSD" - else if final.isOpenBSD then "OpenBSD" - else null; + system = { + "linux" = "Linux"; + "windows" = "Windows"; + "darwin" = "Darwin"; + "netbsd" = "NetBSD"; + "freebsd" = "FreeBSD"; + "openbsd" = "OpenBSD"; + }.${final.parsed.kernel.name} or null; # uname -p processor = final.parsed.cpu.name; From 1660098d8425a190d42d5604afb54354625392b8 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 17 Oct 2018 14:44:35 -0500 Subject: [PATCH 15/17] curl: build statically on windows --- pkgs/tools/networking/curl/7_59.nix | 6 +++++- pkgs/tools/networking/curl/default.nix | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/networking/curl/7_59.nix b/pkgs/tools/networking/curl/7_59.nix index 0482bcf5262..508b357e3fd 100644 --- a/pkgs/tools/networking/curl/7_59.nix +++ b/pkgs/tools/networking/curl/7_59.nix @@ -77,7 +77,11 @@ stdenv.mkDerivation rec { ++ stdenv.lib.optional gssSupport "--with-gssapi=${kerberos.dev}" # For the 'urandom', maybe it should be a cross-system option ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) - "--with-random=/dev/urandom"; + "--with-random=/dev/urandom" + ++ stdenv.lib.optionals stdenv.hostPlatform.isWindows [ + "--disable-shared" + "--enable-static" + ]; CXX = "${stdenv.cc.targetPrefix}c++"; CXXCPP = "${stdenv.cc.targetPrefix}c++ -E"; diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix index dda97d34d86..4af8ff75e21 100644 --- a/pkgs/tools/networking/curl/default.nix +++ b/pkgs/tools/networking/curl/default.nix @@ -81,7 +81,11 @@ stdenv.mkDerivation rec { ++ stdenv.lib.optional gssSupport "--with-gssapi=${kerberos.dev}" # For the 'urandom', maybe it should be a cross-system option ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) - "--with-random=/dev/urandom"; + "--with-random=/dev/urandom" + ++ stdenv.lib.optionals stdenv.hostPlatform.isWindows [ + "--disable-shared" + "--enable-static" + ]; CXX = "${stdenv.cc.targetPrefix}c++"; CXXCPP = "${stdenv.cc.targetPrefix}c++ -E"; From c8040003f0a0bf2ac79adc3646669a3e718d4ec8 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 17 Oct 2018 17:03:00 -0500 Subject: [PATCH 16/17] Correctly set windows doubles mingw is the toolchain name but it is actually run on a window kernel --- lib/systems/doubles.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index 3d45935bc07..fddd5c85574 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -16,7 +16,7 @@ let "x86_64-cygwin" "x86_64-darwin" "x86_64-freebsd" "x86_64-linux" "x86_64-netbsd" "x86_64-openbsd" "x86_64-solaris" - "x86_64-mingw32" "i686-mingw32" + "x86_64-windows" "i686-windows" ]; allParsed = map parse.mkSystemFromString all; From 4a12a9321c567cae8e132c9d9b8b6255d52364d3 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Thu, 18 Oct 2018 14:12:49 -0500 Subject: [PATCH 17/17] tests/systems.nix: fix tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit these weren’t being run correctly --- lib/systems/doubles.nix | 2 +- lib/tests/systems.nix | 29 +++++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index fddd5c85574..58677c0bdd9 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -39,7 +39,7 @@ in rec { darwin = filterDoubles predicates.isDarwin; freebsd = filterDoubles predicates.isFreeBSD; # Should be better, but MinGW is unclear. - gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }); + gnu = filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnu; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabi; }) ++ filterDoubles (matchAttrs { kernel = parse.kernels.linux; abi = parse.abis.gnueabihf; }); illumos = filterDoubles predicates.isSunOS; linux = filterDoubles predicates.isLinux; netbsd = filterDoubles predicates.isNetBSD; diff --git a/lib/tests/systems.nix b/lib/tests/systems.nix index 91604280e4e..5e129365821 100644 --- a/lib/tests/systems.nix +++ b/lib/tests/systems.nix @@ -12,20 +12,21 @@ let expected = lib.sort lib.lessThan y; }; in with lib.systems.doubles; lib.runTests { - all = assertTrue (mseteq all (linux ++ darwin ++ cygwin ++ freebsd ++ openbsd ++ netbsd ++ illumos)); + testall = mseteq all (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ windows); - arm = assertTrue (mseteq arm [ "armv5tel-linux" "armv6l-linux" "armv7l-linux" ]); - i686 = assertTrue (mseteq i686 [ "i686-linux" "i686-freebsd" "i686-netbsd" "i686-openbsd" "i686-cygwin" ]); - mips = assertTrue (mseteq mips [ "mipsel-linux" ]); - x86_64 = assertTrue (mseteq x86_64 [ "x86_64-linux" "x86_64-darwin" "x86_64-freebsd" "x86_64-openbsd" "x86_64-netbsd" "x86_64-cygwin" "x86_64-solaris" ]); + testarm = mseteq arm [ "armv5tel-linux" "armv6l-linux" "armv7l-linux" ]; + testi686 = mseteq i686 [ "i686-linux" "i686-freebsd" "i686-netbsd" "i686-openbsd" "i686-cygwin" "i686-windows" ]; + testmips = mseteq mips [ "mipsel-linux" ]; + testx86_64 = mseteq x86_64 [ "x86_64-linux" "x86_64-darwin" "x86_64-freebsd" "x86_64-openbsd" "x86_64-netbsd" "x86_64-cygwin" "x86_64-solaris" "x86_64-windows" ]; - cygwin = assertTrue (mseteq cygwin [ "i686-cygwin" "x86_64-cygwin" ]); - darwin = assertTrue (mseteq darwin [ "x86_64-darwin" ]); - freebsd = assertTrue (mseteq freebsd [ "i686-freebsd" "x86_64-freebsd" ]); - gnu = assertTrue (mseteq gnu (linux /* ++ kfreebsd ++ ... */)); - illumos = assertTrue (mseteq illumos [ "x86_64-solaris" ]); - linux = assertTrue (mseteq linux [ "i686-linux" "x86_64-linux" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" "mipsel-linux" ]); - netbsd = assertTrue (mseteq netbsd [ "i686-netbsd" "x86_64-netbsd" ]); - openbsd = assertTrue (mseteq openbsd [ "i686-openbsd" "x86_64-openbsd" ]); - unix = assertTrue (mseteq unix (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos)); + testcygwin = mseteq cygwin [ "i686-cygwin" "x86_64-cygwin" ]; + testdarwin = mseteq darwin [ "x86_64-darwin" ]; + testfreebsd = mseteq freebsd [ "i686-freebsd" "x86_64-freebsd" ]; + testgnu = mseteq gnu (linux /* ++ kfreebsd ++ ... */); + testillumos = mseteq illumos [ "x86_64-solaris" ]; + testlinux = mseteq linux [ "i686-linux" "x86_64-linux" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" "mipsel-linux" ]; + testnetbsd = mseteq netbsd [ "i686-netbsd" "x86_64-netbsd" ]; + testopenbsd = mseteq openbsd [ "i686-openbsd" "x86_64-openbsd" ]; + testwindows = mseteq windows [ "i686-cygwin" "x86_64-cygwin" "i686-windows" "x86_64-windows" ]; + testunix = mseteq unix (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ cygwin); }