From 2298cf999454f26d706461cc4c46efc2023c12ff Mon Sep 17 00:00:00 2001 From: Zitrone Date: Sun, 13 Apr 2025 21:26:16 +0200 Subject: [PATCH] xorgproto: refactor and move to pkgs/by-name from xorg namespace --- lib/licenses.nix | 12 ++ pkgs/by-name/xo/xorgproto/package.nix | 136 ++++++++++++++++++ pkgs/servers/x11/xorg/default.nix | 78 +--------- .../x11/xorg/generate-expr-from-tarballs.pl | 11 ++ pkgs/servers/x11/xorg/overrides.nix | 21 --- pkgs/servers/x11/xorg/tarballs.list | 1 - 6 files changed, 161 insertions(+), 98 deletions(-) create mode 100644 pkgs/by-name/xo/xorgproto/package.nix diff --git a/lib/licenses.nix b/lib/licenses.nix index 91a09db4082d..7204e5e539c6 100644 --- a/lib/licenses.nix +++ b/lib/licenses.nix @@ -702,6 +702,18 @@ lib.mapAttrs mkLicense ( fullName = "Historic Permission Notice and Disclaimer"; }; + hpndDifferentDisclaimer = { + fullName = "HPND with different disclaimer"; + url = "https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/blob/1914233e662d23ffb3812b80fadd0bbd064ad91c/COPYING-x11proto#L69-88"; + # TODO: if the license gets accepted to spdx then + # add spdxId + # else + # remove license + # && replace reference with whatever this license is supposed to be then + # https://tools.spdx.org/app/license_requests/456 + # https://github.com/spdx/license-list-xml/issues/2753 + }; + hpndSellVariant = { fullName = "Historical Permission Notice and Disclaimer - sell variant"; spdxId = "HPND-sell-variant"; diff --git a/pkgs/by-name/xo/xorgproto/package.nix b/pkgs/by-name/xo/xorgproto/package.nix new file mode 100644 index 000000000000..a0766a9979a4 --- /dev/null +++ b/pkgs/by-name/xo/xorgproto/package.nix @@ -0,0 +1,136 @@ +{ + lib, + stdenv, + fetchurl, + fetchpatch, + pkg-config, + python3, + meson, + ninja, + writeScript, + testers, +}: +stdenv.mkDerivation (finalAttrs: { + pname = "xorgproto"; + version = "2024.1"; + + src = fetchurl { + url = "mirror://xorg/individual/proto/xorgproto-${finalAttrs.version}.tar.xz"; + hash = "sha256-NyIl/UCBW4QjVH9diQxd68cuiLkQiPv7ExWMIElcy1k="; + }; + + patches = [ + # small fix for mingw + (fetchpatch { + url = "https://aur.archlinux.org/cgit/aur.git/plain/meson.patch?h=mingw-w64-xorgproto&id=7b817efc3144a50e6766817c4ca7242f8ce49307"; + sha256 = "sha256-Izzz9In53W7CC++k1bLr78iSrmxpFm1cH8qcSpptoUQ="; + }) + ]; + + strictDeps = true; + + nativeBuildInputs = [ + pkg-config + python3 + meson + ninja + ]; + + # adds support for printproto needed for libXp + mesonFlags = [ "-Dlegacy=true" ]; + + passthru = { + updateScript = writeScript "update-${finalAttrs.pname}" '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p common-updater-scripts + version="$(list-directory-versions --pname ${finalAttrs.pname} \ + --url https://xorg.freedesktop.org/releases/individual/proto/ \ + | sort -V | tail -n1)" + update-source-version ${finalAttrs.pname} "$version" + ''; + tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; + }; + + meta = { + description = "X Window System unified protocol definitions"; + homepage = "https://gitlab.freedesktop.org/xorg/proto/xorgproto"; + license = with lib.licenses; [ + # The copyright notices are split between each protocol, so to be able to validate this, + # I listed all the components that have the license for each license: + + # applewm, composite, dmx, evie, fixes, input, video, windowswm, x11, xext, xf86dri + mit + # bigreqs, fonts, input, lg3d, pm, x11, xmisc, xext, xinerama + mitOpenGroup + # composite, damage, dri3, fixes, fonts, present, randr, record, render, xext, xwayland + hpndSellVariant + # dri2 + icu + # fontcache + bsd2 + # gl + sgi-b-20 + # fonts, input, kb, trap, video, x11, xext + hpnd + # print, resource, scrnsaver, video, xext, xf86{bigfont,dga,misc,rush,vidmode}, xinerama + # Note: 2 of the licenses actually omit a sentence from the x11 license that is not marked as + # omittable by spdx. But the sentence is not integral to the license's meaning, I think. + x11 + # x11 + hpndDifferentDisclaimer + + # fontsproto and x11proto both contain a license that is almost the X11 license, but with one + # important difference: the sentence "Permission is hereby granted [...] to use, copy, + # modify, merge, publish, distribute ..." is replaced with "All rights reserved." + # Since XFree86 has the copyright and XFree86 was, at least in later releases, free software + # under the X11 license, I will give this the benefit of the doubt and not mark a package + # that idk 30% of nixpkgs depends on (estimate based on nothing other than most xorg stuff + # depends on it) as unfree. + # upstream issue: https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/issues/53 + #unfree + ]; + maintainers = [ ]; + pkgConfigModules = [ + "applewmproto" + "bigreqsproto" + "compositeproto" + "damageproto" + "dmxproto" + "dpmsproto" + "dri2proto" + "dri3proto" + "evieproto" + "fixesproto" + "fontcacheproto" + "fontsproto" + "glproto" + "inputproto" + "kbproto" + "lg3dproto" + "presentproto" + "printproto" + "randrproto" + "recordproto" + "renderproto" + "resourceproto" + "scrnsaverproto" + "trapproto" + "videoproto" + "windowswmproto" + "xcalibrateproto" + "xcmiscproto" + "xextproto" + "xf86bigfontproto" + "xf86dgaproto" + "xf86driproto" + "xf86miscproto" + "xf86rushproto" + "xf86vidmodeproto" + "xineramaproto" + "xproto" + "xproxymngproto" + "xwaylandproto" + ]; + platforms = lib.platforms.unix ++ lib.platforms.windows; + }; +}) diff --git a/pkgs/servers/x11/xorg/default.nix b/pkgs/servers/x11/xorg/default.nix index a781c054bfc2..b14b319e7d4f 100644 --- a/pkgs/servers/x11/xorg/default.nix +++ b/pkgs/servers/x11/xorg/default.nix @@ -16,6 +16,7 @@ xkeyboard-config, xorg-cf-files, xorg-docs, + xorgproto, xorg-sgml-doctools, xtrans, }: @@ -30,6 +31,7 @@ self: with self; { makedepend pixman xbitmaps + xorgproto xtrans ; fontalias = font-alias; @@ -7613,82 +7615,6 @@ self: with self; { }) ) { }; - # THIS IS A GENERATED FILE. DO NOT EDIT! - xorgproto = callPackage ( - { - stdenv, - pkg-config, - fetchurl, - libXt, - python3, - testers, - }: - stdenv.mkDerivation (finalAttrs: { - pname = "xorgproto"; - version = "2024.1"; - builder = ./builder.sh; - src = fetchurl { - url = "mirror://xorg/individual/proto/xorgproto-2024.1.tar.xz"; - sha256 = "0nfbbi4j130m2gxzp20hp642xizbbl68jpbzahiq8nw183yja8ip"; - }; - hardeningDisable = [ - "bindnow" - "relro" - ]; - strictDeps = true; - nativeBuildInputs = [ - pkg-config - python3 - ]; - buildInputs = [ libXt ]; - passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; - meta = { - pkgConfigModules = [ - "applewmproto" - "bigreqsproto" - "compositeproto" - "damageproto" - "dmxproto" - "dpmsproto" - "dri2proto" - "dri3proto" - "evieproto" - "fixesproto" - "fontcacheproto" - "fontsproto" - "glproto" - "inputproto" - "kbproto" - "lg3dproto" - "presentproto" - "printproto" - "randrproto" - "recordproto" - "renderproto" - "resourceproto" - "scrnsaverproto" - "trapproto" - "videoproto" - "windowswmproto" - "xcalibrateproto" - "xcmiscproto" - "xextproto" - "xf86bigfontproto" - "xf86dgaproto" - "xf86driproto" - "xf86miscproto" - "xf86rushproto" - "xf86vidmodeproto" - "xineramaproto" - "xproto" - "xproxymngproto" - "xwaylandproto" - ]; - platforms = lib.platforms.unix; - }; - }) - ) { }; - # THIS IS A GENERATED FILE. DO NOT EDIT! xorgserver = callPackage ( { diff --git a/pkgs/servers/x11/xorg/generate-expr-from-tarballs.pl b/pkgs/servers/x11/xorg/generate-expr-from-tarballs.pl index 3c524df264b9..f89ea6a648d6 100755 --- a/pkgs/servers/x11/xorg/generate-expr-from-tarballs.pl +++ b/pkgs/servers/x11/xorg/generate-expr-from-tarballs.pl @@ -47,6 +47,15 @@ $pcMap{"\$RENDERPROTO"} = "xorgproto"; $pcMap{"\$DRI3PROTO"} = "xorgproto"; $pcMap{"\$DRI2PROTO"} = "xorgproto"; $pcMap{"\${XKBMODULE}"} = "libxkbfile"; +foreach my $mod ("applewmproto", "bigreqsproto", "compositeproto", "damageproto", "dmxproto", + "dpmsproto", "dri2proto", "dri3proto", "evieproto", "fixesproto", "fontcacheproto", + "fontsproto", "glproto", "inputproto", "kbproto", "lg3dproto", "presentproto", + "printproto", "randrproto", "recordproto", "renderproto", "resourceproto", "scrnsaverproto", + "trapproto", "videoproto", "windowswmproto", "xcalibrateproto", "xcmiscproto", "xextproto", + "xf86bigfontproto", "xf86dgaproto", "xf86driproto", "xf86miscproto", "xf86rushproto", + "xf86vidmodeproto", "xineramaproto", "xproto", "xproxymngproto", "xwaylandproto") { + $pcMap{$mod} = "xorgproto"; +} my $downloadCache = "./download-cache"; @@ -281,6 +290,7 @@ print OUT <