From 0a55054b160a05fd2e50ed96b1abd701c4e9b194 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Fri, 9 Dec 2022 16:23:25 +0000 Subject: [PATCH] xorg.xorgserver: 1.18.4 -> 1.20.14 on Darwin (still broken) Previously, Darwin was kept on 1.18 because more recent versions were broken, but now 1.18 is also broken on Darwin, so we might as well get rid of the special case and bring Darwin forward. With these changes, xQuartz builds on Darwin, but when run it will exit immediately. This makes Darwin use the same derivation as Linux by default, which will enable further cleanups. But as a result, we have to fix some Linuxisms. * Only add libdrm dependency on compatible platforms. * Add libepoxy dependency for all platforms. * Add bootstrap_cmds dependency on Darwin. * Disable glamor on Darwin. --- pkgs/servers/x11/xorg/overrides.nix | 28 +++++++++++++++------------- pkgs/top-level/all-packages.nix | 3 +-- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix index ddd5acad7a1a..17c53077b51f 100644 --- a/pkgs/servers/x11/xorg/overrides.nix +++ b/pkgs/servers/x11/xorg/overrides.nix @@ -729,12 +729,15 @@ self: super: attrs = if (abiCompat == null || lib.hasPrefix abiCompat version) then attrs_passed // { - buildInputs = attrs_passed.buildInputs ++ [ libdrm.dev ]; postPatch = '' - for i in dri3/*.c - do - sed -i -e "s|#include |#include |" $i - done - '';} + buildInputs = attrs_passed.buildInputs ++ + lib.optional (libdrm != null) libdrm.dev; + postPatch = '' + for i in dri3/*.c + do + sed -i -e "s|#include |#include |" $i + done + ''; + } else if (abiCompat == "1.18") then { name = "xorg-server-1.18.4"; builder = ./builder.sh; @@ -754,10 +757,8 @@ self: super: version = lib.getVersion attrs; commonBuildInputs = attrs.buildInputs ++ [ xtrans ]; commonPropagatedBuildInputs = [ - zlib libGL libGLU dbus - xorgproto - libXext pixman libXfont libxshmfence libunwind - libXfont2 + dbus libGL libGLU libXext libXfont libXfont2 libepoxy libunwind + libxshmfence pixman xorgproto zlib ]; # XQuartz requires two compilations: the first to get X / XQuartz, # and the second to get Xvfb, Xnest, etc. @@ -853,7 +854,7 @@ self: super: }) ]; buildInputs = commonBuildInputs ++ [ libdrm mesa ]; - propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ libpciaccess libepoxy ] ++ commonPropagatedBuildInputs ++ lib.optionals stdenv.isLinux [ + propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ libpciaccess ] ++ commonPropagatedBuildInputs ++ lib.optionals stdenv.isLinux [ udev ]; depsBuildBuild = [ buildPackages.stdenv.cc ]; @@ -887,7 +888,7 @@ self: super: ''; passthru.version = version; # needed by virtualbox guest additions } else { - nativeBuildInputs = attrs.nativeBuildInputs ++ [ autoreconfHook xorg.utilmacros xorg.fontutil ]; + nativeBuildInputs = attrs.nativeBuildInputs ++ [ autoreconfHook bootstrap_cmds xorg.utilmacros xorg.fontutil ]; buildInputs = commonBuildInputs ++ [ bootstrap_cmds automake autoconf Xplugin Carbon Cocoa @@ -923,6 +924,7 @@ self: super: configureFlags = [ # note: --enable-xquartz is auto "CPPFLAGS=-I${./darwin/dri}" + "--disable-glamor" "--with-default-font-path=" "--with-apple-application-name=XQuartz" "--with-apple-applications-dir=\${out}/Applications" @@ -983,7 +985,7 @@ self: super: xinit = (super.xinit.override { stdenv = if isDarwin then clangStdenv else stdenv; }).overrideAttrs (attrs: { - buildInputs = attrs.buildInputs ++ lib.optional isDarwin bootstrap_cmds; + nativeBuildInputs = attrs.nativeBuildInputs ++ lib.optional isDarwin bootstrap_cmds; depsBuildBuild = [ buildPackages.stdenv.cc ]; configureFlags = [ "--with-xserver=${xorg.xorgserver.out}/bin/X" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 56674b5bf848..4e592710eab0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24984,8 +24984,7 @@ with pkgs; inherit (buildPackages.darwin) bootstrap_cmds; udev = if stdenv.isLinux then udev else null; libdrm = if stdenv.isLinux then libdrm else null; - abiCompat = config.xorg.abiCompat # `config` because we have no `xorg.override` - or (if stdenv.isDarwin then "1.18" else null); # 1.19 needs fixing on Darwin + abiCompat = config.xorg.abiCompat or null; # `config` because we have no `xorg.override` }; generatedPackages = lib.callPackageWith __splicedPackages ../servers/x11/xorg/default.nix {};