From 9f5cba0aaabc176bde6daf2b0079bc870f009615 Mon Sep 17 00:00:00 2001 From: Kira Bruneau Date: Mon, 9 Nov 2020 18:33:43 -0500 Subject: [PATCH] wine: add MinGW-w64 support --- pkgs/misc/emulators/wine/base.nix | 12 +++++++++--- pkgs/misc/emulators/wine/default.nix | 3 ++- pkgs/misc/emulators/wine/packages.nix | 5 ++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/pkgs/misc/emulators/wine/base.nix b/pkgs/misc/emulators/wine/base.nix index 025158b07173..9b228fba095d 100644 --- a/pkgs/misc/emulators/wine/base.nix +++ b/pkgs/misc/emulators/wine/base.nix @@ -1,5 +1,5 @@ { stdenv, lib, pkgArches, callPackage, - name, version, src, monos, geckos, platforms, + name, version, src, mingwGccs, monos, geckos, platforms, pkgconfig, fontforge, makeWrapper, flex, bison, supportFlags, buildScript ? null, configureFlags ? [] @@ -15,9 +15,13 @@ stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) { }) // rec { inherit name src configureFlags; + # Fixes "Compiler cannot create executables" building wineWow with mingwSupport + strictDeps = true; + nativeBuildInputs = [ pkgconfig fontforge makeWrapper flex bison - ]; + ] + ++ lib.optionals supportFlags.mingwSupport mingwGccs; buildInputs = toBuildInputs pkgArches (with supportFlags; (pkgs: [ pkgs.freetype ] @@ -92,6 +96,7 @@ stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) { # drive_c/windows/system32 will only contain a few files instead of # hundreds, there will be an error about winemenubuilder and MountMgr # on startup of Wine, and the Drives tab in winecfg will show an error. + # TODO: binutils 2.34 contains a fix for this bug, re-enable stripping once available. dontStrip = true; ## FIXME @@ -136,7 +141,8 @@ stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) { # https://bugs.winehq.org/show_bug.cgi?id=43530 # https://github.com/NixOS/nixpkgs/issues/31989 hardeningDisable = [ "bindnow" ] - ++ lib.optional (stdenv.hostPlatform.isDarwin) "fortify"; + ++ lib.optional (stdenv.hostPlatform.isDarwin) "fortify" + ++ lib.optional (supportFlags.mingwSupport) "format"; passthru = { inherit pkgArches; }; meta = { diff --git a/pkgs/misc/emulators/wine/default.nix b/pkgs/misc/emulators/wine/default.nix index 368e2845ca40..24f827b25ffe 100644 --- a/pkgs/misc/emulators/wine/default.nix +++ b/pkgs/misc/emulators/wine/default.nix @@ -44,6 +44,7 @@ sdlSupport ? false, faudioSupport ? false, vkd3dSupport ? false, + mingwSupport ? false, }: let wine-build = build: release: @@ -56,7 +57,7 @@ let wine-build = build: release: gsmSupport gphoto2Support ldapSupport fontconfigSupport alsaSupport pulseaudioSupport xineramaSupport gtkSupport openclSupport xmlSupport tlsSupport openglSupport gstreamerSupport udevSupport vulkanSupport sdlSupport faudioSupport - vkd3dSupport; + vkd3dSupport mingwSupport; }; }); diff --git a/pkgs/misc/emulators/wine/packages.nix b/pkgs/misc/emulators/wine/packages.nix index 3ea60e62c665..31d21058e3aa 100644 --- a/pkgs/misc/emulators/wine/packages.nix +++ b/pkgs/misc/emulators/wine/packages.nix @@ -1,4 +1,4 @@ -{ stdenv_32bit, lib, pkgs, pkgsi686Linux, callPackage, +{ stdenv_32bit, lib, pkgs, pkgsi686Linux, pkgsCross, callPackage, wineRelease ? "stable", supportFlags }: @@ -10,6 +10,7 @@ in with src; { inherit src version supportFlags; pkgArches = [ pkgsi686Linux ]; geckos = [ gecko32 ]; + mingwGccs = with pkgsCross; [ mingw32.buildPackages.gcc ]; monos = [ mono ]; platforms = [ "i686-linux" "x86_64-linux" ]; }; @@ -17,6 +18,7 @@ in with src; { name = "wine64-${version}"; inherit src version supportFlags; pkgArches = [ pkgs ]; + mingwGccs = with pkgsCross; [ mingwW64.buildPackages.gcc ]; geckos = [ gecko64 ]; monos = [ mono ]; configureFlags = [ "--enable-win64" ]; @@ -28,6 +30,7 @@ in with src; { stdenv = stdenv_32bit; pkgArches = [ pkgs pkgsi686Linux ]; geckos = [ gecko32 gecko64 ]; + mingwGccs = with pkgsCross; [ mingw32.buildPackages.gcc mingwW64.buildPackages.gcc ]; monos = [ mono ]; buildScript = ./builder-wow.sh; platforms = [ "x86_64-linux" ];