···90 ++ lib.optionals tlsSupport [ pkgs.openssl pkgs.gnutls ]
91 ++ lib.optionals (openglSupport && !stdenv.isDarwin) [ pkgs.libGLU pkgs.libGL pkgs.mesa.osmesa pkgs.libdrm ]
92 ++ lib.optionals stdenv.isDarwin (with pkgs.buildPackages.darwin.apple_sdk.frameworks; [
93- CoreServices Foundation ForceFeedback AppKit OpenGL IOKit DiskArbitration Security
94 ApplicationServices AudioToolbox CoreAudio AudioUnit CoreMIDI OpenCL Cocoa Carbon
95 ])
96 ++ lib.optionals (stdenv.isLinux && !waylandSupport) (with pkgs.xorg; [
···103104 patches = [ ]
105 ++ lib.optionals stdenv.isDarwin [
106- # Wine requires `MTLDevice.registryID` for `winemac.drv`, but that property is not available
107- # in the 10.12 SDK (current SDK on x86_64-darwin). Work around that by using selector syntax.
0000108 ./darwin-metal-compat.patch
109 # Wine requires `qos.h`, which is not included by default on the 10.12 SDK in nixpkgs.
110 ./darwin-qos.patch
111 ]
112 ++ patches';
000000000113114 configureFlags = prevConfigFlags
115 ++ lib.optionals supportFlags.waylandSupport [ "--with-wayland" ]
···192 ];
193 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";
194 platforms = if supportFlags.waylandSupport then (lib.remove "x86_64-darwin" prevPlatforms) else prevPlatforms;
195- maintainers = with lib.maintainers; [ avnik raskin bendlas jmc-figueira ];
196 inherit mainProgram;
197 };
198})
···90 ++ lib.optionals tlsSupport [ pkgs.openssl pkgs.gnutls ]
91 ++ lib.optionals (openglSupport && !stdenv.isDarwin) [ pkgs.libGLU pkgs.libGL pkgs.mesa.osmesa pkgs.libdrm ]
92 ++ lib.optionals stdenv.isDarwin (with pkgs.buildPackages.darwin.apple_sdk.frameworks; [
93+ CoreServices Foundation ForceFeedback AppKit OpenGL IOKit DiskArbitration PCSC Security
94 ApplicationServices AudioToolbox CoreAudio AudioUnit CoreMIDI OpenCL Cocoa Carbon
95 ])
96 ++ lib.optionals (stdenv.isLinux && !waylandSupport) (with pkgs.xorg; [
···103104 patches = [ ]
105 ++ lib.optionals stdenv.isDarwin [
106+ # Wine uses `MTLDevice.registryID` in `winemac.drv`, but that property is not available in
107+ # the 10.12 SDK (current SDK on x86_64-darwin). That can be worked around by using selector
108+ # syntax. As of Wine 8.12, the logic has changed and uses selector syntax, but it still
109+ # uses property syntax in one place. The first patch is necessary only with older
110+ # versions of Wine. The second is needed on all versions of Wine.
111+ (lib.optional (lib.versionOlder version "8.12") ./darwin-metal-compat-pre8.12.patch)
112 ./darwin-metal-compat.patch
113 # Wine requires `qos.h`, which is not included by default on the 10.12 SDK in nixpkgs.
114 ./darwin-qos.patch
115 ]
116 ++ patches';
117+118+ # Because the 10.12 SDK doesn’t define `registryID`, clang assumes the undefined selector returns
119+ # `id`, which is a pointer. This causes implicit pointer to integer errors in clang 15+.
120+ # The following post-processing step adds a cast to `uint64_t` before the selector invocation to
121+ # silence these errors.
122+ postPatch = lib.optionalString stdenv.isDarwin ''
123+ sed -e 's|\(\[[A-Za-z_][][A-Za-z_0-9]* registryID\]\)|(uint64_t)\1|' \
124+ -i dlls/winemac.drv/cocoa_display.m
125+ '';
126127 configureFlags = prevConfigFlags
128 ++ lib.optionals supportFlags.waylandSupport [ "--with-wayland" ]
···205 ];
206 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";
207 platforms = if supportFlags.waylandSupport then (lib.remove "x86_64-darwin" prevPlatforms) else prevPlatforms;
208+ maintainers = with lib.maintainers; [ avnik raskin bendlas jmc-figueira reckenrode ];
209 inherit mainProgram;
210 };
211})
···1+diff --git a/dlls/winemac.drv/cocoa_display.m b/dlls/winemac.drv/cocoa_display.m
2+--- a/dlls/winemac.drv/cocoa_display.m
3++++ b/dlls/winemac.drv/cocoa_display.m
4+@@ -289,7 +289,7 @@ static int macdrv_get_gpus_from_metal(struct macdrv_gpu** new_gpus, int* count)
5+ * the primary GPU because we need to hide the integrated GPU for an automatic graphic switching pair to avoid apps
6+ * using the integrated GPU. This is the behavior of Windows on a Mac. */
7+ primary_device = [MTLCreateSystemDefaultDevice() autorelease];
8+- if (macdrv_get_gpu_info_from_registry_id(&primary_gpu, primary_device.registryID))
9++ if (macdrv_get_gpu_info_from_registry_id(&primary_gpu, [primary_device registryID]))
10+ goto done;
11+12+ /* Hide the integrated GPU if the system default device is a dedicated GPU */
13+@@ -301,7 +301,7 @@ static int macdrv_get_gpus_from_metal(struct macdrv_gpu** new_gpus, int* count)
14+15+ for (i = 0; i < devices.count; i++)
16+ {
17+- if (macdrv_get_gpu_info_from_registry_id(&gpus[gpu_count], devices[i].registryID))
18++ if (macdrv_get_gpu_info_from_registry_id(&gpus[gpu_count], [devices[i] registryID]))
19+ goto done;
20+21+ if (hide_integrated && devices[i].isLowPower)
22+
···1diff --git a/dlls/winemac.drv/cocoa_display.m b/dlls/winemac.drv/cocoa_display.m
2-index f64a6c0f6ad..6da0391e3fa 100644
3--- a/dlls/winemac.drv/cocoa_display.m
4+++ b/dlls/winemac.drv/cocoa_display.m
5-@@ -289,7 +289,7 @@ static int macdrv_get_gpus_from_metal(struct macdrv_gpu** new_gpus, int* count)
6- * the primary GPU because we need to hide the integrated GPU for an automatic graphic switching pair to avoid apps
7- * using the integrated GPU. This is the behavior of Windows on a Mac. */
8- primary_device = [MTLCreateSystemDefaultDevice() autorelease];
9-- if (macdrv_get_gpu_info_from_registry_id(&primary_gpu, primary_device.registryID))
10-+ if (macdrv_get_gpu_info_from_registry_id(&primary_gpu, (uint64_t)[primary_device registryID]))
11- goto done;
12-13- /* Hide the integrated GPU if the system default device is a dedicated GPU */
14-@@ -301,7 +301,7 @@ static int macdrv_get_gpus_from_metal(struct macdrv_gpu** new_gpus, int* count)
15-16- for (i = 0; i < devices.count; i++)
17- {
18-- if (macdrv_get_gpu_info_from_registry_id(&gpus[gpu_count], devices[i].registryID))
19-+ if (macdrv_get_gpu_info_from_registry_id(&gpus[gpu_count], (uint64_t)[devices[i] registryID]))
20- goto done;
21-22- if (hide_integrated && devices[i].isLowPower)
23@@ -354,7 +354,7 @@ static int macdrv_get_gpu_info_from_display_id_using_metal(struct macdrv_gpu* gp
2425 device = [CGDirectDisplayCopyCurrentMetalDevice(display_id) autorelease];
26 if (device && [device respondsToSelector:@selector(registryID)])
27- ret = macdrv_get_gpu_info_from_registry_id(gpu, device.registryID);
28-+ ret = macdrv_get_gpu_info_from_registry_id(gpu, (uint64_t)[device registryID]);
2930 done:
31 [pool release];
···1diff --git a/dlls/winemac.drv/cocoa_display.m b/dlls/winemac.drv/cocoa_display.m
02--- a/dlls/winemac.drv/cocoa_display.m
3+++ b/dlls/winemac.drv/cocoa_display.m
0000000000000000004@@ -354,7 +354,7 @@ static int macdrv_get_gpu_info_from_display_id_using_metal(struct macdrv_gpu* gp
56 device = [CGDirectDisplayCopyCurrentMetalDevice(display_id) autorelease];
7 if (device && [device respondsToSelector:@selector(registryID)])
8- ret = macdrv_get_gpu_info_from_registry_id(gpu, device.registryID);
9++ ret = macdrv_get_gpu_info_from_registry_id(gpu, [device registryID]);
1011 done:
12 [pool release];