git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #153932 from jmc-figueira/wine-wayland

wine-wayland: added derivation for building the experimental Wayland driver for Wine

commit16f77e1412139f8e871c8d54ab43c071caeb20bd authorBernardo Meurer <bernardo@meurer.org> dateMon 24 Jan 2022, 20:52 (5 years ago) parent3a879829a7bb1e
9 files changed+64−17
nixos/tests/wine.nix+1−1 pkgs/misc/emulators/wine/base.nix+26−10 pkgs/misc/emulators/wine/builder-wow.sh+3−2 pkgs/misc/emulators/wine/default.nix+3−2 pkgs/misc/emulators/wine/packages.nix+7−1 pkgs/misc/emulators/wine/sources.nix+15 pkgs/top-level/aliases.nix+1 pkgs/top-level/all-packages.nix+5−1 pkgs/top-level/wine-packages.nix+3
nixos/tests/wine.nix+1−1
@@ -35,7 +35,7 @@ let
3535 };
3636 };
3737
38− variants = [ "base" "full" "minimal" "staging" "unstable" ];
38+ variants = [ "base" "full" "minimal" "staging" "unstable" "wayland" ];
3939
4040in listToAttrs (map (makeWineTest "winePackages" [ hello32 ]) variants
4141 ++ map (makeWineTest "wineWowPackages" [ hello32 hello64 ]) variants)
pkgs/misc/emulators/wine/base.nix+26−10
@@ -4,19 +4,24 @@
44 autoconf, hexdump, perl, nixosTests,
55 supportFlags,
66 patches,
7+ vkd3dArches,
78 buildScript ? null, configureFlags ? []
89}:
910
1011with import ./util.nix { inherit lib; };
1112
1213let
13− vkd3d = callPackage ./vkd3d.nix {};
1414 patches' = patches;
15+ prevName = name;
16+ prevPlatforms = platforms;
17+ prevConfigFlags = configureFlags;
1518in
1619stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) {
1720 builder = buildScript;
1821}) // rec {
19− inherit name src configureFlags;
22+ inherit src;
23+
24+ name = if supportFlags.waylandSupport then "${prevName}-wayland" else prevName;
2025
2126 # Fixes "Compiler cannot create executables" building wineWow with mingwSupport
2227 strictDeps = true;
@@ -36,7 +41,7 @@ stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) {
3641 ++ lib.optionals supportFlags.mingwSupport mingwGccs;
3742
3843 buildInputs = toBuildInputs pkgArches (with supportFlags; (pkgs:
39− [ pkgs.freetype pkgs.perl pkgs.xorg.libX11 ]
44+ [ pkgs.freetype pkgs.perl ]
4045 ++ lib.optional stdenv.isLinux pkgs.libcap
4146 ++ lib.optional pngSupport pkgs.libpng
4247 ++ lib.optional jpegSupport pkgs.libjpeg
@@ -61,12 +66,12 @@ stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) {
6166 ++ lib.optional fontconfigSupport pkgs.fontconfig
6267 ++ lib.optional alsaSupport pkgs.alsa-lib
6368 ++ lib.optional pulseaudioSupport pkgs.libpulseaudio
64− ++ lib.optional xineramaSupport pkgs.xorg.libXinerama
69+ ++ lib.optional (xineramaSupport && !waylandSupport) pkgs.xorg.libXinerama
6570 ++ lib.optional udevSupport pkgs.udev
6671 ++ lib.optional vulkanSupport pkgs.vulkan-loader
6772 ++ lib.optional sdlSupport pkgs.SDL2
6873 ++ lib.optional faudioSupport pkgs.faudio
69− ++ lib.optional vkd3dSupport vkd3d
74+ ++ vkd3dArches
7075 ++ lib.optionals gstreamerSupport (with pkgs.gst_all_1;
7176 [ gstreamer gst-plugins-base gst-plugins-good gst-plugins-ugly gst-libav
7277 (gst-plugins-bad.override { enableZbar = false; }) ])
@@ -79,12 +84,20 @@ stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) {
7984 CoreServices Foundation ForceFeedback AppKit OpenGL IOKit DiskArbitration Security
8085 ApplicationServices AudioToolbox CoreAudio AudioUnit CoreMIDI OpenAL OpenCL Cocoa Carbon
8186 ])
82− ++ lib.optionals stdenv.isLinux (with pkgs.xorg; [
83− libXi libXcursor libXrandr libXrender libXxf86vm libXcomposite libXext
87+ ++ lib.optionals (stdenv.isLinux && !waylandSupport) (with pkgs.xorg; [
88+ libX11 libXi libXcursor libXrandr libXrender libXxf86vm libXcomposite libXext
89+ ])
90+ ++ lib.optionals waylandSupport (with pkgs; [
91+ wayland libxkbcommon wayland-protocols wayland.dev libxkbcommon.dev
8492 ])));
8593
8694 patches = [ ] ++ patches';
8795
96+ configureFlags = prevConfigFlags
97+ ++ lib.optionals supportFlags.waylandSupport [ "--with-wayland" ]
98+ ++ lib.optionals supportFlags.vulkanSupport [ "--with-vulkan" ]
99+ ++ lib.optionals supportFlags.vkd3dSupport [ "--with-vkd3d" ];
100+
88101 # Wine locates a lot of libraries dynamically through dlopen(). Add
89102 # them to the RPATH so that the user doesn't have to set them in
90103 # LD_LIBRARY_PATH.
@@ -93,6 +106,8 @@ stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) {
93106 # libpulsecommon.so is linked but not found otherwise
94107 ++ lib.optionals supportFlags.pulseaudioSupport (map (x: "${lib.getLib x}/lib/pulseaudio")
95108 (toBuildInputs pkgArches (pkgs: [ pkgs.libpulseaudio ])))
109+ ++ lib.optionals supportFlags.waylandSupport (map (x: "${lib.getLib x}/share/wayland-protocols")
110+ (toBuildInputs pkgArches (pkgs: [ pkgs.wayland-protocols ])))
96111 ));
97112
98113 # Don't shrink the ELF RPATHs in order to keep the extra RPATH
@@ -149,11 +164,12 @@ stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) {
149164 tests = { inherit (nixosTests) wine; };
150165 };
151166 meta = {
152− inherit version platforms;
167+ inherit version;
153168 homepage = "https://www.winehq.org/";
154169 license = with lib.licenses; [ lgpl21Plus ];
155− description = "An Open Source implementation of the Windows API on top of X, OpenGL, and Unix";
156− maintainers = with lib.maintainers; [ avnik raskin bendlas ];
170+ description = if supportFlags.waylandSupport then "An Open Source implementation of the Windows API on top of OpenGL and Unix (with experimental Wayland support)" else "An Open Source implementation of the Windows API on top of X, OpenGL, and Unix";
171+ platforms = if supportFlags.waylandSupport then (lib.remove "x86_64-darwin" prevPlatforms) else prevPlatforms;
172+ maintainers = with lib.maintainers; [ avnik raskin bendlas jmc-figueira ];
157173 mainProgram = "wine";
158174 };
159175})
pkgs/misc/emulators/wine/builder-wow.sh+3−2
@@ -1,6 +1,7 @@
11## build described at http://wiki.winehq.org/Wine64
22
33source $stdenv/setup
4+preFlags="${configureFlags}"
45
56unpackPhase
67cd $TMP/$sourceRoot
@@ -11,14 +12,14 @@ mkdir -p $TMP/wine-wow $TMP/wine64
1112
1213cd $TMP/wine64
1314sourceRoot=`pwd`
14−configureFlags="--enable-win64"
15+configureFlags="${preFlags} --enable-win64"
1516configurePhase
1617buildPhase
1718# checkPhase
1819
1920cd $TMP/wine-wow
2021sourceRoot=`pwd`
21−configureFlags="--with-wine64=../wine64"
22+configureFlags="${preFlags} --with-wine64=../wine64"
2223configurePhase
2324buildPhase
2425# checkPhase
pkgs/misc/emulators/wine/default.nix+3−2
@@ -1,7 +1,7 @@
11## Configuration:
22# Control you default wine config in nixpkgs-config:
33# wine = {
4−# release = "stable"; # "stable", "unstable", "staging"
4+# release = "stable"; # "stable", "unstable", "staging", "wayland"
55# build = "wineWow"; # "wine32", "wine64", "wineWow"
66# };
77# Make additional configurations on demand:
@@ -45,6 +45,7 @@
4545 faudioSupport ? false,
4646 vkd3dSupport ? false,
4747 mingwSupport ? wineRelease != "stable",
48+ waylandSupport ? wineRelease == "wayland",
4849 embedInstallers ? false # The Mono and Gecko MSI installers
4950}:
5051
@@ -58,7 +59,7 @@ let wine-build = build: release:
5859 gsmSupport gphoto2Support ldapSupport fontconfigSupport alsaSupport
5960 pulseaudioSupport xineramaSupport gtkSupport openclSupport xmlSupport tlsSupport
6061 openglSupport gstreamerSupport udevSupport vulkanSupport sdlSupport faudioSupport
61− vkd3dSupport mingwSupport embedInstallers;
62+ vkd3dSupport mingwSupport waylandSupport embedInstallers;
6263 };
6364 });
6465
pkgs/misc/emulators/wine/packages.nix+7−1
@@ -3,12 +3,16 @@
33 supportFlags
44}:
55
6−let src = lib.getAttr wineRelease (callPackage ./sources.nix {});
6+let
7+ src = lib.getAttr wineRelease (callPackage ./sources.nix {});
8+ vkd3d = pkgs.callPackage ./vkd3d.nix {};
9+ vkd3d_i686 = pkgsi686Linux.callPackage ./vkd3d.nix {};
710in with src; {
811 wine32 = pkgsi686Linux.callPackage ./base.nix {
912 name = "wine-${version}";
1013 inherit src version supportFlags patches;
1114 pkgArches = [ pkgsi686Linux ];
15+ vkd3dArches = lib.optionals supportFlags.vkd3dSupport [ vkd3d_i686 ];
1216 geckos = [ gecko32 ];
1317 mingwGccs = with pkgsCross; [ mingw32.buildPackages.gcc ];
1418 monos = [ mono ];
@@ -18,6 +22,7 @@ in with src; {
1822 name = "wine64-${version}";
1923 inherit src version supportFlags patches;
2024 pkgArches = [ pkgs ];
25+ vkd3dArches = lib.optionals supportFlags.vkd3dSupport [ vkd3d ];
2126 mingwGccs = with pkgsCross; [ mingwW64.buildPackages.gcc ];
2227 geckos = [ gecko64 ];
2328 monos = [ mono ];
@@ -29,6 +34,7 @@ in with src; {
2934 inherit src version supportFlags patches;
3035 stdenv = stdenv_32bit;
3136 pkgArches = [ pkgs pkgsi686Linux ];
37+ vkd3dArches = lib.optionals supportFlags.vkd3dSupport [ vkd3d vkd3d_i686 ];
3238 geckos = [ gecko32 gecko64 ];
3339 mingwGccs = with pkgsCross; [ mingw32.buildPackages.gcc mingwW64.buildPackages.gcc ];
3440 monos = [ mono ];
pkgs/misc/emulators/wine/sources.nix+15
@@ -10,6 +10,8 @@ let fetchurl = args@{url, sha256, ...}:
1010 pkgs.fetchurl { inherit url sha256; } // args;
1111 fetchFromGitHub = args@{owner, repo, rev, sha256, ...}:
1212 pkgs.fetchFromGitHub { inherit owner repo rev sha256; } // args;
13+ fetchFromGitLab = args@{domain, owner, repo, rev, sha256, ...}:
14+ pkgs.fetchFromGitLab { inherit domain owner repo rev sha256; } // args;
1315in rec {
1416
1517 stable = fetchurl rec {
@@ -55,6 +57,19 @@ in rec {
5557 disabledPatchsets = [ ];
5658 };
5759
60+ wayland = fetchFromGitLab rec {
61+ version = "7.0-rc2";
62+ sha256 = "sha256-FU9L8cyIIfFQ+8f/AUg7IT+RxTpyNTuSfL0zBnur0SA=";
63+ domain = "gitlab.collabora.com";
64+ owner = "alf";
65+ repo = "wine";
66+ rev = "95f0154c96a4b7d81e783ee5ba2f5d9cc7cda351";
67+
68+ inherit (unstable) gecko32 gecko64;
69+
70+ inherit (unstable) mono;
71+ };
72+
5873 winetricks = fetchFromGitHub rec {
5974 # https://github.com/Winetricks/winetricks/releases
6075 version = "20210825";
pkgs/top-level/aliases.nix+1
@@ -1085,6 +1085,7 @@ mapAliases ({
10851085 weechat-matrix-bridge = weechatScripts.weechat-matrix-bridge; # added 2018-09-06
10861086 wicd = throw "wicd has been removed as it is abandoned."; # added 2021-09-11
10871087 wineStaging = wine-staging; # added 2018-01-08
1088+ wineWayland = wine-wayland;
10881089 winusb = woeusb; # added 2017-12-22
10891090 winswitch = throw "winswitch has been removed from nixpkgs."; # added 2019-12-10
10901091 wireshark-gtk = throw "wireshark-gtk is not supported anymore. Use wireshark-qt or wireshark-cli instead."; # added 2019-11-18
pkgs/top-level/all-packages.nix+5−1
@@ -33887,7 +33887,7 @@ with pkgs;
3388733887 inherit wineBuild;
3388833888
3388933889 inherit (callPackage ./wine-packages.nix {})
33890− minimal base full stable stableFull unstable unstableFull staging stagingFull fonts;
33890+ minimal base full stable stableFull unstable unstableFull staging stagingFull wayland waylandFull fonts;
3389133891 });
3389233892
3389333893 winePackages = recurseIntoAttrs (winePackagesFor (config.wine.build or "wine32"));
@@ -33901,6 +33901,10 @@ with pkgs;
3390133901 wineRelease = "staging";
3390233902 });
3390333903
33904+ wine-wayland = lowPrio (winePackages.full.override {
33905+ wineRelease = "wayland";
33906+ });
33907+
3390433908 winetricks = callPackage ../misc/emulators/wine/winetricks.nix {
3390533909 inherit (gnome) zenity;
3390633910 };
pkgs/top-level/wine-packages.nix+3
@@ -58,4 +58,7 @@ rec {
5858
5959 staging = base.override { wineRelease = "staging"; };
6060 stagingFull = full.override { wineRelease = "staging"; };
61+
62+ wayland = base.override { wineRelease = "wayland"; };
63+ waylandFull = full.override { wineRelease = "wayland"; };
6164}