xorg-server: switch to meson, significantly uncurse (#472679)

This commit is contained in:
Vladimír Čunát
2025-12-29 15:13:21 +00:00
committed by GitHub
5 changed files with 56 additions and 1573 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,13 @@
diff --git a/hw/xquartz/bundle/meson.build b/hw/xquartz/bundle/meson.build
index 22941203b..4d3f159cf 100644
--- a/hw/xquartz/bundle/meson.build
+++ b/hw/xquartz/bundle/meson.build
@@ -38,7 +38,7 @@ install_data('Resources/X11.icns',
install_mode: 'rw-r--r--')
custom_target('Info.plist',
- command: [cpp, '-P', cpp_defs, '@INPUT@'],
+ command: ['clang', '-E', '-P', cpp_defs, '@INPUT@'],
capture: true,
input: 'Info.plist.cpp',
output: 'Info.plist',
@@ -1,11 +0,0 @@
{ xorg-server }:
xorg-server.overrideAttrs (oldAttrs: {
configureFlags = oldAttrs.configureFlags ++ [
"--disable-xquartz"
"--enable-xorg"
"--enable-xvfb"
"--enable-xnest"
"--enable-kdrive"
];
postInstall = ":"; # prevent infinite recursion
})
@@ -1,32 +0,0 @@
---
hw/xfree86/Makefile.am | 1 -
hw/xfree86/Makefile.in | 1 -
2 files changed, 2 deletions(-)
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 9aeaea1..dcca3b8 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -100,7 +100,6 @@ EXTRA_DIST = xorgconf.cpp
# Without logdir, X will post an error on the terminal and will not start
install-data-local:
- $(AM_V_GEN)$(MKDIR_P) $(DESTDIR)$(logdir)
if CYGWIN
$(INSTALL_DATA) libXorg.exe.a $(DESTDIR)$(libdir)/libXorg.exe.a
endif
diff --git a/hw/xfree86/Makefile.in b/hw/xfree86/Makefile.in
index c4fceee..74da8f1 100644
--- a/hw/xfree86/Makefile.in
+++ b/hw/xfree86/Makefile.in
@@ -1161,7 +1161,6 @@ uninstall-am: uninstall-binPROGRAMS uninstall-local \
# Without logdir, X will post an error on the terminal and will not start
install-data-local:
- $(AM_V_GEN)$(MKDIR_P) $(DESTDIR)$(logdir)
@CYGWIN_TRUE@ $(INSTALL_DATA) libXorg.exe.a $(DESTDIR)$(libdir)/libXorg.exe.a
install-exec-hook:
--
2.25.4
+43 -121
View File
@@ -2,22 +2,23 @@
lib,
stdenv,
fetchurl,
fetchpatch,
callPackage,
# build system
buildPackages,
meson,
ninja,
pkg-config,
# deps
dbus,
dri-pkgconfig-stub,
fontutil,
libdrm,
libepoxy,
libgbm,
libGL,
libGLU,
libpciaccess,
libtirpc,
libunwind,
libx11,
libxau,
@@ -48,80 +49,46 @@
# darwin specific deps
darwin,
autoconf,
automake,
autoreconfHook,
fontutil,
utilmacros,
libapplewm,
writeScript,
testers,
}:
let
# XQuartz requires two compilations: the first to get X / XQuartz,
# and the second to get Xvfb, Xnest, etc.
darwinOtherX = callPackage ./darwin/proto-package.nix { };
in
stdenv.mkDerivation (finalAttrs: {
pname = "xorg-server";
version = "21.1.20";
outputs = [ "out" ] ++ lib.optional (!stdenv.hostPlatform.isDarwin) "dev";
outputs = [
"out"
"dev"
];
src = fetchurl {
url = "mirror://xorg/individual/xserver/xorg-server-${finalAttrs.version}.tar.xz";
hash = "sha256-dpW8YYJLOoG2utL3iwVADKAVAD3kAtGzIhFxBbcC6Tc=";
};
patches =
lib.optionals (!stdenv.hostPlatform.isDarwin) [
# The build process tries to create the specified logdir when building.
#
# We set it to /var/log which can't be touched from inside the sandbox causing the build to hard-fail
./dont-create-logdir-during-build.patch
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# XQuartz patchset
(fetchpatch {
url = "https://github.com/XQuartz/xorg-server/commit/e88fd6d785d5be477d5598e70d105ffb804771aa.patch";
sha256 = "1q0a30m1qj6ai924afz490xhack7rg4q3iig2gxsjjh98snikr1k";
name = "use-cppflags-not-cflags.patch";
})
(fetchpatch {
url = "https://github.com/XQuartz/xorg-server/commit/75ee9649bcfe937ac08e03e82fd45d9e18110ef4.patch";
sha256 = "1vlfylm011y00j8mig9zy6gk9bw2b4ilw2qlsc6la49zi3k0i9fg";
name = "use-old-mitrapezoids-and-mitriangles-routines.patch";
})
(fetchpatch {
url = "https://github.com/XQuartz/xorg-server/commit/c58f47415be79a6564a9b1b2a62c2bf866141e73.patch";
sha256 = "19sisqzw8x2ml4lfrwfvavc2jfyq2bj5xcf83z89jdxg8g1gdd1i";
name = "revert-fb-changes-1.patch";
})
(fetchpatch {
url = "https://github.com/XQuartz/xorg-server/commit/56e6f1f099d2821e5002b9b05b715e7b251c0c97.patch";
sha256 = "0zm9g0g1jvy79sgkvy0rjm6ywrdba2xjd1nsnjbxjccckbr6i396";
name = "revert-fb-changes-2.patch";
})
./darwin/bundle_main.patch
./darwin/stub.patch
];
patches = lib.optionals stdenv.hostPlatform.isDarwin [
./darwin/bundle_main.patch
./darwin/find-cpp.patch
./darwin/stub.patch
];
strictDeps = true;
depsBuildBuild = lib.optionals (!stdenv.hostPlatform.isDarwin) [ buildPackages.stdenv.cc ];
nativeBuildInputs = [
meson
ninja
pkg-config
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
autoreconfHook
darwin.bootstrap_cmds
utilmacros
fontutil
];
buildInputs = [
fontutil
libx11
libxau
libxcb
@@ -134,6 +101,7 @@ stdenv.mkDerivation (finalAttrs: {
libxdmcp
libxfixes
libxkbfile
mesa-gl-headers
openssl
xorgproto
xtrans
@@ -142,23 +110,13 @@ stdenv.mkDerivation (finalAttrs: {
dri-pkgconfig-stub
libdrm
libgbm
mesa-gl-headers
libtirpc
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
autoconf
automake
darwin.bootstrap_cmds
mesa
];
hardeningDisable = [
# Removing this breaks GLAMOR due to failing to find libgbm symbols at runtime:
# Failed to load /...modesetting_drv.so: /...modesetting_drv.so: undefined symbol: gbm_bo_get_plane_count
# This is likely some load order weirdness, but we don't have a better solution for now.
# FIXME: fix this properly.
"bindnow"
];
propagatedBuildInputs = [
dbus
libepoxy
@@ -177,77 +135,41 @@ stdenv.mkDerivation (finalAttrs: {
++ lib.optionals stdenv.hostPlatform.isLinux [ udev ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ libapplewm ];
configureFlags = [
"--with-default-font-path="
# there were only paths containing "${prefix}",
# and there are no fonts in this package anyway
"--with-xkb-bin-directory=${xkbcomp}/bin"
"--with-xkb-path=${xkeyboardconfig}/share/X11/xkb"
"--with-xkb-output=$out/share/X11/xkb/compiled"
mesonFlags = [
"-Dxephyr=true"
"-Dxvfb=true"
"-Dxnest=true"
"-Dxorg=true"
"-Dlog_dir=/var/log"
"-Ddefault_font_path="
"-Dxkb_bin_dir=${xkbcomp}/bin"
"-Dxkb_dir=${xkeyboardconfig}/share/X11/xkb"
"-Dxkb_output_dir=$out/share/X11/xkb/compiled"
]
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
"--enable-kdrive" # not built by default
"--enable-xephyr"
"--enable-xcsecurity" # enable SECURITY extension
"--with-log-dir=/var/log"
"--enable-glamor"
"--with-os-name=Nix" # r13y, embeds the build machine's kernel version otherwise
]
++ lib.optionals (!stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isMusl) [
"--disable-tls"
"-Dxcsecurity=true"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# note: --enable-xquartz is auto
"CPPFLAGS=-I${./darwin/dri}"
"--disable-libunwind" # libunwind on darwin is missing unw_strerror
"--disable-glamor"
"--with-apple-application-name=XQuartz"
"--with-apple-applications-dir=\${out}/Applications"
"--with-bundle-id-prefix=org.nixos.xquartz"
"--with-sha1=CommonCrypto"
"--without-dtrace" # requires Command Line Tools for Xcode
"-Dglamor=false"
"-Dsecure-rpc=false"
"-Dint10=false"
"-Dpciaccess=false"
"-Dapple-application-name=XQuartz"
"-Dapple-applications-dir=${placeholder "out"}/Applications"
"-Dbundle-id-prefix=org.nixos.xquartz"
"-Dsha1=CommonCrypto"
];
env = lib.optionalAttrs (!stdenv.hostPlatform.isDarwin) {
# Needed with GCC 12
NIX_CFLAGS_COMPILE = "-Wno-error=array-bounds";
};
prePatch = lib.optionalString (!stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isMusl) ''
export CFLAGS+=" -D__uid_t=uid_t -D__gid_t=gid_t"
'';
postPatch = ''
substituteInPlace dri3/*.c \
--replace-fail '#include <drm_fourcc.h>' '#include <libdrm/drm_fourcc.h>'
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace hw/xquartz/mach-startup/stub.c \
--subst-var-by XQUARTZ_APP "$out/Applications/XQuartz.app"
'';
preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/Applications
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -Wno-error"
'';
postInstall = ''
rm -fr $out/share/X11/xkb/compiled # otherwise X will try to write in it
''
+ lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
( # assert() keeps runtime reference xorgserver-dev in xf86-video-intel and others
cd "$dev"
for f in include/xorg/*.h; do
sed "1i#line 1 \"${finalAttrs.pname}-${finalAttrs.version}/$f\"" -i "$f"
done
)
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
cp -rT ${darwinOtherX}/bin $out/bin
rm -f $out/bin/X
ln -s Xquartz $out/bin/X
cp ${darwinOtherX}/share/man -rT $out/share/man
# default X install symlinks this to Xorg, we want XQuartz
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
ln -sf $out/bin/Xquartz $out/bin/X
'';
passthru = {